Re: [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver

From: Nika Krasnova

Date: Thu Jul 09 2026 - 12:17:56 EST


On Thu, 9 Jul 2026 20:23:35 +0800, Mingyou Chen wrote:
> + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_OPEN_APP, 1, 0),
> + { KEY_PROG1 } },
> +
> + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_CALCULATOR_START, 1, 0),
> + { KEY_CALC } },
> +
> + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_BROWSER_START, 1, 0),
> + { KEY_WWW } },

I'm not a fan of wrapping lines like this. I think it harms readability.
Let's keep it like this (same for the other key entries):

{ KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_OPEN_APP, 1, 0), { KEY_PROG1 } },
{ KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_CALCULATOR_START, 1, 0), { KEY_CALC } },
{ KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_BROWSER_START, 1, 0), { KEY_WWW } },

These all fit within 100 columns unwrapped (longest is ~95), so there's
no line-length reason to wrap; one entry per line reads better.

> + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_3, 0, 0), {} },
> + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 0, 0), {} },

WMI_EVENT_FN_4 is missing from this ignore block (the old keymap had
it). FN_4 events on Bitland will now fall through to the "Unknown WMI
hotkey" path instead of being ignored. Looks like an accidental drop in
the reformat.

> case WMI_EVENT_CPU_FAN_SPEED:
> case WMI_EVENT_GPU_FAN_SPEED:
> + /* Redmi refresh rate toggle quirk */
> + if (event->event_id == WMI_EVENT_CPU_FAN_SPEED &&
> + event->value_low == 0 && event->value_high == 0) {
> + payload = BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0);
> + goto report_key;
> + }

This remap runs on every machine, not just Redmi. If the firmware emits
a CPU fan-speed event of 0 (e.g. the fan spinning down), it gets misread
as KEY_REFRESH_RATE_TOGGLE. Could it be gated on DMI rather than on
value == 0?

Otherwise, I've tested the whole series on a RedmiBook Pro 16 2024
(sys_vendor "XIAOMI", board_name "TM2309"). mic-mute, screenshot, config
and the AI button all report the right keycodes, dmesg shows no unmapped
events.

Tested-by: Nika Krasnova <nika@xxxxxxxxxxxx>

--
Nika Krasnova