From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: platform-driver-x86@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>
Subject: [PATCH 2/2] intel-hid: Disable button array during suspend-to-idle
Date: Thu, 08 Aug 2019 10:44:25 +0200 [thread overview]
Message-ID: <2765892.t9mEYBIOOk@kreacher> (raw)
In-Reply-To: <1717835.1Yz4jNODO2@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Notice that intel_button_array_enable() never disables the power
button which is the only one needed to wake up the system from
suspend-to-idle, so it can be safely called during suspend-to-idle
as well as during "regular" system suspend, and rearrange the
code in the driver's "suspend" and "resume" callbacks accordingly.
While at it, use pm_suspend_no_platform() to check if the current
suspend-resume cycle is suspend-to-idle, as that is the only
case when the device should be enabled while suspended.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/platform/x86/intel-hid.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
Index: linux-pm/drivers/platform/x86/intel-hid.c
===================================================================
--- linux-pm.orig/drivers/platform/x86/intel-hid.c
+++ linux-pm/drivers/platform/x86/intel-hid.c
@@ -274,10 +274,11 @@ static void intel_hid_pm_complete(struct
static int intel_hid_pl_suspend_handler(struct device *device)
{
- if (pm_suspend_via_firmware()) {
+ intel_button_array_enable(device, false);
+
+ if (!pm_suspend_no_platform())
intel_hid_set_enable(device, false);
- intel_button_array_enable(device, false);
- }
+
return 0;
}
@@ -285,10 +286,10 @@ static int intel_hid_pl_resume_handler(s
{
intel_hid_pm_complete(device);
- if (pm_resume_via_firmware()) {
+ if (!pm_suspend_no_platform())
intel_hid_set_enable(device, true);
- intel_button_array_enable(device, true);
- }
+
+ intel_button_array_enable(device, true);
return 0;
}
next prev parent reply other threads:[~2019-08-08 8:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 8:40 [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Rafael J. Wysocki
2019-08-08 8:42 ` [PATCH 1/2] intel-hid: intel-vbtn: Avoid leaking wakeup_mode set Rafael J. Wysocki
2019-08-08 8:44 ` Rafael J. Wysocki [this message]
2019-08-08 11:19 ` [PATCH 0/2] intel-hid: intel-vbtn: Suspend-related fix and update Andy Shevchenko
2019-08-09 8:15 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2765892.t9mEYBIOOk@kreacher \
--to=rjw@rjwysocki.net \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox