From: Chris Chiu <chiu@endlessm.com>
To: corentin.chary@gmail.com, dvhart@infradead.org, andy@infradead.org
Cc: acpi4asus-user@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, linux@endlessm.com,
Chris Chiu <chiu@endlessm.com>,
Jian-Hong Pan <jian-hong@endlessm.com>
Subject: [PATCH v2] platform/x86: asus-wmi: Add keyboard backlight toggle support
Date: Thu, 3 May 2018 11:04:38 +0800 [thread overview]
Message-ID: <20180503030438.51150-1-chiu@endlessm.com> (raw)
Some Asus laptops like UX550GE has hotkey (Fn+F7) for keyboard
backlight toggle. In this UX550GE, the hotkey incremet the level
of brightness for each keypress from 1 to 3, and then switch it
off when the brightness has been the max. This commit interprets
the code 0xc7 generated from hotkey to KEY_KBDILLUMUP to increment
the brightness, then pass KEY_KBDILLUMTOGGLE to user space after
the brightness max been reached for switching the led off.
Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
Tested-by: Jian-Hong Pan <jian-hong@endlessm.com>
---
Notes:
v2:
- Remove redundant 'else' branch logic
drivers/platform/x86/asus-nb-wmi.c | 1 +
drivers/platform/x86/asus-wmi.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index 136ff2b4cce5..14c502e18579 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -496,6 +496,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
{ KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
{ KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
{ KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */
+ { KE_KEY, 0xC7, { KEY_KBDILLUMTOGGLE } },
{ KE_END, 0},
};
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 1f6e68f0b646..4a3ba575c9ce 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 */
@@ -1745,6 +1746,10 @@ static void asus_wmi_notify(u32 value, void *context)
}
}
+ if (code == NOTIFY_KBD_BRTTOGGLE)
+ if (asus->kbd_led_wk < asus->kbd_led.max_brightness)
+ code = NOTIFY_KBD_BRTUP;
+
if (is_display_toggle(code) &&
asus->driver->quirks->no_display_toggle)
goto exit;
--
2.14.1
next reply other threads:[~2018-05-03 3:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 3:04 Chris Chiu [this message]
2018-05-07 14:10 ` [PATCH v2] platform/x86: asus-wmi: Add keyboard backlight toggle support Andy Shevchenko
2018-05-07 14:46 ` Daniel Drake
2018-05-15 0:25 ` Daniel Drake
2018-05-15 7:52 ` Andy Shevchenko
2018-05-15 13:41 ` Benjamin Berg
2018-05-22 9:18 ` Andy Shevchenko
2018-05-22 10:11 ` Chris Chiu
2018-05-22 13:48 ` Daniel Drake
2018-05-24 8:33 ` Chris Chiu
2018-06-04 9:27 ` Benjamin Berg
2018-06-05 1:59 ` 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=20180503030438.51150-1-chiu@endlessm.com \
--to=chiu@endlessm.com \
--cc=acpi4asus-user@lists.sourceforge.net \
--cc=andy@infradead.org \
--cc=corentin.chary@gmail.com \
--cc=dvhart@infradead.org \
--cc=jian-hong@endlessm.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