* [PATCH v1 0/4] Merge redmi-wmi into bitland-mifs-wmi
@ 2026-07-09 12:23 Mingyou Chen
2026-07-09 12:23 ` [PATCH v1 1/4] platform/x86: redmi-wmi: Drop redmi-wmi driver Mingyou Chen
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Mingyou Chen @ 2026-07-09 12:23 UTC (permalink / raw)
To: qby140326
Cc: W_Armin, foxido, hansg, ilpo.jarvinen, linux-kernel, nika,
platform-driver-x86
This patch series consolidates the standalone 'redmi-wmi' driver into the
'bitland-mifs-wmi' driver to eliminate code duplication and centralize
the maintenance of overlapping ACPI WMI event streams.
Bitland is the ODM manufacturer for various Xiaomi Redmibook models. Both
platforms share the exact same keyboard event stream WMI GUID
(46C93E13-EE9B-4262-8488-563BCA757FEF). While redmi-wmi previously parsed
the 4-byte payload as a bulk u32 scancode, bitland-mifs-wmi deconstructed
it into discrete type/id/value fields.
To safely merge them without sacrificing the high-level platform profile
and hwmon infrastructure of the Bitland driver or breaking the fine-grained
AI button toggles from the Redmi driver, the unified driver transitions
its sparse-keymap matching to a 32-bit little-endian scancode layout.
Additionally, this series cleans up the redundant Kconfig/Makefile hooks,
updates the MAINTAINERS entry accordingly, and introduces a newly reported
mic-mute hotkey definition for Redmibooks.
Testing status:
- Fully regression-tested on native Bitland hardware.
- Redmi-specific logic blocks and mic-mute quirks are compile-tested only.
Feedback from Redmibook hardware owners is highly appreciated.
Mingyou Chen (4):
platform/x86: redmi-wmi: Drop redmi-wmi driver
platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into
the bitland driver
MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver
platform/x86: bitland-mifs-wmi: Add Redmi mic-mute key entries
MAINTAINERS | 5 +-
drivers/platform/x86/Kconfig | 12 --
drivers/platform/x86/Makefile | 1 -
drivers/platform/x86/bitland-mifs-wmi.c | 207 +++++++++++++++---------
drivers/platform/x86/redmi-wmi.c | 154 ------------------
5 files changed, 134 insertions(+), 245 deletions(-)
delete mode 100644 drivers/platform/x86/redmi-wmi.c
base-commit: 0e35b9b6ec0ffcc5e23cbdec09f5c622ad532b53
--
2.55.0
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v1 1/4] platform/x86: redmi-wmi: Drop redmi-wmi driver 2026-07-09 12:23 [PATCH v1 0/4] Merge redmi-wmi into bitland-mifs-wmi Mingyou Chen @ 2026-07-09 12:23 ` Mingyou Chen 2026-07-10 10:24 ` Ilpo Järvinen 2026-07-09 12:23 ` [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver Mingyou Chen ` (2 subsequent siblings) 3 siblings, 1 reply; 11+ messages in thread From: Mingyou Chen @ 2026-07-09 12:23 UTC (permalink / raw) To: qby140326 Cc: W_Armin, foxido, hansg, ilpo.jarvinen, linux-kernel, nika, platform-driver-x86 The redmi-wmi driver is no longer needed because its functionality has been superseded by the new generic bitland platform driver. All supported Redmi laptop models are now handled properly via the updated WMI interfaces in bitland-mifs-wmi. Remove the obsolete code, Kconfig entries, and Makefile references to clean up the platform directory. Signed-off-by: Mingyou Chen <qby140326@gmail.com> --- MAINTAINERS | 6 -- drivers/platform/x86/Kconfig | 12 --- drivers/platform/x86/Makefile | 1 - drivers/platform/x86/redmi-wmi.c | 154 ------------------------------- 4 files changed, 173 deletions(-) delete mode 100644 drivers/platform/x86/redmi-wmi.c diff --git a/MAINTAINERS b/MAINTAINERS index f37a81950e25..6d9b69c1df4c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22768,12 +22768,6 @@ S: Maintained T: git https://github.com/pkshih/rtw.git F: drivers/net/wireless/realtek/rtw89/ -REDMIBOOK WMI DRIVERS -M: Gladyshev Ilya <foxido@foxido.dev> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/redmi-wmi.c - REDPINE WIRELESS DRIVER L: linux-wireless@vger.kernel.org S: Orphan diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index b54b5212b204..036fc76f62df 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -90,18 +90,6 @@ config XIAOMI_WMI To compile this driver as a module, choose M here: the module will be called xiaomi-wmi. -config REDMI_WMI - tristate "Redmibook WMI key driver" - depends on ACPI_WMI - depends on INPUT - select INPUT_SPARSEKMAP - help - Say Y here if you want support for WMI-based hotkey events on - Xiaomi Redmibook devices. - - To compile this driver as a module, choose M here: the module will - be called redmi-wmi. - config GIGABYTE_WMI tristate "Gigabyte WMI temperature driver" depends on ACPI_WMI diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 872ac3842391..0da4876f766e 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -12,7 +12,6 @@ obj-$(CONFIG_HUAWEI_WMI) += huawei-wmi.o obj-$(CONFIG_MXM_WMI) += mxm-wmi.o obj-$(CONFIG_NVIDIA_WMI_EC_BACKLIGHT) += nvidia-wmi-ec-backlight.o obj-$(CONFIG_XIAOMI_WMI) += xiaomi-wmi.o -obj-$(CONFIG_REDMI_WMI) += redmi-wmi.o obj-$(CONFIG_GIGABYTE_WMI) += gigabyte-wmi.o obj-$(CONFIG_BITLAND_MIFS_WMI) += bitland-mifs-wmi.o diff --git a/drivers/platform/x86/redmi-wmi.c b/drivers/platform/x86/redmi-wmi.c deleted file mode 100644 index 58898630eda6..000000000000 --- a/drivers/platform/x86/redmi-wmi.c +++ /dev/null @@ -1,154 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* WMI driver for Xiaomi Redmibooks */ - -#include <linux/acpi.h> -#include <linux/bits.h> -#include <linux/device.h> -#include <linux/input.h> -#include <linux/input/sparse-keymap.h> -#include <linux/module.h> -#include <linux/mutex.h> -#include <linux/unaligned.h> -#include <linux/wmi.h> - -#include <uapi/linux/input-event-codes.h> - -#define WMI_REDMIBOOK_KEYBOARD_EVENT_GUID "46C93E13-EE9B-4262-8488-563BCA757FEF" - -#define AI_KEY_VALUE_MASK BIT(8) - -static const struct key_entry redmi_wmi_keymap[] = { - {KE_KEY, 0x00000201, {KEY_SELECTIVE_SCREENSHOT}}, - {KE_KEY, 0x00000301, {KEY_ALL_APPLICATIONS}}, - {KE_KEY, 0x00001b01, {KEY_CONFIG}}, - {KE_KEY, 0x00011b01, {KEY_CONFIG}}, - {KE_KEY, 0x00010101, {KEY_SWITCHVIDEOMODE}}, - {KE_KEY, 0x00001a01, {KEY_REFRESH_RATE_TOGGLE}}, - - /* AI button has code for each position */ - {KE_KEY, 0x00011801, {KEY_ASSISTANT}}, - {KE_KEY, 0x00011901, {KEY_ASSISTANT}}, - - /* Keyboard backlight */ - {KE_IGNORE, 0x00000501, {}}, - {KE_IGNORE, 0x00800501, {}}, - {KE_IGNORE, 0x00050501, {}}, - {KE_IGNORE, 0x000a0501, {}}, - - /* 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, {}}, - - /* Fn Lock state */ - {KE_IGNORE, 0x00000701, {}}, - {KE_IGNORE, 0x00010701, {}}, - - /* Fn+`/1/2/3/4 */ - {KE_KEY, 0x00011101, {KEY_F13}}, - {KE_KEY, 0x00011201, {KEY_F14}}, - {KE_KEY, 0x00011301, {KEY_F15}}, - {KE_KEY, 0x00011401, {KEY_F16}}, - {KE_KEY, 0x00011501, {KEY_F17}}, - - {KE_END} -}; - -struct redmi_wmi { - struct input_dev *input_dev; - /* Protects the key event sequence */ - struct mutex key_lock; -}; - -static int redmi_wmi_probe(struct wmi_device *wdev, const void *context) -{ - struct redmi_wmi *data; - int err; - - /* Init dev */ - data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); - if (!data) - return -ENOMEM; - - dev_set_drvdata(&wdev->dev, data); - - err = devm_mutex_init(&wdev->dev, &data->key_lock); - if (err) - return err; - - data->input_dev = devm_input_allocate_device(&wdev->dev); - if (!data->input_dev) - return -ENOMEM; - - data->input_dev->name = "Redmibook WMI keys"; - data->input_dev->phys = "wmi/input0"; - - err = sparse_keymap_setup(data->input_dev, redmi_wmi_keymap, NULL); - if (err) - return err; - - return input_register_device(data->input_dev); -} - -static void redmi_wmi_notify(struct wmi_device *wdev, union acpi_object *obj) -{ - struct key_entry *entry; - struct redmi_wmi *data = dev_get_drvdata(&wdev->dev); - bool autorelease = true; - u32 payload; - int value = 1; - - if (obj->type != ACPI_TYPE_BUFFER) { - dev_err(&wdev->dev, "Bad response type %u\n", obj->type); - return; - } - - if (obj->buffer.length < 32) { - dev_err(&wdev->dev, "Invalid buffer length %u\n", obj->buffer.length); - return; - } - - payload = get_unaligned_le32(obj->buffer.pointer); - entry = sparse_keymap_entry_from_scancode(data->input_dev, payload); - - if (!entry) { - dev_dbg(&wdev->dev, "Unknown WMI event with payload %u", payload); - return; - } - - /* AI key quirk */ - if (entry->keycode == KEY_ASSISTANT) { - value = !(payload & AI_KEY_VALUE_MASK); - autorelease = false; - } - - guard(mutex)(&data->key_lock); - sparse_keymap_report_entry(data->input_dev, entry, value, autorelease); -} - -static const struct wmi_device_id redmi_wmi_id_table[] = { - { WMI_REDMIBOOK_KEYBOARD_EVENT_GUID, NULL }, - { } -}; - -static struct wmi_driver redmi_wmi_driver = { - .driver = { - .name = "redmi-wmi", - .probe_type = PROBE_PREFER_ASYNCHRONOUS, - }, - .id_table = redmi_wmi_id_table, - .min_event_size = 32, - .probe = redmi_wmi_probe, - .notify = redmi_wmi_notify, - .no_singleton = true, -}; -module_wmi_driver(redmi_wmi_driver); - -MODULE_DEVICE_TABLE(wmi, redmi_wmi_id_table); -MODULE_AUTHOR("Gladyshev Ilya <foxido@foxido.dev>"); -MODULE_DESCRIPTION("Redmibook WMI driver"); -MODULE_LICENSE("GPL"); -- 2.55.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v1 1/4] platform/x86: redmi-wmi: Drop redmi-wmi driver 2026-07-09 12:23 ` [PATCH v1 1/4] platform/x86: redmi-wmi: Drop redmi-wmi driver Mingyou Chen @ 2026-07-10 10:24 ` Ilpo Järvinen 0 siblings, 0 replies; 11+ messages in thread From: Ilpo Järvinen @ 2026-07-10 10:24 UTC (permalink / raw) To: Mingyou Chen Cc: W_Armin, foxido, Hans de Goede, LKML, nika, platform-driver-x86 On Thu, 9 Jul 2026, Mingyou Chen wrote: > The redmi-wmi driver is no longer needed because its functionality > has been superseded by the new generic bitland platform driver. > All supported Redmi laptop models are now handled properly via the > updated WMI interfaces in bitland-mifs-wmi. Are the patches in correct order in this series? Reading the shortlog and changelog of patch 2 makes me question if after this patch has been applied something might be missing. Why you need to add event handling from redmi-wmi into bitland-mifs-wmi after this patch if the functionality is there already at this point so you can remove redmi-wmi driver first? -- i. > Remove the obsolete code, Kconfig entries, and Makefile references > to clean up the platform directory. > > Signed-off-by: Mingyou Chen <qby140326@gmail.com> > --- > MAINTAINERS | 6 -- > drivers/platform/x86/Kconfig | 12 --- > drivers/platform/x86/Makefile | 1 - > drivers/platform/x86/redmi-wmi.c | 154 ------------------------------- > 4 files changed, 173 deletions(-) > delete mode 100644 drivers/platform/x86/redmi-wmi.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index f37a81950e25..6d9b69c1df4c 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -22768,12 +22768,6 @@ S: Maintained > T: git https://github.com/pkshih/rtw.git > F: drivers/net/wireless/realtek/rtw89/ > > -REDMIBOOK WMI DRIVERS > -M: Gladyshev Ilya <foxido@foxido.dev> > -L: platform-driver-x86@vger.kernel.org > -S: Maintained > -F: drivers/platform/x86/redmi-wmi.c > - > REDPINE WIRELESS DRIVER > L: linux-wireless@vger.kernel.org > S: Orphan > diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig > index b54b5212b204..036fc76f62df 100644 > --- a/drivers/platform/x86/Kconfig > +++ b/drivers/platform/x86/Kconfig > @@ -90,18 +90,6 @@ config XIAOMI_WMI > To compile this driver as a module, choose M here: the module will > be called xiaomi-wmi. > > -config REDMI_WMI > - tristate "Redmibook WMI key driver" > - depends on ACPI_WMI > - depends on INPUT > - select INPUT_SPARSEKMAP > - help > - Say Y here if you want support for WMI-based hotkey events on > - Xiaomi Redmibook devices. > - > - To compile this driver as a module, choose M here: the module will > - be called redmi-wmi. > - > config GIGABYTE_WMI > tristate "Gigabyte WMI temperature driver" > depends on ACPI_WMI > diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile > index 872ac3842391..0da4876f766e 100644 > --- a/drivers/platform/x86/Makefile > +++ b/drivers/platform/x86/Makefile > @@ -12,7 +12,6 @@ obj-$(CONFIG_HUAWEI_WMI) += huawei-wmi.o > obj-$(CONFIG_MXM_WMI) += mxm-wmi.o > obj-$(CONFIG_NVIDIA_WMI_EC_BACKLIGHT) += nvidia-wmi-ec-backlight.o > obj-$(CONFIG_XIAOMI_WMI) += xiaomi-wmi.o > -obj-$(CONFIG_REDMI_WMI) += redmi-wmi.o > obj-$(CONFIG_GIGABYTE_WMI) += gigabyte-wmi.o > obj-$(CONFIG_BITLAND_MIFS_WMI) += bitland-mifs-wmi.o > > diff --git a/drivers/platform/x86/redmi-wmi.c b/drivers/platform/x86/redmi-wmi.c > deleted file mode 100644 > index 58898630eda6..000000000000 > --- a/drivers/platform/x86/redmi-wmi.c > +++ /dev/null > @@ -1,154 +0,0 @@ > -// SPDX-License-Identifier: GPL-2.0 > -/* WMI driver for Xiaomi Redmibooks */ > - > -#include <linux/acpi.h> > -#include <linux/bits.h> > -#include <linux/device.h> > -#include <linux/input.h> > -#include <linux/input/sparse-keymap.h> > -#include <linux/module.h> > -#include <linux/mutex.h> > -#include <linux/unaligned.h> > -#include <linux/wmi.h> > - > -#include <uapi/linux/input-event-codes.h> > - > -#define WMI_REDMIBOOK_KEYBOARD_EVENT_GUID "46C93E13-EE9B-4262-8488-563BCA757FEF" > - > -#define AI_KEY_VALUE_MASK BIT(8) > - > -static const struct key_entry redmi_wmi_keymap[] = { > - {KE_KEY, 0x00000201, {KEY_SELECTIVE_SCREENSHOT}}, > - {KE_KEY, 0x00000301, {KEY_ALL_APPLICATIONS}}, > - {KE_KEY, 0x00001b01, {KEY_CONFIG}}, > - {KE_KEY, 0x00011b01, {KEY_CONFIG}}, > - {KE_KEY, 0x00010101, {KEY_SWITCHVIDEOMODE}}, > - {KE_KEY, 0x00001a01, {KEY_REFRESH_RATE_TOGGLE}}, > - > - /* AI button has code for each position */ > - {KE_KEY, 0x00011801, {KEY_ASSISTANT}}, > - {KE_KEY, 0x00011901, {KEY_ASSISTANT}}, > - > - /* Keyboard backlight */ > - {KE_IGNORE, 0x00000501, {}}, > - {KE_IGNORE, 0x00800501, {}}, > - {KE_IGNORE, 0x00050501, {}}, > - {KE_IGNORE, 0x000a0501, {}}, > - > - /* 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, {}}, > - > - /* Fn Lock state */ > - {KE_IGNORE, 0x00000701, {}}, > - {KE_IGNORE, 0x00010701, {}}, > - > - /* Fn+`/1/2/3/4 */ > - {KE_KEY, 0x00011101, {KEY_F13}}, > - {KE_KEY, 0x00011201, {KEY_F14}}, > - {KE_KEY, 0x00011301, {KEY_F15}}, > - {KE_KEY, 0x00011401, {KEY_F16}}, > - {KE_KEY, 0x00011501, {KEY_F17}}, > - > - {KE_END} > -}; > - > -struct redmi_wmi { > - struct input_dev *input_dev; > - /* Protects the key event sequence */ > - struct mutex key_lock; > -}; > - > -static int redmi_wmi_probe(struct wmi_device *wdev, const void *context) > -{ > - struct redmi_wmi *data; > - int err; > - > - /* Init dev */ > - data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL); > - if (!data) > - return -ENOMEM; > - > - dev_set_drvdata(&wdev->dev, data); > - > - err = devm_mutex_init(&wdev->dev, &data->key_lock); > - if (err) > - return err; > - > - data->input_dev = devm_input_allocate_device(&wdev->dev); > - if (!data->input_dev) > - return -ENOMEM; > - > - data->input_dev->name = "Redmibook WMI keys"; > - data->input_dev->phys = "wmi/input0"; > - > - err = sparse_keymap_setup(data->input_dev, redmi_wmi_keymap, NULL); > - if (err) > - return err; > - > - return input_register_device(data->input_dev); > -} > - > -static void redmi_wmi_notify(struct wmi_device *wdev, union acpi_object *obj) > -{ > - struct key_entry *entry; > - struct redmi_wmi *data = dev_get_drvdata(&wdev->dev); > - bool autorelease = true; > - u32 payload; > - int value = 1; > - > - if (obj->type != ACPI_TYPE_BUFFER) { > - dev_err(&wdev->dev, "Bad response type %u\n", obj->type); > - return; > - } > - > - if (obj->buffer.length < 32) { > - dev_err(&wdev->dev, "Invalid buffer length %u\n", obj->buffer.length); > - return; > - } > - > - payload = get_unaligned_le32(obj->buffer.pointer); > - entry = sparse_keymap_entry_from_scancode(data->input_dev, payload); > - > - if (!entry) { > - dev_dbg(&wdev->dev, "Unknown WMI event with payload %u", payload); > - return; > - } > - > - /* AI key quirk */ > - if (entry->keycode == KEY_ASSISTANT) { > - value = !(payload & AI_KEY_VALUE_MASK); > - autorelease = false; > - } > - > - guard(mutex)(&data->key_lock); > - sparse_keymap_report_entry(data->input_dev, entry, value, autorelease); > -} > - > -static const struct wmi_device_id redmi_wmi_id_table[] = { > - { WMI_REDMIBOOK_KEYBOARD_EVENT_GUID, NULL }, > - { } > -}; > - > -static struct wmi_driver redmi_wmi_driver = { > - .driver = { > - .name = "redmi-wmi", > - .probe_type = PROBE_PREFER_ASYNCHRONOUS, > - }, > - .id_table = redmi_wmi_id_table, > - .min_event_size = 32, > - .probe = redmi_wmi_probe, > - .notify = redmi_wmi_notify, > - .no_singleton = true, > -}; > -module_wmi_driver(redmi_wmi_driver); > - > -MODULE_DEVICE_TABLE(wmi, redmi_wmi_id_table); > -MODULE_AUTHOR("Gladyshev Ilya <foxido@foxido.dev>"); > -MODULE_DESCRIPTION("Redmibook WMI driver"); > -MODULE_LICENSE("GPL"); > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver 2026-07-09 12:23 [PATCH v1 0/4] Merge redmi-wmi into bitland-mifs-wmi Mingyou Chen 2026-07-09 12:23 ` [PATCH v1 1/4] platform/x86: redmi-wmi: Drop redmi-wmi driver Mingyou Chen @ 2026-07-09 12:23 ` Mingyou Chen 2026-07-09 16:07 ` Nika Krasnova ` (2 more replies) 2026-07-09 12:23 ` [PATCH v1 3/4] MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver Mingyou Chen 2026-07-09 12:23 ` [PATCH v1 4/4] platform/x86: bitland-mifs-wmi: Add Redmi mic-mute key entries Mingyou Chen 3 siblings, 3 replies; 11+ messages in thread From: Mingyou Chen @ 2026-07-09 12:23 UTC (permalink / raw) To: qby140326 Cc: W_Armin, foxido, hansg, ilpo.jarvinen, linux-kernel, nika, platform-driver-x86 The bitland-mifs-wmi and legacy redmi-wmi drivers both attempt to bind to the same WMI GUID (46C93E13-EE9B-4262-8488-563BCA757FEF). This overlap causes a device registration conflict, preventing one of the drivers from loading properly depending on the module initialization order. Merge the event handling logic from redmi-wmi into bitland-mifs-wmi. By handling both device layouts within a single driver, we eliminate the GUID ownership conflict. Signed-off-by: Mingyou Chen <qby140326@gmail.com> --- drivers/platform/x86/bitland-mifs-wmi.c | 203 +++++++++++++++--------- 1 file changed, 127 insertions(+), 76 deletions(-) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c index b0d06a80e89e..cbe118bbe428 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -34,6 +34,11 @@ #include <linux/units.h> #include <linux/wmi.h> +#define BI_HOTKEY_CODE(id, low, high) \ + (((u32)(high) << 24) | ((u32)(low) << 16) | ((u32)(id) << 8) | WMI_EVENT_TYPE_HOTKEY) + +#define AI_KEY_VALUE_MASK BIT(8) + #define DRV_NAME "bitland-mifs-wmi" #define BITLAND_MIFS_GUID "B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B" #define BITLAND_EVENT_GUID "46C93E13-EE9B-4262-8488-563BCA757FEF" @@ -74,34 +79,34 @@ enum bitland_mifs_power_profile { }; enum bitland_mifs_event_id { - WMI_EVENT_RESERVED_1 = 1, - WMI_EVENT_RESERVED_2 = 2, - WMI_EVENT_RESERVED_3 = 3, - WMI_EVENT_AIRPLANE_MODE = 4, - WMI_EVENT_KBD_BRIGHTNESS = 5, - WMI_EVENT_TOUCHPAD_STATE = 6, - WMI_EVENT_FNLOCK_STATE = 7, - WMI_EVENT_KBD_MODE = 8, - WMI_EVENT_CAPSLOCK_STATE = 9, - WMI_EVENT_CALCULATOR_START = 11, - WMI_EVENT_BROWSER_START = 12, - WMI_EVENT_NUMLOCK_STATE = 13, - WMI_EVENT_SCROLLLOCK_STATE = 14, - WMI_EVENT_PERFORMANCE_PLAN = 15, - WMI_EVENT_FN_J = 16, - WMI_EVENT_FN_F = 17, - WMI_EVENT_FN_0 = 18, - WMI_EVENT_FN_1 = 19, - WMI_EVENT_FN_2 = 20, - WMI_EVENT_FN_3 = 21, - WMI_EVENT_FN_4 = 22, - WMI_EVENT_FN_5 = 24, - WMI_EVENT_REFRESH_RATE = 25, - WMI_EVENT_CPU_FAN_SPEED = 26, - WMI_EVENT_GPU_FAN_SPEED = 32, - WMI_EVENT_WIN_KEY_LOCK = 33, - WMI_EVENT_RESERVED_23 = 34, - WMI_EVENT_OPEN_APP = 35, + WMI_EVENT_RESERVED_1 = 1, + WMI_EVENT_RESERVED_2 = 2, + WMI_EVENT_RESERVED_3 = 3, + WMI_EVENT_AIRPLANE_MODE = 4, + WMI_EVENT_KBD_BRIGHTNESS = 5, + WMI_EVENT_TOUCHPAD_STATE = 6, + WMI_EVENT_FNLOCK_STATE = 7, + WMI_EVENT_KBD_MODE = 8, + WMI_EVENT_CAPSLOCK_STATE = 9, + WMI_EVENT_CALCULATOR_START = 11, + WMI_EVENT_BROWSER_START = 12, + WMI_EVENT_NUMLOCK_STATE = 13, + WMI_EVENT_SCROLLLOCK_STATE = 14, + WMI_EVENT_PERFORMANCE_PLAN = 15, + WMI_EVENT_FN_J = 16, + WMI_EVENT_FN_F = 17, + WMI_EVENT_FN_0 = 18, + WMI_EVENT_FN_1 = 19, + WMI_EVENT_FN_2 = 20, + WMI_EVENT_FN_3 = 21, + WMI_EVENT_FN_4 = 22, + WMI_EVENT_FN_5 = 24, + WMI_EVENT_REFRESH_RATE = 25, + WMI_EVENT_CPU_FAN_SPEED = 26, + WMI_EVENT_GPU_FAN_SPEED = 32, + WMI_EVENT_WIN_KEY_LOCK = 33, + WMI_EVENT_RESERVED_23 = 34, + WMI_EVENT_OPEN_APP = 35, }; enum bitland_mifs_event_type { @@ -601,18 +606,67 @@ static const struct attribute *const laptop_attrs[] = { ATTRIBUTE_GROUPS(laptop); static const struct key_entry bitland_mifs_wmi_keymap[] = { - { KE_KEY, WMI_EVENT_OPEN_APP, { KEY_PROG1 } }, - { KE_KEY, WMI_EVENT_CALCULATOR_START, { KEY_CALC } }, - { KE_KEY, WMI_EVENT_BROWSER_START, { KEY_WWW } }, - { KE_IGNORE, WMI_EVENT_FN_J, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_F, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_0, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_1, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_2, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_3, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_4, { KEY_RESERVED } }, - { KE_IGNORE, WMI_EVENT_FN_5, { KEY_RESERVED } }, - { KE_END, 0 } + { 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 } }, + + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_J, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_F, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_0, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_1, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_2, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_3, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 0, 0), {} }, + + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_2, 0, 0), + { KEY_SELECTIVE_SCREENSHOT } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_3, 0, 0), + { KEY_ALL_APPLICATIONS } }, + { KE_KEY, BI_HOTKEY_CODE(0x1b, 0, 0), { KEY_CONFIG } }, + { KE_KEY, BI_HOTKEY_CODE(0x1b, 1, 0), { KEY_CONFIG } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_1, 1, 0), + { KEY_SWITCHVIDEOMODE } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0), + { KEY_REFRESH_RATE_TOGGLE } }, + + /* AI button has code for each position */ + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 1, 0), + { KEY_ASSISTANT } }, + + { KE_KEY, BI_HOTKEY_CODE(0x19, 1, 0), + { KEY_ASSISTANT } }, + + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0x80), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 5, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0x0a, 0), {} }, + + /* Xiaomi G Command Center */ + { KE_KEY, BI_HOTKEY_CODE(0x0a, 1, 0), { KEY_VENDOR } }, + + /* OEM preset power mode */ + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 1, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 2, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 3, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 4, 0), {} }, + + /* Fn Lock state */ + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FNLOCK_STATE, 0, 0), {} }, + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FNLOCK_STATE, 1, 0), {} }, + + /* Fn+`/1/2/3/4 */ + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_F, 1, 0), { KEY_F13 } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_0, 1, 0), { KEY_F14 } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_1, 1, 0), { KEY_F15 } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_2, 1, 0), { KEY_F16 } }, + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_3, 1, 0), { KEY_F17 } }, + + { KE_END } }; static void bitland_notifier_unregister(void *data) @@ -736,9 +790,12 @@ static void bitland_mifs_wmi_notify(struct wmi_device *wdev, struct bitland_mifs_wmi_data *data = dev_get_drvdata(&wdev->dev); const struct bitland_mifs_event *event = buffer->data; struct bitland_fan_notify_data fan_data; + struct key_entry *entry; + bool autorelease = true; + int value = 1; + u32 payload; u8 brightness; - /* Validate event type */ if (event->event_type != WMI_EVENT_TYPE_HOTKEY) return; @@ -752,62 +809,56 @@ static void bitland_mifs_wmi_notify(struct wmi_device *wdev, blocking_notifier_call_chain(&bitland_notifier_list, BITLAND_NOTIFY_KBD_BRIGHTNESS, &brightness); - break; + return; case WMI_EVENT_PERFORMANCE_PLAN: blocking_notifier_call_chain(&bitland_notifier_list, BITLAND_NOTIFY_PLATFORM_PROFILE, NULL); - break; - - case WMI_EVENT_OPEN_APP: - case WMI_EVENT_CALCULATOR_START: - case WMI_EVENT_BROWSER_START: { - guard(mutex)(&data->lock); - if (!sparse_keymap_report_event(data->input_dev, - event->event_id, 1, true)) - dev_warn(&wdev->dev, "Unknown key pressed: 0x%02x\n", - event->event_id); - break; - } + return; - /* - * The device has 3 fans (CPU, GPU, SYS), - * but there are only the CPU and GPU fan has events - */ 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; + } + if (event->event_id == WMI_EVENT_CPU_FAN_SPEED) fan_data.channel = 0; else fan_data.channel = 1; - /* Fan speed is 16-bit value (value_low is LSB, value_high is MSB) */ fan_data.speed = (event->value_high << 8) | event->value_low; blocking_notifier_call_chain(&bitland_notifier_list, BITLAND_NOTIFY_HWMON, &fan_data); - break; - - case WMI_EVENT_AIRPLANE_MODE: - case WMI_EVENT_TOUCHPAD_STATE: - case WMI_EVENT_FNLOCK_STATE: - case WMI_EVENT_KBD_MODE: - case WMI_EVENT_CAPSLOCK_STATE: - case WMI_EVENT_NUMLOCK_STATE: - case WMI_EVENT_SCROLLLOCK_STATE: - case WMI_EVENT_REFRESH_RATE: - case WMI_EVENT_WIN_KEY_LOCK: - /* These events are informational or handled by firmware */ - dev_dbg(&wdev->dev, "State change event: id=%d value=%d\n", - event->event_id, event->value_low); - break; + return; default: - dev_dbg(&wdev->dev, "Unknown event: id=0x%02x value=0x%02x\n", - event->event_id, event->value_low); break; } + + payload = get_unaligned_le32(buffer->data); + +report_key: + entry = sparse_keymap_entry_from_scancode(data->input_dev, payload); + + if (!entry) { + dev_dbg(&wdev->dev, "Unknown WMI hotkey with payload 0x%08x\n", payload); + return; + } + + /* AI key quirk */ + if (entry->keycode == KEY_ASSISTANT) { + value = !(payload & AI_KEY_VALUE_MASK); + autorelease = false; + } + + guard(mutex)(&data->lock); + sparse_keymap_report_entry(data->input_dev, entry, value, autorelease); } static const struct wmi_device_id bitland_mifs_wmi_id_table[] = { -- 2.55.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver 2026-07-09 12:23 ` [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver Mingyou Chen @ 2026-07-09 16:07 ` Nika Krasnova 2026-07-10 3:41 ` Mingyou Chen 2026-07-09 16:21 ` Nika Krasnova 2026-07-10 10:20 ` Ilpo Järvinen 2 siblings, 1 reply; 11+ messages in thread From: Nika Krasnova @ 2026-07-09 16:07 UTC (permalink / raw) To: Mingyou Chen Cc: Nika Krasnova, Armin Wolf, Gladyshev Ilya, Hans de Goede, Ilpo Järvinen, platform-driver-x86, linux-kernel 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@nikableh.moe> -- Nika Krasnova ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver 2026-07-09 16:07 ` Nika Krasnova @ 2026-07-10 3:41 ` Mingyou Chen 0 siblings, 0 replies; 11+ messages in thread From: Mingyou Chen @ 2026-07-10 3:41 UTC (permalink / raw) To: Nika Krasnova Cc: Armin Wolf, Gladyshev Ilya, Hans de Goede, Ilpo Järvinen, platform-driver-x86, linux-kernel On 7/10/26 12:07 AM, Nika Krasnova wrote: > 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. My device never report the FN_* events But them exist in the C# userspace driver. (Might for other bitland devices) > 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? My device never report the fan speed events. In the current driver, the hwmon status is implemented in a pull model (laptop_hwmon_read) by wmi calls So I think the unnecessary events could be removed. -- Mingyou Chen ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver 2026-07-09 12:23 ` [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver Mingyou Chen 2026-07-09 16:07 ` Nika Krasnova @ 2026-07-09 16:21 ` Nika Krasnova 2026-07-10 10:20 ` Ilpo Järvinen 2 siblings, 0 replies; 11+ messages in thread From: Nika Krasnova @ 2026-07-09 16:21 UTC (permalink / raw) To: Mingyou Chen Cc: Nika Krasnova, Armin Wolf, Gladyshev Ilya, Hans de Goede, Ilpo Järvinen, platform-driver-x86, linux-kernel On Thu, 9 Jul 2026 20:23:35 +0800, Mingyou Chen wrote: > The bitland-mifs-wmi and legacy redmi-wmi drivers both attempt to bind > to > the same WMI GUID (46C93E13-EE9B-4262-8488-563BCA757FEF). This overlap > causes a device > registration conflict, preventing one of the drivers from loading > properly depending on the module initialization order. Also, the commit message is wrapped mid-sentence. I suggest you reflow it at 72 columns. -- Nika Krasnova ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver 2026-07-09 12:23 ` [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver Mingyou Chen 2026-07-09 16:07 ` Nika Krasnova 2026-07-09 16:21 ` Nika Krasnova @ 2026-07-10 10:20 ` Ilpo Järvinen 2 siblings, 0 replies; 11+ messages in thread From: Ilpo Järvinen @ 2026-07-10 10:20 UTC (permalink / raw) To: Mingyou Chen Cc: W_Armin, foxido, Hans de Goede, LKML, nika, platform-driver-x86 On Thu, 9 Jul 2026, Mingyou Chen wrote: > The bitland-mifs-wmi and legacy redmi-wmi drivers both attempt to bind > to > the same WMI GUID (46C93E13-EE9B-4262-8488-563BCA757FEF). This overlap > causes a device > registration conflict, preventing one of the drivers from loading > properly depending on the module initialization order. > > Merge the event handling logic from redmi-wmi into > bitland-mifs-wmi. By handling both device layouts within a single > driver, > we eliminate the GUID ownership conflict. Please reflow the paragraphs to properly fill every line. > Signed-off-by: Mingyou Chen <qby140326@gmail.com> > --- > drivers/platform/x86/bitland-mifs-wmi.c | 203 +++++++++++++++--------- > 1 file changed, 127 insertions(+), 76 deletions(-) > > diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c > index b0d06a80e89e..cbe118bbe428 100644 > --- a/drivers/platform/x86/bitland-mifs-wmi.c > +++ b/drivers/platform/x86/bitland-mifs-wmi.c > @@ -34,6 +34,11 @@ > #include <linux/units.h> > #include <linux/wmi.h> > > +#define BI_HOTKEY_CODE(id, low, high) \ > + (((u32)(high) << 24) | ((u32)(low) << 16) | ((u32)(id) << 8) | WMI_EVENT_TYPE_HOTKEY) > + > +#define AI_KEY_VALUE_MASK BIT(8) > + > #define DRV_NAME "bitland-mifs-wmi" > #define BITLAND_MIFS_GUID "B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B" > #define BITLAND_EVENT_GUID "46C93E13-EE9B-4262-8488-563BCA757FEF" > @@ -74,34 +79,34 @@ enum bitland_mifs_power_profile { > }; > > enum bitland_mifs_event_id { > - WMI_EVENT_RESERVED_1 = 1, > - WMI_EVENT_RESERVED_2 = 2, > - WMI_EVENT_RESERVED_3 = 3, > - WMI_EVENT_AIRPLANE_MODE = 4, > - WMI_EVENT_KBD_BRIGHTNESS = 5, > - WMI_EVENT_TOUCHPAD_STATE = 6, > - WMI_EVENT_FNLOCK_STATE = 7, > - WMI_EVENT_KBD_MODE = 8, > - WMI_EVENT_CAPSLOCK_STATE = 9, > - WMI_EVENT_CALCULATOR_START = 11, > - WMI_EVENT_BROWSER_START = 12, > - WMI_EVENT_NUMLOCK_STATE = 13, > - WMI_EVENT_SCROLLLOCK_STATE = 14, > - WMI_EVENT_PERFORMANCE_PLAN = 15, > - WMI_EVENT_FN_J = 16, > - WMI_EVENT_FN_F = 17, > - WMI_EVENT_FN_0 = 18, > - WMI_EVENT_FN_1 = 19, > - WMI_EVENT_FN_2 = 20, > - WMI_EVENT_FN_3 = 21, > - WMI_EVENT_FN_4 = 22, > - WMI_EVENT_FN_5 = 24, > - WMI_EVENT_REFRESH_RATE = 25, > - WMI_EVENT_CPU_FAN_SPEED = 26, > - WMI_EVENT_GPU_FAN_SPEED = 32, > - WMI_EVENT_WIN_KEY_LOCK = 33, > - WMI_EVENT_RESERVED_23 = 34, > - WMI_EVENT_OPEN_APP = 35, > + WMI_EVENT_RESERVED_1 = 1, > + WMI_EVENT_RESERVED_2 = 2, > + WMI_EVENT_RESERVED_3 = 3, > + WMI_EVENT_AIRPLANE_MODE = 4, > + WMI_EVENT_KBD_BRIGHTNESS = 5, > + WMI_EVENT_TOUCHPAD_STATE = 6, > + WMI_EVENT_FNLOCK_STATE = 7, > + WMI_EVENT_KBD_MODE = 8, > + WMI_EVENT_CAPSLOCK_STATE = 9, > + WMI_EVENT_CALCULATOR_START = 11, > + WMI_EVENT_BROWSER_START = 12, > + WMI_EVENT_NUMLOCK_STATE = 13, > + WMI_EVENT_SCROLLLOCK_STATE = 14, > + WMI_EVENT_PERFORMANCE_PLAN = 15, > + WMI_EVENT_FN_J = 16, > + WMI_EVENT_FN_F = 17, > + WMI_EVENT_FN_0 = 18, > + WMI_EVENT_FN_1 = 19, > + WMI_EVENT_FN_2 = 20, > + WMI_EVENT_FN_3 = 21, > + WMI_EVENT_FN_4 = 22, > + WMI_EVENT_FN_5 = 24, > + WMI_EVENT_REFRESH_RATE = 25, > + WMI_EVENT_CPU_FAN_SPEED = 26, > + WMI_EVENT_GPU_FAN_SPEED = 32, > + WMI_EVENT_WIN_KEY_LOCK = 33, > + WMI_EVENT_RESERVED_23 = 34, > + WMI_EVENT_OPEN_APP = 35, Since you're moving these to left, please do it in a separate patch (or not at all). In this patch, only add/change what you have to retaining the existing alignment. > }; > > enum bitland_mifs_event_type { > @@ -601,18 +606,67 @@ static const struct attribute *const laptop_attrs[] = { > ATTRIBUTE_GROUPS(laptop); > > static const struct key_entry bitland_mifs_wmi_keymap[] = { > - { KE_KEY, WMI_EVENT_OPEN_APP, { KEY_PROG1 } }, > - { KE_KEY, WMI_EVENT_CALCULATOR_START, { KEY_CALC } }, > - { KE_KEY, WMI_EVENT_BROWSER_START, { KEY_WWW } }, > - { KE_IGNORE, WMI_EVENT_FN_J, { KEY_RESERVED } }, > - { KE_IGNORE, WMI_EVENT_FN_F, { KEY_RESERVED } }, > - { KE_IGNORE, WMI_EVENT_FN_0, { KEY_RESERVED } }, > - { KE_IGNORE, WMI_EVENT_FN_1, { KEY_RESERVED } }, > - { KE_IGNORE, WMI_EVENT_FN_2, { KEY_RESERVED } }, > - { KE_IGNORE, WMI_EVENT_FN_3, { KEY_RESERVED } }, > - { KE_IGNORE, WMI_EVENT_FN_4, { KEY_RESERVED } }, > - { KE_IGNORE, WMI_EVENT_FN_5, { KEY_RESERVED } }, > - { KE_END, 0 } > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_OPEN_APP, 1, 0), > + { KEY_PROG1 } }, Don't ever do misleading indentations like this please. You're allowed to use 100 chars so these can fit to single line. If you still want multilines, you need to indent the members of the struct by one tab (and leave only { on the first line). > + > + { 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 } }, > + > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_J, 0, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_F, 0, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_0, 0, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_1, 0, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_2, 0, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_3, 0, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 0, 0), {} }, > + > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_2, 0, 0), > + { KEY_SELECTIVE_SCREENSHOT } }, > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_3, 0, 0), > + { KEY_ALL_APPLICATIONS } }, > + { KE_KEY, BI_HOTKEY_CODE(0x1b, 0, 0), { KEY_CONFIG } }, > + { KE_KEY, BI_HOTKEY_CODE(0x1b, 1, 0), { KEY_CONFIG } }, > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_RESERVED_1, 1, 0), > + { KEY_SWITCHVIDEOMODE } }, > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0), > + { KEY_REFRESH_RATE_TOGGLE } }, > + > + /* AI button has code for each position */ > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 1, 0), > + { KEY_ASSISTANT } }, > + > + { KE_KEY, BI_HOTKEY_CODE(0x19, 1, 0), > + { KEY_ASSISTANT } }, > + > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0, 0x80), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 5, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_KBD_BRIGHTNESS, 0x0a, 0), {} }, > + > + /* Xiaomi G Command Center */ > + { KE_KEY, BI_HOTKEY_CODE(0x0a, 1, 0), { KEY_VENDOR } }, > + > + /* OEM preset power mode */ > + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 1, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 2, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 3, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(0x16, 4, 0), {} }, > + > + /* Fn Lock state */ > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FNLOCK_STATE, 0, 0), {} }, > + { KE_IGNORE, BI_HOTKEY_CODE(WMI_EVENT_FNLOCK_STATE, 1, 0), {} }, > + > + /* Fn+`/1/2/3/4 */ > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_F, 1, 0), { KEY_F13 } }, > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_0, 1, 0), { KEY_F14 } }, > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_1, 1, 0), { KEY_F15 } }, > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_2, 1, 0), { KEY_F16 } }, > + { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_3, 1, 0), { KEY_F17 } }, > + > + { KE_END } > }; > > static void bitland_notifier_unregister(void *data) > @@ -736,9 +790,12 @@ static void bitland_mifs_wmi_notify(struct wmi_device *wdev, > struct bitland_mifs_wmi_data *data = dev_get_drvdata(&wdev->dev); > const struct bitland_mifs_event *event = buffer->data; > struct bitland_fan_notify_data fan_data; > + struct key_entry *entry; > + bool autorelease = true; > + int value = 1; > + u32 payload; > u8 brightness; > > - /* Validate event type */ Why is this removed? How is it related to the change. > if (event->event_type != WMI_EVENT_TYPE_HOTKEY) > return; > > @@ -752,62 +809,56 @@ static void bitland_mifs_wmi_notify(struct wmi_device *wdev, > blocking_notifier_call_chain(&bitland_notifier_list, > BITLAND_NOTIFY_KBD_BRIGHTNESS, > &brightness); > - break; > + return; > > case WMI_EVENT_PERFORMANCE_PLAN: > blocking_notifier_call_chain(&bitland_notifier_list, > BITLAND_NOTIFY_PLATFORM_PROFILE, > NULL); > - break; > - > - case WMI_EVENT_OPEN_APP: > - case WMI_EVENT_CALCULATOR_START: > - case WMI_EVENT_BROWSER_START: { > - guard(mutex)(&data->lock); > - if (!sparse_keymap_report_event(data->input_dev, > - event->event_id, 1, true)) > - dev_warn(&wdev->dev, "Unknown key pressed: 0x%02x\n", > - event->event_id); > - break; > - } > + return; > > - /* > - * The device has 3 fans (CPU, GPU, SYS), > - * but there are only the CPU and GPU fan has events > - */ > 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; > + } > + > if (event->event_id == WMI_EVENT_CPU_FAN_SPEED) > fan_data.channel = 0; > else > fan_data.channel = 1; > > - /* Fan speed is 16-bit value (value_low is LSB, value_high is MSB) */ Is this related to your change? > fan_data.speed = (event->value_high << 8) | event->value_low; > blocking_notifier_call_chain(&bitland_notifier_list, > BITLAND_NOTIFY_HWMON, > &fan_data); > - break; > - > - case WMI_EVENT_AIRPLANE_MODE: > - case WMI_EVENT_TOUCHPAD_STATE: > - case WMI_EVENT_FNLOCK_STATE: > - case WMI_EVENT_KBD_MODE: > - case WMI_EVENT_CAPSLOCK_STATE: > - case WMI_EVENT_NUMLOCK_STATE: > - case WMI_EVENT_SCROLLLOCK_STATE: > - case WMI_EVENT_REFRESH_RATE: > - case WMI_EVENT_WIN_KEY_LOCK: > - /* These events are informational or handled by firmware */ > - dev_dbg(&wdev->dev, "State change event: id=%d value=%d\n", > - event->event_id, event->value_low); > - break; > + return; > > default: > - dev_dbg(&wdev->dev, "Unknown event: id=0x%02x value=0x%02x\n", > - event->event_id, event->value_low); > break; > } > + > + payload = get_unaligned_le32(buffer->data); > + > +report_key: > + entry = sparse_keymap_entry_from_scancode(data->input_dev, payload); > + > + if (!entry) { > + dev_dbg(&wdev->dev, "Unknown WMI hotkey with payload 0x%08x\n", payload); > + return; > + } > + > + /* AI key quirk */ > + if (entry->keycode == KEY_ASSISTANT) { > + value = !(payload & AI_KEY_VALUE_MASK); > + autorelease = false; > + } > + > + guard(mutex)(&data->lock); > + sparse_keymap_report_entry(data->input_dev, entry, value, autorelease); How about moving this report_key part into own function so you can avoid adding the label and complicated break/return arrangements. -- i. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v1 3/4] MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver 2026-07-09 12:23 [PATCH v1 0/4] Merge redmi-wmi into bitland-mifs-wmi Mingyou Chen 2026-07-09 12:23 ` [PATCH v1 1/4] platform/x86: redmi-wmi: Drop redmi-wmi driver Mingyou Chen 2026-07-09 12:23 ` [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver Mingyou Chen @ 2026-07-09 12:23 ` Mingyou Chen 2026-07-10 10:25 ` Ilpo Järvinen 2026-07-09 12:23 ` [PATCH v1 4/4] platform/x86: bitland-mifs-wmi: Add Redmi mic-mute key entries Mingyou Chen 3 siblings, 1 reply; 11+ messages in thread From: Mingyou Chen @ 2026-07-09 12:23 UTC (permalink / raw) To: qby140326 Cc: W_Armin, foxido, hansg, ilpo.jarvinen, linux-kernel, nika, platform-driver-x86 Add a new maintainer entry for the bitland-mifs-wmi platform driver Signed-off-by: Mingyou Chen <qby140326@gmail.com> --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6d9b69c1df4c..b92bc4816fa6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22768,6 +22768,13 @@ S: Maintained T: git https://github.com/pkshih/rtw.git F: drivers/net/wireless/realtek/rtw89/ +BITLAND LAPTOP DRIVER +M: Mingyou Chen <qby140326@gmail.com> +M: Gladyshev Ilya <foxido@foxido.dev> +L: platform-driver-x86@vger.kernel.org +S: Maintained +F: drivers/platform/x86/bitland-mifs-wmi.c + REDPINE WIRELESS DRIVER L: linux-wireless@vger.kernel.org S: Orphan -- 2.55.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v1 3/4] MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver 2026-07-09 12:23 ` [PATCH v1 3/4] MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver Mingyou Chen @ 2026-07-10 10:25 ` Ilpo Järvinen 0 siblings, 0 replies; 11+ messages in thread From: Ilpo Järvinen @ 2026-07-10 10:25 UTC (permalink / raw) To: Mingyou Chen Cc: W_Armin, foxido, Hans de Goede, LKML, nika, platform-driver-x86 On Thu, 9 Jul 2026, Mingyou Chen wrote: > Add a new maintainer entry for the bitland-mifs-wmi > platform driver Don't leave lines short but fill the lines up to 72 chars. Missing final stop (.). > > Signed-off-by: Mingyou Chen <qby140326@gmail.com> > --- > MAINTAINERS | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 6d9b69c1df4c..b92bc4816fa6 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -22768,6 +22768,13 @@ S: Maintained > T: git https://github.com/pkshih/rtw.git > F: drivers/net/wireless/realtek/rtw89/ > > +BITLAND LAPTOP DRIVER > +M: Mingyou Chen <qby140326@gmail.com> > +M: Gladyshev Ilya <foxido@foxido.dev> > +L: platform-driver-x86@vger.kernel.org > +S: Maintained > +F: drivers/platform/x86/bitland-mifs-wmi.c > + > REDPINE WIRELESS DRIVER > L: linux-wireless@vger.kernel.org > S: Orphan > -- i. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v1 4/4] platform/x86: bitland-mifs-wmi: Add Redmi mic-mute key entries 2026-07-09 12:23 [PATCH v1 0/4] Merge redmi-wmi into bitland-mifs-wmi Mingyou Chen ` (2 preceding siblings ...) 2026-07-09 12:23 ` [PATCH v1 3/4] MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver Mingyou Chen @ 2026-07-09 12:23 ` Mingyou Chen 3 siblings, 0 replies; 11+ messages in thread From: Mingyou Chen @ 2026-07-09 12:23 UTC (permalink / raw) To: qby140326 Cc: W_Armin, foxido, hansg, ilpo.jarvinen, linux-kernel, nika, platform-driver-x86 Add the missing Redmibook mic-mute hotkey definitions to the shared sparse keymap table: - 0x00002101 (Fn-lock disabled state) - 0x00012101 (Fn-lock enabled state) Reported-by: Nika Krasnova <nika@nikableh.moe> Link: https://lore.kernel.org/platform-driver-x86/20260531123345.237521-1-nika@nikableh.moe/ Signed-off-by: Mingyou Chen <qby140326@gmail.com> --- drivers/platform/x86/bitland-mifs-wmi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c index cbe118bbe428..7d8a3be5ec68 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -634,6 +634,10 @@ static const struct key_entry bitland_mifs_wmi_keymap[] = { { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_REFRESH_RATE, 0, 0), { KEY_REFRESH_RATE_TOGGLE } }, + /* Mic-mute key */ + { KE_KEY, BI_HOTKEY_CODE(0x21, 0, 0), { KEY_MICMUTE } }, + { KE_KEY, BI_HOTKEY_CODE(0x21, 1, 0), { KEY_MICMUTE } }, + /* AI button has code for each position */ { KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_FN_5, 1, 0), { KEY_ASSISTANT } }, -- 2.55.0 ^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-07-10 10:26 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-07-09 12:23 [PATCH v1 0/4] Merge redmi-wmi into bitland-mifs-wmi Mingyou Chen 2026-07-09 12:23 ` [PATCH v1 1/4] platform/x86: redmi-wmi: Drop redmi-wmi driver Mingyou Chen 2026-07-10 10:24 ` Ilpo Järvinen 2026-07-09 12:23 ` [PATCH v1 2/4] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver Mingyou Chen 2026-07-09 16:07 ` Nika Krasnova 2026-07-10 3:41 ` Mingyou Chen 2026-07-09 16:21 ` Nika Krasnova 2026-07-10 10:20 ` Ilpo Järvinen 2026-07-09 12:23 ` [PATCH v1 3/4] MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver Mingyou Chen 2026-07-10 10:25 ` Ilpo Järvinen 2026-07-09 12:23 ` [PATCH v1 4/4] platform/x86: bitland-mifs-wmi: Add Redmi mic-mute key entries Mingyou Chen
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.