Commit cb1921b1 authored by Mathew King's avatar Mathew King Committed by Andy Shevchenko

platform/x86: intel-vbtn: Report switch events when event wakes device

When a switch event, such as tablet mode/laptop mode or docked/undocked,
wakes a device make sure that the value of the swich is reported.
Without when a device is put in tablet mode from laptop mode when it is
suspended or vice versa the device will wake up but mode will be
incorrect.

Tested by suspending a device in laptop mode and putting it in tablet
mode, the device resumes and is in tablet mode. When suspending the
device in tablet mode and putting it in laptop mode the device resumes
and is in laptop mode.
Signed-off-by: default avatarMathew King <mathewk@chromium.org>
Reviewed-by: default avatarJett Rink <jettrink@chromium.org>
Reviewed-by: default avatarMario Limonciello <mario.limonciello@dell.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 401fee81
...@@ -76,12 +76,24 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) ...@@ -76,12 +76,24 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
struct platform_device *device = context; struct platform_device *device = context;
struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev); struct intel_vbtn_priv *priv = dev_get_drvdata(&device->dev);
unsigned int val = !(event & 1); /* Even=press, Odd=release */ unsigned int val = !(event & 1); /* Even=press, Odd=release */
const struct key_entry *ke_rel; const struct key_entry *ke, *ke_rel;
bool autorelease; bool autorelease;
if (priv->wakeup_mode) { if (priv->wakeup_mode) {
if (sparse_keymap_entry_from_scancode(priv->input_dev, event)) { ke = sparse_keymap_entry_from_scancode(priv->input_dev, event);
if (ke) {
pm_wakeup_hard_event(&device->dev); pm_wakeup_hard_event(&device->dev);
/*
* Switch events like tablet mode will wake the device
* and report the new switch position to the input
* subsystem.
*/
if (ke->type == KE_SW)
sparse_keymap_report_event(priv->input_dev,
event,
val,
0);
return; return;
} }
goto out_unknown; goto out_unknown;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment