platform/x86: fujitsu-laptop: Support Lifebook U7x7 hotkeys
authorJan-Marek Glogowski <glogow@fbihome.de>
Mon, 12 Feb 2018 12:08:51 +0000 (13:08 +0100)
committerDarren Hart (VMware) <dvhart@infradead.org>
Fri, 23 Mar 2018 23:14:29 +0000 (16:14 -0700)
Generate input events for hotkeys present in Fujitsu Lifebook
U727 and U757 laptops:
  - Fn+F1 (KEY_MICMUTE)
  - Fn+F5 (KEY_RFKILL)

Signed-off-by: Jan-Marek Glogowski <glogow@fbihome.de>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
drivers/platform/x86/fujitsu-laptop.c

index 6f4a55a53cedd3b39c081e16081715eab42ef6ef..cd95b6f3a06405835edadfc6ea92a5b46bab591f 100644 (file)
@@ -461,7 +461,9 @@ static const struct key_entry keymap_default[] = {
        { KE_KEY, KEY3_CODE, { KEY_PROG3 } },
        { KE_KEY, KEY4_CODE, { KEY_PROG4 } },
        { KE_KEY, KEY5_CODE, { KEY_RFKILL } },
+       { KE_KEY, BIT(5),    { KEY_RFKILL } },
        { KE_KEY, BIT(26),   { KEY_TOUCHPAD_TOGGLE } },
+       { KE_KEY, BIT(29),   { KEY_MICMUTE } },
        { KE_END, 0 }
 };
 
@@ -901,7 +903,7 @@ static void acpi_fujitsu_laptop_release(struct acpi_device *device)
 static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event)
 {
        struct fujitsu_laptop *priv = acpi_driver_data(device);
-       int scancode, i = 0;
+       int scancode, i = 0, ret;
        unsigned int irb;
 
        if (event != ACPI_FUJITSU_NOTIFY_CODE) {
@@ -932,9 +934,18 @@ static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event)
         * E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is
         * handled in software; its state is queried using FUNC_FLAGS
         */
-       if ((priv->flags_supported & BIT(26)) &&
-           (call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0) & BIT(26)))
-               sparse_keymap_report_event(priv->input, BIT(26), 1, true);
+       if (priv->flags_supported & (BIT(5) | BIT(26) | BIT(29))) {
+               ret = call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0);
+               if (ret & BIT(5))
+                       sparse_keymap_report_event(priv->input,
+                                                  BIT(5), 1, true);
+               if (ret & BIT(26))
+                       sparse_keymap_report_event(priv->input,
+                                                  BIT(26), 1, true);
+               if (ret & BIT(29))
+                       sparse_keymap_report_event(priv->input,
+                                                  BIT(29), 1, true);
+       }
 }
 
 /* Initialization */