From: Chris Chiu <chiu@endlessm.com>
To: corentin.chary@gmail.com, dvhart@infradead.org,
andy.shevchenko@gmail.com
Cc: linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org,
acpi4asus-user@lists.sourceforge.net, hdegoede@redhat.com,
linux@endlessm.com, Chris Chiu <chiu@endlessm.com>
Subject: [PATCH 2/2] platform/x86: asus-wmi: Add keyboard backlight toggle support
Date: Mon, 4 Jun 2018 20:32:38 +0800 [thread overview]
Message-ID: <20180604123238.82200-2-chiu@endlessm.com> (raw)
In-Reply-To: <20180604123238.82200-1-chiu@endlessm.com>
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>
---
drivers/platform/x86/asus-wmi.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index b4915b7718c1..100e13e0817e 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 */
@@ -1704,7 +1705,9 @@ static int is_display_toggle(int code)
static int is_kbd_led_event(int code)
{
- if (code == NOTIFY_KBD_BRTUP || code == NOTIFY_KBD_BRTDWN)
+ if (code == NOTIFY_KBD_BRTUP ||
+ code == NOTIFY_KBD_BRTDWN ||
+ code == NOTIFY_KBD_BRTTOGGLE)
return 1;
return 0;
}
@@ -1755,7 +1758,10 @@ static void asus_wmi_notify(u32 value, void *context)
}
if (is_kbd_led_event(code)) {
- if (code == NOTIFY_KBD_BRTDWN)
+ if (code == NOTIFY_KBD_BRTTOGGLE &&
+ asus->kbd_led_wk == asus->kbd_led.max_brightness)
+ kbd_led_set(&asus->kbd_led, 0);
+ else if (code == NOTIFY_KBD_BRTDWN)
kbd_led_set(&asus->kbd_led, asus->kbd_led_wk - 1);
else
kbd_led_set(&asus->kbd_led, asus->kbd_led_wk + 1);
--
2.11.0
next prev parent reply other threads:[~2018-06-04 12:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 12:32 [PATCH 1/2] platform/x86: asus-wmi: Call new led hw_changed API on kbd brightness change Chris Chiu
2018-06-04 12:32 ` Chris Chiu [this message]
2018-06-04 13:22 ` Hans de Goede
2018-06-04 13:51 ` Daniel Drake
2018-06-04 14:23 ` Hans de Goede
2018-06-04 15:46 ` Azael Avalos
2018-06-05 2:31 ` Darren Hart
2018-06-05 3:18 ` Chris Chiu
2018-06-05 7:37 ` Hans de Goede
2018-06-05 9:58 ` Bastien Nocera
2018-06-05 10:05 ` Hans de Goede
2018-06-05 10:14 ` Bastien Nocera
2018-06-05 10:31 ` Hans de Goede
2018-06-05 10:46 ` Benjamin Berg
2018-06-05 11:06 ` Hans de Goede
2018-06-06 2:50 ` Chris Chiu
2018-06-06 14:27 ` Benjamin Berg
2018-06-06 15:32 ` Hans de Goede
2018-06-09 0:33 ` Darren Hart
2018-06-09 11:13 ` Hans de Goede
2018-06-05 7:35 ` Hans de Goede
2018-06-05 2:17 ` Darren Hart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180604123238.82200-2-chiu@endlessm.com \
--to=chiu@endlessm.com \
--cc=acpi4asus-user@lists.sourceforge.net \
--cc=andy.shevchenko@gmail.com \
--cc=corentin.chary@gmail.com \
--cc=dvhart@infradead.org \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@endlessm.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®