summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorElia Devito <eliadevito@gmail.com>2020-12-04 17:02:35 +0100
committerHans de Goede <hdegoede@redhat.com>2020-12-07 17:40:40 +0100
commitac32bae0008340d87328a74d7598333bf48348c7 (patch)
tree980aa64bea7ebedabce8e743a2a8f37f946b3f17 /drivers/platform
parent537b0dd4729e7f5c5b3e8321954d3b8a2d0dd7a8 (diff)
downloadlinux-ac32bae0008340d87328a74d7598333bf48348c7.tar.bz2
platform/x86: intel-hid: Add alternative method to enable switches
Some convertible have unreliable VGBS return, in these cases we enable support when receiving the first event. Signed-off-by: Elia Devito <eliadevito@gmail.com> Link: https://lore.kernel.org/r/20201204160234.36832-1-elia@xvalue.it Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/intel-hid.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c
index c69c2cc1e079..66ccdc17a64d 100644
--- a/drivers/platform/x86/intel-hid.c
+++ b/drivers/platform/x86/intel-hid.c
@@ -435,6 +435,19 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
struct platform_device *device = context;
struct intel_hid_priv *priv = dev_get_drvdata(&device->dev);
unsigned long long ev_index;
+ int err;
+
+ /*
+ * Some convertible have unreliable VGBS return which could cause incorrect
+ * SW_TABLET_MODE report, in these cases we enable support when receiving
+ * the first event instead of during driver setup.
+ */
+ if (!priv->switches && (event == 0xcc || event == 0xcd)) {
+ dev_info(&device->dev, "switch event received, enable switches supports\n");
+ err = intel_hid_switches_setup(device);
+ if (err)
+ pr_err("Failed to setup Intel HID switches\n");
+ }
if (priv->wakeup_mode) {
/*