]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/platform/x86/asus-wmi.c
asus-wmi: add display toggle quirk
[karo-tx-linux.git] / drivers / platform / x86 / asus-wmi.c
index 912ec7de71f4d997366fe2a908b2e31a5ae27256..208e71c618479c5966da114cd6a2a8b9547afd4c 100644 (file)
@@ -1341,6 +1341,23 @@ static void asus_wmi_backlight_exit(struct asus_wmi *asus)
        asus->backlight_device = NULL;
 }
 
+static int is_display_toggle(int code)
+{
+       /* display toggle keys */
+       if ((code >= 0x61 && code <= 0x67) ||
+           (code >= 0x8c && code <= 0x93) ||
+           (code >= 0xa0 && code <= 0xa7) ||
+           (code >= 0xd0 && code <= 0xd5))
+               return 1;
+
+       return 0;
+}
+
+static void do_nothing(void)
+{
+       return;
+}
+
 static void asus_wmi_notify(u32 value, void *context)
 {
        struct asus_wmi *asus = context;
@@ -1380,10 +1397,18 @@ static void asus_wmi_notify(u32 value, void *context)
                code = NOTIFY_BRNDOWN_MIN;
 
        if (code == NOTIFY_BRNUP_MIN || code == NOTIFY_BRNDOWN_MIN) {
-               if (!acpi_video_backlight_support())
+               if (!acpi_video_backlight_support()) {
                        asus_wmi_backlight_notify(asus, orig_code);
-       } else if (!sparse_keymap_report_event(asus->inputdev, code,
-                                              key_value, autorelease))
+               }
+               goto exit;
+       }
+
+       if (is_display_toggle(code) &&
+           asus->driver->quirks->no_display_toggle)
+               goto exit;
+
+       if (!sparse_keymap_report_event(asus->inputdev, code,
+                                       key_value, autorelease))
                pr_info("Unknown key %x pressed\n", code);
 
 exit: