mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Taraszka <chris@miget.com>
To: "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, Mingyou Chen <qby140326@gmail.com>,
	Ilya Gladyshev <ilya.gladyshev@linux.dev>,
	Armin Wolf <W_Armin@gmx.de>, KentoNion <kento@kekto.ru>,
	Matias Civadda <matias.civadda2342001@gmail.com>,
	Chris Taraszka <chris@miget.com>
Subject: [PATCH v2 1/2] platform/x86: bitland-mifs-wmi: Add Xiaomi Book Pro 14 quirk
Date: Sun, 25 Oct 2026 20:54:55 +0100	[thread overview]
Message-ID: <20261025195456.43414-2-chris@miget.com> (raw)
In-Reply-To: <20261025195456.43414-1-chris@miget.com>

The Xiaomi Book Pro 14 (board TM2424) implements SystemPerMode with
its own values. Its firmware ignores 0x00 and 0x01, and GET returns one
of 0x02, 0x03, 0x04, 0x09 or 0x0a, so with the default table balanced
and balanced-performance are no-ops and reading the profile fails with
-EINVAL whenever the firmware is in 0x04, 0x09 or 0x0a. The failed read
also aborts system suspend.

The values were identified from the WMAA method in the firmware's SSDT
and by setting each one and reading the sustained package power limit
from intel-rapl-mmio on AC:

  0x02  18 W
  0x03  37 W
  0x09  45 W
  0x04  58 W
  0x0a  18 W

Map low-power, balanced, balanced-performance and performance to 0x02,
0x03, 0x09 and 0x04. 0x0a is only entered through the firmware's own
mode cycling, so report it as low-power without offering it for SET.

The machine is USB-C only and WMI_FN_SYSTEM_AC_TYPE is not implemented,
so skip the AC type check.

Signed-off-by: Chris Taraszka <chris@miget.com>
---

Notes:
    Tested on the Xiaomi Book Pro 14 (TM2424, BIOS XMAPT4B0P0A0A) with this
    series on top of v13, backported to v7.3, on AC: all four profiles set
    and read back, and the firmware mode (EC 0x68) and PL1 follow:
    0x02/18 W, 0x03/37 W, 0x09/45 W, 0x04/58 W. These match the values
    first measured on BIOS XMAPT4B0P0909. s2idle suspend/resume from
    performance restores 0x04.
    
    On battery, balanced-performance and performance are refused by
    bitland_pp_check_capability(), although BIOS 0909 applies 0x04 on
    battery. This patch leaves that check as it is.

 drivers/platform/x86/bitland-mifs-wmi.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index a4c341ffbb9b..73be63146fd5 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -116,7 +116,28 @@ static const struct bitland_mifs_quirks default_quirks = {
 	.num_profile_entries = ARRAY_SIZE(default_profile_entries),
 };
 
+static const struct bitland_profile_entry tm2424_profile_entries[] = {
+	{ PLATFORM_PROFILE_LOW_POWER,              0x02 },
+	{ PLATFORM_PROFILE_LOW_POWER,              0x0a, true },
+	{ PLATFORM_PROFILE_BALANCED,               0x03 },
+	{ PLATFORM_PROFILE_BALANCED_PERFORMANCE,   0x09 },
+	{ PLATFORM_PROFILE_PERFORMANCE,            0x04 },
+};
+
+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,
+};
+
 static const struct dmi_system_id bitland_mifs_dmi_table[] = {
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "XIAOMI"),
+			DMI_EXACT_MATCH(DMI_BOARD_NAME, "TM2424"),
+		},
+		.driver_data = (void *)&tm2424_quirks,
+	},
 	{}
 };
 
-- 
2.56.0


  reply	other threads:[~2026-10-25 19:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25 19:54 [PATCH v2 0/2] platform/x86: bitland-mifs-wmi: Xiaomi Book Pro 14 support Chris Taraszka
2026-10-25 19:54 ` Chris Taraszka [this message]
2026-10-26  9:22   ` [PATCH v2 1/2] platform/x86: bitland-mifs-wmi: Add Xiaomi Book Pro 14 quirk Mingyou Chen
2026-10-25 19:54 ` [PATCH v2 2/2] platform/x86: bitland-mifs-wmi: Don't fail suspend or resume on profile errors Chris Taraszka
2026-10-26  9:30   ` Mingyou Chen
2026-10-26  9:48     ` Chris Taraszka
2026-10-26 10:05       ` Mingyou Chen

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=20261025195456.43414-2-chris@miget.com \
    --to=chris@miget.com \
    --cc=W_Armin@gmx.de \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=ilya.gladyshev@linux.dev \
    --cc=kento@kekto.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matias.civadda2342001@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=qby140326@gmail.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®