mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Karasev <uselessfire@gmail.com>
To: qby140326@gmail.com
Cc: ilpo.jarvinen@linux.intel.com, hansg@kernel.org,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, W_Armin@gmx.de,
	ilya.gladyshev@linux.dev, foxido@foxido.dev, kento@kekto.ru,
	ericted8810@gmail.com, chris@miget.com,
	matias.civadda2342001@gmail.com, btx342@gmail.com,
	wleizc7319@gmail.com, wolf109909@outlook.com,
	vlku.milos.fun@gmail.com, i@rsplwe.com, bozhenpeng93@gmail.com,
	martiya.ar@gmail.com, aleksejirlik@gmail.com
Subject: Re: [PATCH v6 5/5] platform/x86: bitland-mifs-wmi: Add per-machine ops table
Date: Wed, 30 Sep 2026 04:50:58 +0300	[thread overview]
Message-ID: <20260930015058.3076905-1-uselessfire@gmail.com> (raw)
In-Reply-To: <20260929134503.17249-6-qby140326@gmail.com>

Hi,

Data for the per-machine table from a Xiaomi Redmi Book Pro 16 2024
(DMI: sys_vendor "XIAOMI", board_name "TM2309"; BIOS RMAMT6B0P0B0B,
bios_release and ec_firmware_release 1.11), the same model as in
Martiya's report. RMAMT6B0P0B0B (August 2025) is the latest BIOS Xiaomi
publishes for this model, so this is what an entry would be written
against. Its values match neither the Bitland defaults nor the Redmi map
proposed in v5 6/6. The full acpidump is attached to bugzilla 222062:
https://bugzilla.kernel.org/attachment.cgi?id=310971
The WMI method is \_SB.PC00.WMID.WMAA in the SSDT with OEM Table ID
XMCC1806; QFAN and NTDP are in the DSDT.

Mode values
-----------

WMAA stores the value written with WMI_FN_SYSTEM_PER_MODE in the EC
register QFAN as is (5 and 7 go to a separate register, SMMD, instead),
and NTDP in the DSDT maps QFAN to the DPTF variable \_SB.ODV1 (odvp1 in
sysfs) that thermald --adaptive uses to pick the policy from the GDDV:

  QFAN   meaning                          ODV1
  0, 1   balanced (Fn+K sets 1)           0
  2      quiet                            2
  3      performance ("Turbo")            1
  4      full speed ("Geek")              4

GET returns QFAN for 1..4 and 0 otherwise (so 0 after a SET of 0).
Fn+K on this model cycles 1 -> 3 -> 2.

I tested this with a local build that maps low-power/balanced/
performance to 2/1/3: power-profiles-daemon power-saver, balanced and
performance give odvp1 2, 0 and 1, and thermald loads the matching GDDV
targets (PL1 limits, TCC offset), both on AC and on battery.

On the DMI match: the v5 6/6 match on sys_vendor "Redmi"/"TIMI" would
not cover this machine, and performance = 0 from that map is balanced
here. The REDMI Book Pro 16 2025 in Aleksey's report also has
sys_vendor "XIAOMI" but uses different values, so an entry for this
model has to match board_name "TM2309". The Pro 14 2024 (TM2307) is
built on the same platform (Xiaomi's downloads for both, the BIOS
included, are filed under one platform name, N56N57) and may behave the
same; I cannot verify that.

Capability checks
-----------------

a) Performance on AC and on battery. WMI_FN_SYSTEM_AC_TYPE is not
   implemented on this BIOS, so with Armin's "Treat
   WMI_FN_SYSTEM_AC_TYPE as optional" the capability check passes on
   AC. The write itself is still reported as failed here, though:
   WMAA's SET branches set only the return code and leave the function
   id at 0 (only the GET branches fill it in), so "Detect failed
   function calls" (23cc56f6dea6 in for-next) returns -ENOMSG for every
   SET on this BIOS, although the firmware applies it -- the same as
   Chris reported for the Book Pro 14. I checked it with the for-next
   version of the driver built for 7.2.7: every write of low-power,
   balanced and performance failed with -ENOMSG while QFAN changed to
   2, 0 and 3; with Chris's "Only check the function id of GET
   responses" on top, all of them succeed.
   On battery, power_supply_is_system_supplied() still refuses
   performance, although the firmware supports Turbo on DC: Fn+K
   reaches it on battery, the GDDV has a DC Turbo target, and writing 3
   on battery works (odvp1 1, thermald applies the DC Turbo limits).

