mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 12:52:29 -04:00
platform/x86: redmi-wmi: report EC state change events
The Redmibook EC/firmware fully handles the keyboard backlight cycle, the OEM preset power mode (Fn+K) and the Fn lock toggle by itself, and sends a WMI event carrying the resulting state in the third payload byte. These events are currently swallowed with KE_IGNORE, so userspace never learns that the state changed and cannot give the user any feedback (OSD), even though the WMI event is the only notification channel for these EC-driven changes. Report them as key presses instead: - keyboard backlight cycle -> KEY_KBDILLUMTOGGLE - OEM preset power mode -> KEY_PERFORMANCE - Fn lock toggle -> KEY_FN_ESC Desktops that only look at the keycode get the usual hotkey behaviour; since sparse-keymap emits MSC_SCAN with the raw payload before the key event, an OSD daemon can additionally recover the exact new state from byte 2 (e.g. backlight Off/Low/High/Auto is 0x00/0x05/0x0a/0x80). Note that the power mode event must keep being read from the WMI device in any case: on the TM2209 the ACPI event handler (EV20) applies the mode change as a side effect of building the event payload for _WED. Tested on Redmi Book Pro 15 2023 (TM2209). Signed-off-by: Musaev Ibragim <atomicus.xyz@gmail.com> Link: https://patch.msgid.link/178405473606.25865.4048095379503614221@gmail.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
committed by
Ilpo Järvinen
parent
08ce055a42
commit
e0d6312578
@@ -29,24 +29,24 @@ static const struct key_entry redmi_wmi_keymap[] = {
|
||||
{KE_KEY, 0x00011801, {KEY_ASSISTANT}},
|
||||
{KE_KEY, 0x00011901, {KEY_ASSISTANT}},
|
||||
|
||||
/* Keyboard backlight */
|
||||
{KE_IGNORE, 0x00000501, {}},
|
||||
{KE_IGNORE, 0x00800501, {}},
|
||||
{KE_IGNORE, 0x00050501, {}},
|
||||
{KE_IGNORE, 0x000a0501, {}},
|
||||
/* Keyboard backlight: Off / Auto / Low / High (new state in byte 2) */
|
||||
{KE_KEY, 0x00000501, {KEY_KBDILLUMTOGGLE}},
|
||||
{KE_KEY, 0x00800501, {KEY_KBDILLUMTOGGLE}},
|
||||
{KE_KEY, 0x00050501, {KEY_KBDILLUMTOGGLE}},
|
||||
{KE_KEY, 0x000a0501, {KEY_KBDILLUMTOGGLE}},
|
||||
|
||||
/* Xiaomi G Command Center */
|
||||
{KE_KEY, 0x00010a01, {KEY_VENDOR}},
|
||||
|
||||
/* OEM preset power mode */
|
||||
{KE_IGNORE, 0x00011601, {}},
|
||||
{KE_IGNORE, 0x00021601, {}},
|
||||
{KE_IGNORE, 0x00031601, {}},
|
||||
{KE_IGNORE, 0x00041601, {}},
|
||||
/* OEM preset power mode: 1=Balanced 2=Silent 3=Turbo 4=Full speed */
|
||||
{KE_KEY, 0x00011601, {KEY_PERFORMANCE}},
|
||||
{KE_KEY, 0x00021601, {KEY_PERFORMANCE}},
|
||||
{KE_KEY, 0x00031601, {KEY_PERFORMANCE}},
|
||||
{KE_KEY, 0x00041601, {KEY_PERFORMANCE}},
|
||||
|
||||
/* Fn Lock state */
|
||||
{KE_IGNORE, 0x00000701, {}},
|
||||
{KE_IGNORE, 0x00010701, {}},
|
||||
/* Fn Lock state: 1=on 0=off */
|
||||
{KE_KEY, 0x00000701, {KEY_FN_ESC}},
|
||||
{KE_KEY, 0x00010701, {KEY_FN_ESC}},
|
||||
|
||||
/* Fn+`/1/2/3/4 */
|
||||
{KE_KEY, 0x00011101, {KEY_F13}},
|
||||
|
||||
Reference in New Issue
Block a user