summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/asus-wmi.c
diff options
context:
space:
mode:
authorChris Chiu <chiu@endlessm.com>2018-06-20 17:46:45 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-07-02 15:13:40 +0300
commited99d29b2b1562e5173953a5ea8b7861a4f29e2c (patch)
tree23c8dc208a3a6038cdca1c0470470b86d3ed6216 /drivers/platform/x86/asus-wmi.c
parentdbb3d78f61badeadc7448f9d88a070a76612860f (diff)
downloadlinux-ed99d29b2b1562e5173953a5ea8b7861a4f29e2c.tar.xz
platform/x86: asus-wmi: Add keyboard backlight toggle support
Some ASUS laptops like UX550GE has hotkey (Fn+F7) for keyboard backlight toggle which would emit the scan code 0xc7 each keypress. On the UX550GE, the max keyboard brightness level is 3 so the toggle would not be simply on/off the led but need to be cyclic. Per ASUS spec, it should increment the brightness for each keypress, then toggle(off) the LED when it already reached the max level. Signed-off-by: Chris Chiu <chiu@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/asus-wmi.c')
-rw-r--r--drivers/platform/x86/asus-wmi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 3944e065ab77..34dcc1aac4ea 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -67,6 +67,7 @@ MODULE_LICENSE("GPL");
#define NOTIFY_BRNDOWN_MAX 0x2e
#define NOTIFY_KBD_BRTUP 0xc4
#define NOTIFY_KBD_BRTDWN 0xc5
+#define NOTIFY_KBD_BRTTOGGLE 0xc7
/* WMI Methods */
#define ASUS_WMI_METHODID_SPEC 0x43455053 /* BIOS SPECification */
@@ -1775,6 +1776,13 @@ static void asus_wmi_notify(u32 value, void *context)
do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk - 1);
goto exit;
}
+ if (code == NOTIFY_KBD_BRTTOGGLE) {
+ if (asus->kbd_led_wk == asus->kbd_led.max_brightness)
+ do_kbd_led_set(&asus->kbd_led, 0);
+ else
+ do_kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1);
+ goto exit;
+ }
if (is_display_toggle(code) &&
asus->driver->quirks->no_display_toggle)