mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RESEND PATCH 0/5] platform/x86: bitland-mifs-wmi: MIFS v2 firmware support (Xiaomi Book Pro 14 2026)
@ 2026-07-28 18:09 孙 誉铭
  2026-07-28 18:09 ` [RESEND PATCH 1/5] platform/x86: bitland-mifs-wmi: validate WMAA status, never abort suspend 孙 誉铭
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: 孙 誉铭 @ 2026-07-28 18:09 UTC (permalink / raw)
  To: platform-driver-x86
  Cc: linux-kernel, Mingyou Chen, Armin Wolf, Hans de Goede,
	Ilpo Järvinen, Nabil Danial, 孙 誉铭

Resending: the foxmail envelope rewrite (tencent...@qq.com) appears to
have gotten the first attempt filtered. No content changes.

This series makes the Bitland MIFS WMI driver work on the Xiaomi Book
Pro 14 2026 (Intel Panther Lake, Ultra 5 358H) and very likely on the
REDMI Book Pro 14 2025, whose suspend failure was reported earlier [1].

These machines ship a reduced MIFS firmware ("v2"): the WMAA method
implements only function groups 0x0800/0x0a00/0x0c00/0x1000, reports
the performance mode as raw QFAN EC codes {2,3,4,9,10} instead of the
v1 0..3 enumeration, and exposes no WMI fan function. Additionally the
firmware never defines ECON, so \_SB.PC00.LPCB.Q_EC._STA fails and the
ACPI EC driver never binds, which kills all EC query handlers
(including the lid switch notifications _Q0C/_Q0D).

Symptoms fixed by this series, all reproduced and verified on the
affected machine:

* Suspend/hibernate aborted with -EINVAL from the driver's suspend
  hook (same failure as [1]: "dpm_run_callback():
  bitland_mifs_wmi_suspend returns -22"; 242 failures counted in
  suspend_stats). Patch 1 makes the WMI call validate the firmware
  status word and the suspend/resume hooks fault-tolerant.

* power-profiles-daemon could not read or set the platform profile
  ("Failed to get profile for handler bitland-mifs-wmi"; selecting
  "performance" failed outright and wedged the daemon). Patch 2
  detects the v2 firmware variant at probe and maps the QFAN codes
  (2=quiet, 3=balanced, 4=speed, 9/10=extreme).

* The hwmon device reported zero RPM on all channels because the v2
  firmware has no WMI fan function. Patch 3 reads the two fan
  tachometers (u16 RPM, 0 = stopped) from the EC shared-memory window
  at 0xFE0B0300 (DSDT region "ERAM", offsets 0x69/0x6B).

* Closing the lid produced no SW_LID event (screen stayed on, keys
  pressed by the closed lid typed into the visible lock screen,
  locking the account). Patch 4 polls the LSTE lid bit in the EC
  window and, on a change, evaluates the very AML methods the EC
  query would have run (_Q0C/_Q0D), restoring proper lid events.
  DMI-gated to the affected model.

All values were reverse-engineered from the machine's DSDT/SSDT
(WMID device, _UID "MIFS") and verified live: mode switching changes
the EC QFAN register as expected, fan tachs ramp 0 -> ~2700 RPM under
load, lid close/open emit proper switch events consumed by
systemd-logind, and suspend/resume cycles complete cleanly with the
driver loaded (suspend_stats: fail 0).

Notes for reviewers:

* The v2 variant is detected at runtime (perf-mode query result
  outside the v1 enumeration) so other Bitland machines sharing this
  firmware generation get support without DMI entries; the lid quirk
  additionally requires a DMI match.
* On this platform the firmware perf-mode switch reaches Intel DTT
  (\_SB.IETM, INTC10D4) via ODV variables; mainline has no driver for
  that device, so the TDP change the firmware intends is currently
  not applied on Linux. Programming RAPL directly from this driver
  seemed inappropriate; I left it out. Happy to hear preferences.
* Interactions with the in-flight "Merge redmi-wmi into
  bitland-mifs-wmi" series [2] are limited to file context; the
  control-device paths touched here are disjoint from the event-device
  merge.

[1] https://lists.openwall.net/linux-kernel/2026/07/10/72
    "[BUG] platform/x86: bitland-mifs-wmi: Hibernation fails with
    error -22 on Xiaomi Redmi Book Pro 14 2025"
[2] https://www.spinics.net/lists/kernel/msg6309086.html
    "[PATCH v1 0/4] Merge redmi-wmi into bitland-mifs-wmi"


Yuming Sun (5):
  platform/x86: bitland-mifs-wmi: validate WMAA status, never abort
    suspend
  platform/x86: bitland-mifs-wmi: support MIFS v2 perf-mode mapping
  platform/x86: bitland-mifs-wmi: read fan tach from EC window on MIFS
    v2
  platform/x86: bitland-mifs-wmi: drive lid switch via EC poll on Xiaomi
    Book Pro 14
  Documentation: wmi: bitland-mifs-wmi: document MIFS v2 firmware
    variant

 .../wmi/devices/bitland-mifs-wmi.rst          |  26 ++
 drivers/platform/x86/bitland-mifs-wmi.c       | 272 +++++++++++++++++-
 2 files changed, 290 insertions(+), 8 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 22+ messages in thread
* Re: [RESEND PATCH 0/5] platform/x86: bitland-mifs-wmi: MIFS v2 firmware support (Xiaomi Book Pro 14 2026)
@ 2026-10-07 11:48 Jame Jao
  0 siblings, 0 replies; 22+ messages in thread
From: Jame Jao @ 2026-10-07 11:48 UTC (permalink / raw)
  To: Yuming Sun
  Cc: Cc: Mingyou Chen, Cc: Ilpo Jarvinen, Cc: Armin Wolf,
	platform-driver-x86, linux-kernel

Hi Yuming,

I would like to add a third affected machine to this report: the REDMI
Book Pro 14 2026 (board TM2426, Core Ultra 5 338H, Panther Lake), BIOS
RMAPT4B0P0909 (2026-05-21), EC firmware 1.9, originally running
7.2.8-zen1-2-zen.

It shows the same MIFS v2 firmware behaviour you describe, and your series
addresses the two things that make this laptop unusable for suspend today.

1) Suspend (s2idle) is aborted with -EINVAL by the driver's suspend hook.
   Every attempt ends like this:

     PM: suspend entry (s2idle)
     bitland-mifs-wmi B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B-4: PM:
dpm_run_callback(): bitland_mifs_wmi_suspend [bitland_mifs_wmi]
returns -22
     bitland-mifs-wmi B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B-4: PM:
failed to suspend: error -22
     PM: Some devices failed to suspend, or early wake event detected
     systemd-sleep: Failed to put system to sleep. System resumed
again: Invalid argument

   /sys/power/suspend_stats on this machine:

     failed_suspend   4
     last_failed_dev  B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B-4
     last_failed_errno -22
     last_failed_step suspend
     success          0

   Since then I set up a disk swap file and verified all three sleep paths
   locally with a minimal one-file change that follows the approach of your
   patch 1/5 (never propagate the perf-mode query error from the suspend
   hook), applied on top of a 7.2.9 tree (Arch linux-zen packaging of 7.2.9:
   vanilla 7.2.9 plus the zen patchset):

     * s2idle works again:

         PM: suspend entry (s2idle)   18:13:51
         PM: suspend exit             18:13:57
         /sys/power/suspend_stats: success=1, failed_suspend=0

     * hibernation works and the session is restored (same boot id before
       and after; ~63-94 s offline including firmware POST):

         systemd-hibernate.service: Finished System Hibernate
         systemd-sleep: Successfully thawed unit 'user.slice'

     * closing the lid does the right thing as well, with logind configured
       for HandleLidSwitch=suspend-then-hibernate and HibernateDelaySec=1h:

         Lid closed                                 18:31:00
         PM: suspend entry (s2idle)                 18:31:00
         PM: suspend exit                           18:32:01
         sleep operation 'hibernate'                18:32:02
         PM: hibernation: hibernation exit          18:33:47
         (same boot id before and after the whole sequence)

   I am happy to send the one-file diff, the full logs and the /sys/power
   settings, or to test a revised version of this series.

2) platform_profile registration fails, exactly as in your report:

     platform_profile: Failed to get profile for handler bitland-mifs-wmi
     platform_profile: Failed to get profile for handler bitland-mifs-wmi
     platform_profile: Failed to get profile for handler bitland-mifs-wmi

   /sys/class/platform_profile does not exist, so power-profiles-daemon
   cannot read or set any profile.

The firmware side matches your analysis as well - the missing ECON symbol
shows up 40 times during a single boot:

  ACPI BIOS Error (bug): Could not resolve symbol
[\_SB.PC00.LPCB.Q_EC._STA.ECON], AE_NOT_FOUND
  ACPI Error: Aborting method \_SB.PC00.LPCB.Q_EC._STA due to previous
error (AE_NOT_FOUND)

Both bitland_mifs_wmi and redmi_wmi are loaded on this machine, as in [1].

One difference to the unit you tested: TM2426 does expose an ACPI lid
device (PNP0C0D:00) and an input device "Lid Switch" with the SW_LID bit
set (capabilities/sw = 1), so patch 4/5 may not be needed on this model.
I have now verified that lid events do arrive here: logind logs "Lid closed."
and performs the configured sleep action (see the sequence above). The
firmware still reports a bogus lid state once per resume ("ACPI: button:
[Firmware Bug]: Unexpected lid state reported by firmware"), which does not
prevent the lid action from working.

For completeness, one more observation from this board (possibly
unrelated to MIFS): ACPI init takes about 6 seconds here. initcall_debug
attributes it to ACPI object evaluation - e.g. 0.4-0.6 s per power
resource, ~2.7 s in acpi_processor_driver_init and ~4.1 s in acpi_init.
If the ECON/_STA problem is involved in that as well, I am happy to
collect whatever data helps.

I can provide further evidence (acpidump, full dmesg, DSDT disassembly of
the WMAA method and the QFAN-related objects, longer suspend_stats) or run
any test instructions you have. I can build and test kernels locally (the
verification above was done with a hand-built 7.2.9 plus a 10-line diff),
so I am also happy to test revised versions of this series, including on
mainline, and report back.

Thanks a lot for working on this - suspend being blocked was the biggest
usability problem on this laptop.

Note: the local testing and the preparation of this report were done with
the assistance of a local AI assistant (DeepSeek Harness WebUI, deepseek-flash
model); every command, log and result quoted above was actually executed on
this machine and reviewed by me.

Eason

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2026-10-07 11:48 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-28 18:09 [RESEND PATCH 0/5] platform/x86: bitland-mifs-wmi: MIFS v2 firmware support (Xiaomi Book Pro 14 2026) 孙 誉铭
2026-07-28 18:09 ` [RESEND PATCH 1/5] platform/x86: bitland-mifs-wmi: validate WMAA status, never abort suspend 孙 誉铭
2026-08-24 15:42   ` Ilpo Järvinen
2026-08-26 13:26     ` KentoNion
2026-08-26 13:29     ` KentoNion
2026-07-28 18:09 ` [RESEND PATCH 2/5] platform/x86: bitland-mifs-wmi: support MIFS v2 perf-mode mapping 孙 誉铭
2026-07-30 10:56   ` Mingyou Chen
2026-08-16 22:18   ` kento
2026-07-28 18:10 ` [RESEND PATCH 3/5] platform/x86: bitland-mifs-wmi: read fan tach from EC window on MIFS v2 孙 誉铭
2026-08-24 15:48   ` Ilpo Järvinen
2026-07-28 18:10 ` [RESEND PATCH 4/5] platform/x86: bitland-mifs-wmi: drive lid switch via EC poll on Xiaomi Book Pro 14 孙 誉铭
2026-08-24 16:00   ` Ilpo Järvinen
2026-08-26 13:26     ` KentoNion
2026-08-26 13:29     ` KentoNion
2026-07-28 18:10 ` [RESEND PATCH 5/5] Documentation: wmi: bitland-mifs-wmi: document MIFS v2 firmware variant 孙 誉铭
2026-07-30  9:24 ` [RESEND PATCH 0/5] platform/x86: bitland-mifs-wmi: MIFS v2 firmware support (Xiaomi Book Pro 14 2026) Armin Wolf
2026-08-26 13:26   ` KentoNion
2026-08-26 13:29   ` KentoNion
2026-08-27 22:04     ` Armin Wolf
2026-08-26 21:45 ` Armin Wolf
2026-10-07 10:53 ` Eason
2026-10-07 11:48 Jame Jao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®