Skip to content

Commit

Permalink
intel-hid: Disable button array during suspend-to-idle
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Andy Shevchenko <[email protected]>
  • Loading branch information
rafaeljw committed Aug 9, 2019
1 parent 31eb845 commit d19bdb8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/platform/x86/intel-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,21 +274,22 @@ 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;
}

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;
}

Expand Down

0 comments on commit d19bdb8

Please sign in to comment.