summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-08-08 11:39:23 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-08-09 10:15:41 +0200
commitd19bdb876bece27187d4ffbc272672e1239cd313 (patch)
tree174fae6bb303c2fd08d0470f457810123ced28c0 /drivers/platform
parentintel-hid: intel-vbtn: Avoid leaking wakeup_mode set (diff)
downloadlinux-d19bdb876bece27187d4ffbc272672e1239cd313.tar.xz
linux-d19bdb876bece27187d4ffbc272672e1239cd313.zip
intel-hid: Disable button array during suspend-to-idle
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> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/intel-hid.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c
index 6feda887df9d..18ac237114ff 100644
--- a/drivers/platform/x86/intel-hid.c
+++ b/drivers/platform/x86/intel-hid.c
@@ -274,10 +274,11 @@ static void intel_hid_pm_complete(struct device *device)
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(struct device *device)
{
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;
}