b) Full speed. The firmware does not validate the mode at all. Writing
   4 was accepted and applied (odvp1 4, thermald loads the Geek targets;
   on AC the PL1 ramped towards the 90 W Geek maximum) both on battery
   and on a 100 W USB-C PD charger, while Fn+K never offers full speed
   in either case. It is not a charger thing either: with the stock
   140 W USB-C charger (the EC register ADPW then reads 140, and GET of
   command 0x10, subcommand 3, would report the adapter as not below
   140 W) Fn+K still cycles only 1 -> 3 -> 2. So on this model full
   speed is never offered by the vendor's own key, and whether it is
   exposed has to be decided by the driver; the firmware will not stop
   it.

Commands that are not implemented, and one that is dangerous
------------------------------------------------------------

On this BIOS WMAA implements only command 0x08 (GET and SET), 0x0a
subcommand 5, and 0x10 (GET subcommands 1-3, SET subcommand 2 only).
Other command IDs answer 0xE000, among them everything else the driver
uses: 0x09 (gpu_mode), 0x0d (fan speeds), 0x12 (keyboard brightness),
0x13 (AC type), 0x14 (fan_boost) and 0x16 (CPU temperature).
Unhandled subcommands of 0x0a and 0x10 mostly return status 0, and a
GET of 0x0a answers 0x8000 whatever the subcommand. The hwmon device,
the kbd_backlight LED, gpu_mode and fan_boost therefore have nothing
behind them on this machine; probing support at probe time would avoid
exposing them.

kb_mode is worse than unsupported. kb_mode_store() sends command 0x10
(WMI_FN_RGB_KB_MODE) with the mode in the first payload byte. On this
firmware command 0x10 is the battery interface, and subcommand 2 is the
charge protection (bit 0 of the EC register LONL, 80 % limit; reportedly
what Xiaomi's Windows tools toggle): WMAA sets the bit only for the
value 1 and clears it for anything else. "echo fixed > kb_mode" is
therefore 0x10/2 with value 0. I verified on this machine that it
silently turns off charge protection -- LONL goes from 0x31 to 0x00, the
charge limit in the EC goes from 80 back to 100 and the battery, which
had been held at 80 %, starts charging again -- while the firmware
reports success (0x8000). That was on 7.2.7, whose driver does not check
the reply; with 23cc56f6dea6 the write returns -ENOMSG instead, but
protection is off all the same. I think kb_mode must not be exposed on
these machines.

Once the generic profile table has settled I can send a patch with the
entry for this model and the kb_mode fix on top of it, and I am happy to
test patches in the meantime.

Thanks,
Anton Karasev

      reply	other threads:[~2026-09-30  1:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 13:44 [PATCH v6 0/5] Merge redmi-wmi into bitland-mifs-wmi Mingyou Chen
2026-09-29 13:44 ` [PATCH v6 1/5] MAINTAINERS: Add maintainer entry of bitland-mifs-wmi driver Mingyou Chen
2026-09-29 13:45 ` [PATCH v6 2/5] platform/x86: bitland-mifs-wmi: Merge the function of redmi-wmi into the bitland driver Mingyou Chen
2026-09-30  1:58   ` Anton Karasev
2026-09-30 20:53   ` Ilya Gladyshev
2026-09-30 22:01   ` Ilya Gladyshev
2026-09-29 13:45 ` [PATCH v6 3/5] platform/x86: bitland-mifs-wmi: Add Redmi mic-mute key entries Mingyou Chen
2026-09-29 13:45 ` [PATCH v6 4/5] platform/x86: redmi-wmi: Drop redmi-wmi driver Mingyou Chen
2026-09-29 13:45 ` [PATCH v6 5/5] platform/x86: bitland-mifs-wmi: Add per-machine ops table Mingyou Chen
2026-09-30  1:50   ` Anton Karasev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260930015058.3076905-1-uselessfire@gmail.com \
    --to=uselessfire@gmail.com \
    --cc=W_Armin@gmx.de \
    --cc=aleksejirlik@gmail.com \
    --cc=bozhenpeng93@gmail.com \
    --cc=btx342@gmail.com \
    --cc=chris@miget.com \
    --cc=ericted8810@gmail.com \
    --cc=foxido@foxido.dev \
    --cc=hansg@kernel.org \
    --cc=i@rsplwe.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=ilya.gladyshev@linux.dev \
    --cc=kento@kekto.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martiya.ar@gmail.com \
    --cc=matias.civadda2342001@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=qby140326@gmail.com \
    --cc=vlku.milos.fun@gmail.com \
    --cc=wleizc7319@gmail.com \
    --cc=wolf109909@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®