From patchwork Sun Sep 17 22:57:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?J=C3=A9r=C3=B4me_de_Bretagne?= X-Patchwork-Id: 9955253 X-Patchwork-Delegate: dvhart@infradead.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 676E46039A for ; Sun, 17 Sep 2017 22:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B4D128A69 for ; Sun, 17 Sep 2017 22:58:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5054B28ABD; Sun, 17 Sep 2017 22:58:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BE4828A69 for ; Sun, 17 Sep 2017 22:58:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751636AbdIQW6G (ORCPT ); Sun, 17 Sep 2017 18:58:06 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36759 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751537AbdIQW6F (ORCPT ); Sun, 17 Sep 2017 18:58:05 -0400 Received: by mail-wr0-f194.google.com with SMTP id g50so4126204wra.3; Sun, 17 Sep 2017 15:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RwuUzPjf+Knm6zODAweCnJpYBFn+agMkIP/99LXsUZM=; b=XfEeXBz2StHNiY97ASJ/e9tdNLcDm6u3hHNiHo7tXMAff9m2R+IPshE7YbIYF1azI/ tkJwTSED9l0kVu72qJrSHwnaHVGhdnxjaxZMgLPXvgS+1E8e7SmZhLEp9KrVYg/k5xxb hgYqv4+BQwuunsdhWPzs4bXH6uYAOYqA/hDJKar+/7McFXXJfnSZPHtSdkUsu1E4N8tA sJcBzfC4VuQC/9qSkYgBBU80GBGD7KwRbHGVVy1JqzgFS1YsUFLe1nha9Bz44owzYeDd zsrj5gYv0heLruo4p94X3qH2rY4qS9MwFqruSSyHoMQj8jJ3daNyN3ycrQsNtU/l9/9/ cmdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RwuUzPjf+Knm6zODAweCnJpYBFn+agMkIP/99LXsUZM=; b=lYXGeg106ENNcog8G2LSZ9ckC47kycQpF5gFpfTHbqjVIpAHuxv7unOCq12+OqA8Xy qoL4gLiM2h0Hx5aD7Zb7+qGV//DUMkrroCUR93HMu6nRewv87KaKwp+wo6I0P2ksX2i3 S7YumoGmN/2vP1ayrU5J7ydwNaUcD6lv7OpRGXPzdCPDu2wK8Y6Rmm2rS3VKObExYnsy Re8FgDlc2oOQFRHALp4sJh9fsCv5YrDBIdueny0+fItTw6vhyanm0q5GdyDvkVFm+psZ Sjdvz+F1IL8sumXmeyF90cC1EiiknhzeGHkCfynLi8BBxo9wrhnUMk7jIz0V9OdrlUDO qM6g== X-Gm-Message-State: AHPjjUgo+x7el9ZigYpGWhD0qDWpfvTmel9z2ArxFd77gcrfJXH09ot7 0rJf1zHNAZWEMrgh X-Google-Smtp-Source: ADKCNb6iVEnH4aa8Gb47b656sLpO60/wvqcKEHdDtb49cPyRkf04+/dCjeBo1/5RgIE+mZiPRDpKmQ== X-Received: by 10.223.164.22 with SMTP id d22mr28085850wra.7.1505689083362; Sun, 17 Sep 2017 15:58:03 -0700 (PDT) Received: from latitude-7275.home (2a01cb04006a0a00e6b318fffe583f45.ipv6.abo.wanadoo.fr. [2a01:cb04:6a:a00:e6b3:18ff:fe58:3f45]) by smtp.gmail.com with ESMTPSA id 109sm5734225wrc.25.2017.09.17.15.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Sep 2017 15:58:02 -0700 (PDT) From: =?UTF-8?q?J=C3=A9r=C3=B4me=20de=20Bretagne?= To: platform-driver-x86@vger.kernel.org Cc: Darren Hart , LKML , Linux ACPI , "Rafael J. Wysocki" , Andy Shevchenko , Mario Limonciello , Alex Hung Subject: [PATCH] platform/x86: intel-hid: Power button suspend on Dell Latitude 7275 Date: Mon, 18 Sep 2017 00:57:12 +0200 Message-Id: <20170917225712.12136-1-jerome.debretagne@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme de Bretagne On Dell Latitude 7275 the 5-button array is not exposed in the ACPI tables, but still notifies are sent to the Intel HID device object (device ID INT33D5) in response to power button actions. They were ignored as the intel-hid driver was not prepared to take care of them until recently. Power button wakeup from suspend-to-idle was added in: 635173a17b03 ("intel-hid: Wake up Dell Latitude 7275 from suspend-to-idle"). However power button suspend doesn't work yet on this platform so it would be good to add it also. On the affected platform (for which priv->array is NULL), add a new upfront check against the power button press notification (0xCE) to notify_handler(), outside the wakeup mode this time, which allows to report the power button press event and trigger the suspend. Also catch and ignore the corresponding power button release notification (0xCF) to stop it from being reported as an "unknown event" in the logs. Link: https://bugzilla.kernel.org/show_bug.cgi?id=196115 Tested-by: Jérôme de Bretagne Signed-off-by: Jérôme de Bretagne Acked-By: Mario Limonciello --- drivers/platform/x86/intel-hid.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c index a782c78e7c63..b19f8dcf9d8c 100644 --- a/drivers/platform/x86/intel-hid.c +++ b/drivers/platform/x86/intel-hid.c @@ -226,6 +226,22 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) return; } + /* + * Needed for suspend to work on some platforms that don't expose + * the 5-button array, but still send notifies with power button + * event code to this device object on power button actions. + * + * Report the power button press; catch and ignore the button release. + */ + if (!priv->array) { + if (event == 0xce) { + input_report_key(priv->input_dev, KEY_POWER, 1); + input_sync(priv->input_dev); + return; + } else if (event == 0xcf) + return; + } + /* 0xC0 is for HID events, other values are for 5 button array */ if (event != 0xc0) { if (!priv->array ||