aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <[email protected]>2021-01-15 17:18:49 +0100
committerHans de Goede <[email protected]>2021-01-25 21:34:32 +0100
commit3a2f53cd03101f6a7cc34c558b0dbfbaca798165 (patch)
tree68e594744a51e83b0b93f0ad7f4fd1091cc27ac6
parent034b8c2e7b06777775c55cd2db2b6a98f4791b5f (diff)
platform/x86: intel-vbtn: Add alternative method to enable switches
Some 2-in-1s have a broken VGBS method, so we cannot get an initial state for the switches from them. Reporting the wrong initial state for SW_TABLET_MODE causes serious problems (touchpad and/or keyboard events being ignored by userspace when reporting SW_TABLET_MODE=1), so on these devices we cannot register an input-dev for the switches at probe time. We can however register an input-dev for the switches as soon as we receive the first switches event, because then we will know the state. Note this mirrors the behavior of recent changs to the intel-hid driver which also registers a separate switches input-dev on receiving the first event on machines with a broken VGBS method. Cc: Elia Devito <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--drivers/platform/x86/intel-vbtn.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
index 04725173d087..852cb07c3dfd 100644
--- a/drivers/platform/x86/intel-vbtn.c
+++ b/drivers/platform/x86/intel-vbtn.c
@@ -145,6 +145,7 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
const struct key_entry *ke, *ke_rel;
struct input_dev *input_dev;
bool autorelease;
+ int ret;
if ((ke = sparse_keymap_entry_from_scancode(priv->buttons_dev, event))) {
if (!priv->has_buttons) {
@@ -154,8 +155,12 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
input_dev = priv->buttons_dev;
} else if ((ke = sparse_keymap_entry_from_scancode(priv->switches_dev, event))) {
if (!priv->has_switches) {
- dev_warn(&device->dev, "Warning: received a switches event on a device without switchess, please report this.\n");
- return;
+ dev_info(&device->dev, "Registering Intel Virtual Switches input-dev after receiving a switch event\n");
+ ret = input_register_device(priv->switches_dev);
+ if (ret)
+ return;
+
+ priv->has_switches = true;
}
input_dev = priv->switches_dev;
} else {