platform/x86: intel-hid: Fix spurious wakeups caused by tablet-mode events during suspend

Some devices send (duplicate) tablet-mode events when moved around even
though the mode has not changed; and they do this even when suspended.

Change the tablet-mode event handling when priv->wakeup_mode is set to
update the switch state in case it changed and then return immediately
(without calling pm_wakeup_hard_event()) to avoid spurious wakeups.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212537
Fixes: 537b0dd472 ("platform/x86: intel-hid: Add support for SW_TABLET_MODE")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Elia Devito <eliadevito@gmail.com>
Link: https://lore.kernel.org/r/20210404143831.25173-1-hdegoede@redhat.com
This commit is contained in:
Hans de Goede 2021-04-04 16:38:31 +02:00
parent d1635448f1
commit a3790a8a94
1 changed files with 9 additions and 7 deletions

View File

@ -483,11 +483,16 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
goto wakeup; goto wakeup;
/* /*
* Switch events will wake the device and report the new switch * Some devices send (duplicate) tablet-mode events when moved
* position to the input subsystem. * around even though the mode has not changed; and they do this
* even when suspended.
* Update the switch state in case it changed and then return
* without waking up to avoid spurious wakeups.
*/ */
if (priv->switches && (event == 0xcc || event == 0xcd)) if (event == 0xcc || event == 0xcd) {
goto wakeup; report_tablet_mode_event(priv->switches, event);
return;
}
/* Wake up on 5-button array events only. */ /* Wake up on 5-button array events only. */
if (event == 0xc0 || !priv->array) if (event == 0xc0 || !priv->array)
@ -501,9 +506,6 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
wakeup: wakeup:
pm_wakeup_hard_event(&device->dev); pm_wakeup_hard_event(&device->dev);
if (report_tablet_mode_event(priv->switches, event))
return;
return; return;
} }