Skip to contentSkip to conversation

platform/x86: bitland-mifs-wmi: Add Xiaomi Redmi Book Pro 14 2024

PATCH In review Miloš Vlku 2 participants 2 messages Nov 28 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: bitland-mifs-wmi: Add Xiaomi Redmi Book Pro 14 2024

The Redmi Book Pro 14 2024 (board TM2307) uses the same WMAA method (SSDT with OEM Table ID XMCC1806) as the Redmi Book Pro 16 2024 (TM2309) and stores the WMI_FN_SYSTEM_PER_MODE value directly in the EC register QFAN. NTDP in the DSDT maps it onto the DPTF variable ODV1:

  QFAN  mode        ODV1
  1     balanced    0
  2     quiet       2
  3     Turbo       1
  4     full speed  4

Map these as low-power 2, balanced 1, performance 3 and max-power 4. Fn+K only cycles 1 -> 3 -> 2 and never offers full speed, and power-profiles-daemon maps its "performance" profile to platform_profile "performance", so full speed is exposed as max-power and is only used when chosen explicitly.

GET returns QFAN for 1..4 and 0 for anything else, for example a 0 left by the default mapping, so read 0 back as balanced. Writing 0 is not
useful: from the same 80 C start at the same power, the package cooled by 15.2 C in 150 s at QFAN 0 against 29.5 C at QFAN 1 (n=4 each, no overlap).

The firmware also accepts Turbo on battery (QFAN 3 sticks with no charger connected), so add a battery entry for it. WMI_FN_SYSTEM_AC_TYPE is not implemented on this firmware, so skip the AC type check as for the other Xiaomi models.

Values measured on BIOS RMAMT4B0P0B0B (bios_release and ec_firmware_release 1.11).

This change was prepared with an AI coding assistant (Claude, by Anthropic), which read the ACPI tables and driver code and drafted the patch. The values and behaviour were measured on the hardware by the submitter.

---

Notes:
Tested on the TM2307 on top of pdx86 for-next (61c0dac952b9), built for 7.3.6 for the hardware test: all four profiles apply and read back as expected on AC and on battery, a stale QFAN of 0 reads back as balanced, and power-profiles-daemon's power-saver/balanced/performance map to QFAN 2/1/3. Builds cleanly in-tree with W=1.

Anton: when we compared tables in October, the TM2309 matched these on every point, so the same entry should fit with a second DMI match on board_name TM2309. Happy to add it here if you can test it, or for you to send it on top.

 drivers/platform/x86/bitland-mifs-wmi.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/platform/x86/bitland-mifs-wmi.c +23 -0
index f71c93aff..9bf705d4e 100644
@@ -139,6 +139,22 @@ static const struct bitland_mifs_quirks tm2135_quirks = {
 	.skip_ac_type_check = true,
 };
 
