mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] platform/x86: bitland-mifs-wmi: Fix profile handling on Redmi Book Pro 14 2022
@ 2026-09-25  3:20 TuteMthCD
  2026-09-25 11:03 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: TuteMthCD @ 2026-09-25  3:20 UTC (permalink / raw)
  To: hansg, ilpo.jarvinen; +Cc: platform-driver-x86, linux-kernel

On the TIMI Redmi Book Pro 14 2022 (board TM2107), the firmware returns
the current platform profile at byte offset 2 of the WMI response.
The driver instead reads offset 4, which remains zero in the observed
responses. Consequently, profile reads report balanced even after
selecting another mode.

The generic performance capability check also requires a barrel-jack
power supply. This blocks performance selection on this USB-C-only
machine.

Add an exact DMI match for this model to read the profile from offset 2
and require external power without the barrel-jack restriction.

Tested on physical Redmi Book Pro 14 2022 hardware (TM2107),
BIOS RMARB4B0P1010, running Linux 7.2.6-zen2-1-zen.

Assisted-by: Codex:GPT-6
Signed-off-by: TuteMthCD <matias.civadda2342001@gmail.com>
---
 drivers/platform/x86/bitland-mifs-wmi.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index 3a373184519d..c132902bc5f8 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -14,6 +14,7 @@
 #include <linux/dev_printk.h>
 #include <linux/device.h>
 #include <linux/device/devres.h>
+#include <linux/dmi.h>
 #include <linux/err.h>
 #include <linux/hwmon.h>
 #include <linux/init.h>
@@ -38,6 +39,17 @@
 #define BITLAND_MIFS_GUID	"B60BFB48-3E5B-49E4-A0E9-8CFFE1B3434B"
 #define BITLAND_EVENT_GUID	"46C93E13-EE9B-4262-8488-563BCA757FEF"
 
+static const struct dmi_system_id bitland_tm2107_table[] = {
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TIMI"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 14 2022"),
+			DMI_EXACT_MATCH(DMI_BOARD_NAME, "TM2107"),
+		},
+	},
+	{}
+};
+
 enum bitland_mifs_operation {
 	WMI_METHOD_GET	= 250,
 	WMI_METHOD_SET	= 251,
@@ -195,13 +207,18 @@ static int laptop_profile_get(struct device *dev,
 		.function = WMI_FN_SYSTEM_PER_MODE,
 	};
 	struct bitland_mifs_output result;
+	u8 mode;
 	int ret;
 
 	ret = bitland_mifs_wmi_call(data, &input, &result);
 	if (ret)
 		return ret;
 
-	switch (result.data[0]) {
+	/* TM2107 returns the profile in byte 2 instead of byte 4. */
+	mode = dmi_check_system(bitland_tm2107_table) ?
+		result.reserved2 : result.data[0];
+
+	switch (mode) {
 	case WMI_PP_BALANCED:
 		*profile = PLATFORM_PROFILE_BALANCED;
 		break;
@@ -229,6 +246,10 @@ static int bitland_check_performance_capability(struct bitland_mifs_wmi_data *da
 	struct bitland_mifs_output output;
 	int ret;
 
+	/* TM2107 only requires external power, including USB-C. */
+	if (dmi_check_system(bitland_tm2107_table))
+		return power_supply_is_system_supplied() > 0 ? 0 : -EOPNOTSUPP;
+
 	/* Full-speed/performance mode requires DC power (not USB-C) */
 	if (!power_supply_is_system_supplied())
 		return -EOPNOTSUPP;
-- 
2.55.0


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

end of thread, other threads:[~2026-09-25 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25  3:20 [PATCH] platform/x86: bitland-mifs-wmi: Fix profile handling on Redmi Book Pro 14 2022 TuteMthCD
2026-09-25 11:03 ` Ilpo Järvinen

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®