Re: [PATCH v3 4/4] platform/x86: bitland-mifs-wmi: Cycle the platform profile on Fn+K

From: Chris Taraszka

Date: Fri Nov 06 2026 - 06:25:24 EST


On Mon, 2 Nov 2026, Mingyou Chen wrote:
> How about 0x16 (WMI_EVENT_PERFORMANCE_PLAN_ALT)? Some devices report
> this instead of 0x28 (WMI_EVENT_PERFORMANCE_CYCLE).

0x16 reports a mode change rather than asking for one. On TM2135 the
firmware cycles the mode itself on Fn+K and then sends 0x16 with the
new value [1]. TM2424 sends it after every SET as well, within 10 ms:

SET 0x09 -> 0x16 value 0x09
SET 0x03 -> 0x16 value 0x03
SET 0x02 -> 0x16 value 0x02

Cycling on 0x16 would step twice per Fn+K press on TM2135, and on any
of these machines it would loop, since each step does a SET that sends
another 0x16. v15 already handles it with platform_profile_notify().
0x28 is different: TM2424 sends it on Fn+K and leaves the mode alone.

[1] https://lore.kernel.org/all/BelDdF5woNEBX6dZ3_zJDEbVkifs1pdxEjtQ1yC-aKyZahijFJCllxm0l_SqZ5Hsj61D8wfJNa7uDSuNKmyyxo2S0tZp9QS5yaafeZUxvxE=@proton.me/

Thanks,
Chris


On Mon, Nov 2, 2026 at 12:10 PM Mingyou Chen <qby140326@xxxxxxxxx> wrote:
>
> On 11/2/26 00:18, Chris Taraszka wrote:
> > On the Xiaomi Book Pro 14 (TM2424), Fn+K sends hotkey event 0x28 and
> > the firmware does not change SystemPerMode itself. The event is a
> > request that the vendor software acts on; without that software Fn+K
> > does nothing on Windows either, and on Linux it is currently logged as
> > an unknown event.
> >
> > Add a quirk for this and call platform_profile_cycle() from the control
> > device when the event arrives, so Fn+K cycles through the profiles that
> > all platform profile handlers support. Models without the quirk keep
> > ignoring the event.
> >
> > Suggested-by: Hans de Goede <hansg@xxxxxxxxxx>
> > Signed-off-by: Chris Taraszka <chris@xxxxxxxxx>
> > ---
> >
> > Notes:
> > Sent on its own earlier today [1]. It is now part of the series since
> > it changes the TM2424 quirks entry from patch 1. Retested with v3: three
> > Fn+K presses from balanced step performance (0x04) -> low-power (0x02)
> > -> balanced (0x09).
> >
> > [1] https://lore.kernel.org/all/20261101144100.1043263-1-chris@xxxxxxxxx/
> >
> > drivers/platform/x86/bitland-mifs-wmi.c | 20 ++++++++++++++++++++
> > 1 file changed, 20 insertions(+)
> >
> > diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
> > index 4d02cd9e8a6b..84d1223d0ec6 100644
> > --- a/drivers/platform/x86/bitland-mifs-wmi.c
> > +++ b/drivers/platform/x86/bitland-mifs-wmi.c
> > @@ -100,6 +100,9 @@ struct bitland_mifs_quirks {
> >
> > bool return_code_at_end;
> > bool skip_ac_type_check;
> > +
> > + /* Fn+K sends WMI_EVENT_PERFORMANCE_CYCLE and leaves the mode to the OS */
> > + bool cycle_profile_on_key;
> > };
> >
> > static const struct bitland_profile_entry default_profile_entries[] = {
> > @@ -126,6 +129,7 @@ static const struct bitland_mifs_quirks tm2424_quirks = {
> > .profile_entries = tm2424_profile_entries,
> > .num_profile_entries = ARRAY_SIZE(tm2424_profile_entries),
> > .skip_ac_type_check = true,
> > + .cycle_profile_on_key = true,
> > };
> >
> > static const struct dmi_system_id bitland_mifs_dmi_table[] = {
> > @@ -169,6 +173,7 @@ enum bitland_mifs_event_id {
> > WMI_EVENT_MIC_MUTE = 33,
> > WMI_EVENT_RESERVED_23 = 34,
> > WMI_EVENT_OPEN_APP = 35,
> > + WMI_EVENT_PERFORMANCE_CYCLE = 40,
> > };
> >
> > enum bitland_mifs_event_type {
> > @@ -217,6 +222,7 @@ static BLOCKING_NOTIFIER_HEAD(bitland_notifier_list);
> > enum bitland_notifier_actions {
> > BITLAND_NOTIFY_KBD_BRIGHTNESS,
> > BITLAND_NOTIFY_PLATFORM_PROFILE,
> > + BITLAND_NOTIFY_PLATFORM_PROFILE_CYCLE,
> > BITLAND_NOTIFY_HWMON,
> > };
> >
> > @@ -869,6 +875,10 @@ static int bitland_notifier_callback(struct notifier_block *nb,
> > case BITLAND_NOTIFY_PLATFORM_PROFILE:
> > platform_profile_notify(data_ctx->pp_dev);
> > break;
> > + case BITLAND_NOTIFY_PLATFORM_PROFILE_CYCLE:
> > + if (data_ctx->pp_dev)
> > + platform_profile_cycle();
> > + break;
> > case BITLAND_NOTIFY_HWMON:
> > fan_info = data;
> >
> > @@ -1015,6 +1025,7 @@ static void bitland_mifs_wmi_report_key(struct wmi_device *wdev, u32 payload)
> > static void bitland_mifs_wmi_notify(struct wmi_device *wdev,
> > const struct wmi_buffer *buffer)
> > {
> > + 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;
> > u8 brightness;
> > @@ -1043,6 +1054,15 @@ static void bitland_mifs_wmi_notify(struct wmi_device *wdev,
> > NULL);
> > return;
> >
> > + case WMI_EVENT_PERFORMANCE_CYCLE:
> > + if (!data->quirks->cycle_profile_on_key)
> > + break;
> > +
> > + blocking_notifier_call_chain(&bitland_notifier_list,
> > + BITLAND_NOTIFY_PLATFORM_PROFILE_CYCLE,
> > + NULL);
> > + return;
> > +
>
> How about 0x16 (WMI_EVENT_PERFORMANCE_PLAN_ALT)? Some devices report
> this instead of 0x28 (WMI_EVENT_PERFORMANCE_CYCLE).
>
> https://lore.kernel.org/all/BelDdF5woNEBX6dZ3_zJDEbVkifs1pdxEjtQ1yC-aKyZahijFJCllxm0l_SqZ5Hsj61D8wfJNa7uDSuNKmyyxo2S0tZp9QS5yaafeZUxvxE=@proton.me/
>
> > /*
> > * The device has 3 fans (CPU, GPU, SYS),
> > * but there are only the CPU and GPU fan has events