+/* GET reports 0 for an out-of-range QFAN value; treat it as balanced. */
+static const struct bitland_profile_entry tm2307_profile_entries[] = {
+	{ PLATFORM_PROFILE_LOW_POWER,	0x02 },
+	{ PLATFORM_PROFILE_BALANCED,	0x01 },
+	{ PLATFORM_PROFILE_BALANCED,	0x00, .no_set = true },
+	{ PLATFORM_PROFILE_PERFORMANCE,	0x03 },
+	{ PLATFORM_PROFILE_PERFORMANCE,	0x03, .battery = true },
+	{ PLATFORM_PROFILE_MAX_POWER,	0x04 },
+};
+
+static const struct bitland_mifs_quirks tm2307_quirks = {
+	.profile_entries = tm2307_profile_entries,
+	.num_profile_entries = ARRAY_SIZE(tm2307_profile_entries),
+	.skip_ac_type_check = true,
+};
+
 static const struct bitland_profile_entry tm2424_profile_entries[] = {
 	{ PLATFORM_PROFILE_LOW_POWER,   0x02 },
 	{ PLATFORM_PROFILE_LOW_POWER,   0x0a, true },
@@ -169,6 +185,13 @@ static const struct dmi_system_id bitland_mifs_dmi_table[] = {
 		},
 		.driver_data = (void *)&tm2135_quirks,
 	},
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "XIAOMI"),
+			DMI_EXACT_MATCH(DMI_BOARD_NAME, "TM2307"),
+		},
+		.driver_data = (void *)&tm2307_quirks,
+	},
 	{
 		.matches = {
 			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "XIAOMI"),
Signature · 1 line
2.56.1
#1 lore raw
Quoted 31 lines · Miloš Vlku

The Redmi Book Pro 14 2024 (board TM2307) uses the same WMAA method (SSDT with OEM Table ID XMCC1806) as the Redmi Book Pro 16 2024 (TM2309) and stores the WMI_FN_SYSTEM_PER_MODE value directly in the EC register QFAN. NTDP in the DSDT maps it onto the DPTF variable ODV1:

   QFAN  mode        ODV1
   1     balanced    0
   2     quiet       2
   3     Turbo       1
   4     full speed  4

Map these as low-power 2, balanced 1, performance 3 and max-power 4. Fn+K only cycles 1 -> 3 -> 2 and never offers full speed, and power-profiles-daemon maps its "performance" profile to platform_profile "performance", so full speed is exposed as max-power and is only used when chosen explicitly.

GET returns QFAN for 1..4 and 0 for anything else, for example a 0 left by the default mapping, so read 0 back as balanced. Writing 0 is not
useful: from the same 80 C start at the same power, the package cooled by 15.2 C in 150 s at QFAN 0 against 29.5 C at QFAN 1 (n=4 each, no overlap).

The firmware also accepts Turbo on battery (QFAN 3 sticks with no charger connected), so add a battery entry for it. WMI_FN_SYSTEM_AC_TYPE is not implemented on this firmware, so skip the AC type check as for the other Xiaomi models.

Values measured on BIOS RMAMT4B0P0B0B (bios_release and ec_firmware_release 1.11).

Quoted 6 lines

This change was prepared with an AI coding assistant (Claude, by Anthropic), which read the ACPI tables and driver code and drafted the patch. The values and behaviour were measured on the hardware by the submitter.

Hi, please make sure the commits are signed by humans.

https://docs.kernel.org/process/coding-assistants.html

Replace with Assisted-by tag instead.

Quoted 23 lines

---

Notes:
Tested on the TM2307 on top of pdx86 for-next (61c0dac952b9), built for 7.3.6 for the hardware test: all four profiles apply and read back as expected on AC and on battery, a stale QFAN of 0 reads back as balanced, and power-profiles-daemon's power-saver/balanced/performance map to QFAN 2/1/3. Builds cleanly in-tree with W=1.

Anton: when we compared tables in October, the TM2309 matched these on every point, so the same entry should fit with a second DMI match on board_name TM2309. Happy to add it here if you can test it, or for you to send it on top.

  drivers/platform/x86/bitland-mifs-wmi.c | 23 +++++++++++++++++++++++
  1 file changed, 23 insertions(+)
drivers/platform/x86/bitland-mifs-wmi.c +0 -0
index f71c93aff..9bf705d4e 100644

drivers/platform/x86/bitland-mifs-wmi.c static const struct bitland_mifs_quirks tm2135_quirks = { · line 142

Quoted 4 lines
drivers/platform/x86/bitland-mifs-wmi.c +1 -0
@@ -139,6 +139,22 @@ static const struct bitland_mifs_quirks tm2135_quirks = {
  	.skip_ac_type_check = true,
  };
 
+/* GET reports 0 for an out-of-range QFAN value; treat it as balanced. */

Please remove the AI slop comment.

Quoted 32 lines
drivers/platform/x86/bitland-mifs-wmi.c +22 -0
+static const struct bitland_profile_entry tm2307_profile_entries[] = {
+	{ PLATFORM_PROFILE_LOW_POWER,	0x02 },
+	{ PLATFORM_PROFILE_BALANCED,	0x01 },
+	{ PLATFORM_PROFILE_BALANCED,	0x00, .no_set = true },
+	{ PLATFORM_PROFILE_PERFORMANCE,	0x03 },
+	{ PLATFORM_PROFILE_PERFORMANCE,	0x03, .battery = true },
+	{ PLATFORM_PROFILE_MAX_POWER,	0x04 },
+};
+
+static const struct bitland_mifs_quirks tm2307_quirks = {
+	.profile_entries = tm2307_profile_entries,
+	.num_profile_entries = ARRAY_SIZE(tm2307_profile_entries),
+	.skip_ac_type_check = true,
+};
+
  static const struct bitland_profile_entry tm2424_profile_entries[] = {
  	{ PLATFORM_PROFILE_LOW_POWER,   0x02 },
  	{ PLATFORM_PROFILE_LOW_POWER,   0x0a, true },
@@ -169,6 +185,13 @@ static const struct dmi_system_id bitland_mifs_dmi_table[] = {
  		},
  		.driver_data = (void *)&tm2135_quirks,
  	},
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "XIAOMI"),
+			DMI_EXACT_MATCH(DMI_BOARD_NAME, "TM2307"),
+		},
+		.driver_data = (void *)&tm2307_quirks,
+	},
  	{
  		.matches = {
  			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "XIAOMI"),