From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej2-f43.google.com (mail-ej2-f43.google.com [74.125.228.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8A034DD3D3 for ; Mon, 28 Sep 2026 15:39:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790609954; cv=none; b=O6tqdJA+phvchDZE728cU/6treWHbcZiJs9wCIndkxRl5BgQkhSQXlD+VeRS/3NckoTS+uva1aa/8n1AGn76jjazftzoIVJbxoDYOwk5a25JASpBuYCt0wPzTv6TCwKZjIw1BZe3qmP/Pt7vOByX8IbwtJ2YhOlnH7Hth8t1F0g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790609954; c=relaxed/simple; bh=n1yrVw6CbTk+e2yXLvZ8PmrFY/8j/hWiTX1+fz0ByQg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pdx005IeMhpOiRRRRD1A8+HnDeNIcAdTcwBlEd0mD8IHTRXhha4C6oz9TRQJN88K9+42Kil92HBA7wqjZEimQxlpb7jU3NA+AKhdVl0o7XnVYdyNjrznTPfKTAgnXPDKOXet8W9vtt3dEc1r8LoXaUqYZvaIdA9+7D7r8ffiCLg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=miget.com; spf=pass smtp.mailfrom=miget.com; dkim=pass (1024-bit key) header.d=miget.com header.i=@miget.com header.b=DilsuCrN; arc=none smtp.client-ip=74.125.228.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=miget.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=miget.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=miget.com header.i=@miget.com header.b="DilsuCrN" Received: by mail-ej2-f43.google.com with SMTP id a640c23a62f3a-c2af7721e4aso406688766b.1 for ; Mon, 28 Sep 2026 08:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=miget.com; s=google; t=1790609951; x=1791214751; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=kWvYSe8kW5lJCuL2xTq1KXQt5geh1d6a3q69HD71LA0=; b=DilsuCrNECn7/AOaQjCXOh9zdgegGHhfKcd7hL3aRvEQc+npOX2dfuKfc1eR4rSOip AVu0QvroETCkSqsfrrlV2iR8Bu85Xr+7tcOi+okqUApcRF7HxTs3ahgiVLY8yJixHkW5 o9CgzinNNuwJjKxhsi0Cu5KX0e5pEWPDWkWp4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790609951; x=1791214751; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kWvYSe8kW5lJCuL2xTq1KXQt5geh1d6a3q69HD71LA0=; b=QqW5gPs1UdyNi1i9F3DhGoLKJV8OwpeWmo0khxEKDmsd+qUnE7lkAT97j0flUTgzho a+3LFFXoDHYtBVKH3GeHeMJ/LKatZcahANi4w6FkBaGn0gNaq8JcpBx6aO7nkxHOc+Xj ug35Mn9uZC7Egq4P8x7Zv+iqh4QD6xvbVrEkEOUY4H0zp+v1V1CecfbgUL8xM6kJgsQa 00U+0agIApCG6pRr1Yj9FzM6WyDdACHgps7bELp0PVbIpQf4H1AXFCNrT6XkwLz8kv2T Je2XT3+3haTXo32YYc6NzsR/GhrdxDjSz+LR1qpm3AiaBNYuvQWotTOos4i+GnzxKdyj JsnQ== X-Gm-Message-State: AFuF++lE8JYmhCaIg67T0qZuNx8kJOCcFWEuBSZzgvLGRy86GN017gU8 01RE9WsCn7RmTtajIpm4COtS3jhTlNQhdLfuI1sZOdkLW6Ji/QXbdlTw+r4ih1t3FSQ= X-Gm-Gg: AYBFou060hCLDh0ResDtAeWpQDwHugic/t+OPy0f0N7QFn9MBDLn7eRhYbIdmma25DU tEK+VScY+DI5Q9NhESxWuoyBlmYtoKlQRo5v18HVJfj1DApBLFKpxrars1rPApD3ClCvpK6ymo0 UiQt+6dNRLfMYbQL8Zkh90oIP3dhzBeSEsjYcU+LAn+qgij2l9b4tIFK25YnDcZ8nof8ssU+7E9 zmUbQkaJerWL6KDMD652UyQFFoyqbptlbsk0yC4kLnV7pSr5IrlGGn1XLoyg3I+Z0sZoso4gm/N /vZWDkKznveQ16g7apWxXsUeVnD/04GvoIzK25xy7kpUEliStF9XqM7lSvXigwLyWc953swHYBh 0CGi/BhDhFs0fRyWDhjZAZXx06plY2OxGUpYslVtGO0zLtWyQ0oo9TQHeNmI0mMzUDViCvsjDbw kQIc/wu4gjCrDR1fcq2mnI2hO2Y5su52lcsEy3eY23t6xVIia6VlsgwGI73+Mj7Lz5AqcPtoX8j FO9dY+PHrlMcd6zG6HhF8uur7LEeF0= X-Received: by 2002:a17:907:db18:b0:c21:180c:d82d with SMTP id a640c23a62f3a-c2ac242d173mr1174805466b.20.1790609950732; Mon, 28 Sep 2026 08:39:10 -0700 (PDT) Received: from xia (user-31-175-132-26.play-internet.pl. [31.175.132.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2af70056bbsm415974066b.49.2026.09.28.08.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2026 08:39:10 -0700 (PDT) From: Chris Taraszka To: Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Taraszka , Armin Wolf , Mingyou Chen Subject: [PATCH] platform/x86: bitland-mifs-wmi: Add Xiaomi Book Pro 14 platform profile values Date: Mon, 28 Sep 2026 17:39:02 +0200 Message-ID: <20260928153902.139956-1-chris@miget.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The Xiaomi Book Pro 14 firmware (BIOS XMAPT4B0P0909) implements SystemPerMode with its own values. Its WMAA SET handler only acts on 0x02-0x0a and silently ignores 0 and 1, and GET returns one of 0x02, 0x03, 0x04, 0x09 or 0x0a. With the generic values: - balanced (0) and balanced-performance (1) are no-ops, - performance (3) selects the firmware's balanced mode, - reading the profile fails with -EINVAL whenever the firmware is in 0x04, 0x09 or 0x0a, which it often is after boot. The failed read also makes bitland_mifs_wmi_suspend() abort system suspend. The values were identified from the WMAA method in the firmware's SSDT and by setting each one through WMAA on AC and reading the resulting sustained package power limit from intel-rapl-mmio: 0x02 18 W (quiet) 0x03 37 W (balanced) 0x09 45 W 0x04 58 W (performance) 0x0a 18 W Map low-power, balanced, balanced-performance and performance to 0x02, 0x03, 0x09 and 0x04 on this model. The driver never sets 0x0a, which is only reached through the firmware's own mode cycling, so report it as low-power. Cc: Armin Wolf Cc: Mingyou Chen Signed-off-by: Chris Taraszka --- Notes: Tested on the Xiaomi Book Pro 14 on AC with bitland-mifs-wmi from pdx86 for-next plus this patch, loaded on v7.3-rc5: all four profiles apply through power-profiles-daemon and the firmware mode and PL1 follow (0x03/37 W, 0x02/25 W, 0x04/56 W). The same mapping on v7.3-rc4/rc5 without the for-next changes was also tested on battery and across s2idle suspend/resume, with the profile restored on resume. This explains the -EINVAL behind my earlier "platform/x86: bitland-mifs-wmi: Don't abort suspend when platform profile access fails" (sent 2026-09-11): the profile read failed because of the unknown mode values. That patch is still useful as a safety net. Note that on for-next each profile change still reports -ENOMSG even though the firmware applies it: this firmware's SET handlers leave the function id in the response at 0, which 23cc56f6dea6 ("platform/x86: bitland-mifs-wmi: Detect failed function calls") rejects. I'll send a separate fix for that. drivers/platform/x86/bitland-mifs-wmi.c | 56 +++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c index dd1648b7de77..4a8e5b4e7853 100644 --- a/drivers/platform/x86/bitland-mifs-wmi.c +++ b/drivers/platform/x86/bitland-mifs-wmi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -79,6 +80,29 @@ enum bitland_mifs_power_profile { WMI_PP_FULL_SPEED = 3, }; +/* + * The Xiaomi Book Pro 14 firmware uses its own SystemPerMode values and + * ignores the ones above. Sustained package power limits (PL1) measured + * on AC are noted next to each mode. + */ +enum bitland_mifs_xiaomi_power_profile { + WMI_PP_XIAOMI_QUIET = 0x02, /* 18 W */ + WMI_PP_XIAOMI_BALANCED = 0x03, /* 37 W */ + WMI_PP_XIAOMI_PERFORMANCE = 0x04, /* 58 W */ + WMI_PP_XIAOMI_SMART = 0x09, /* 45 W */ + WMI_PP_XIAOMI_QUIET_ALT = 0x0a, /* 18 W */ +}; + +static const struct dmi_system_id bitland_mifs_xiaomi_pp_dmi_table[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "XIAOMI"), + DMI_MATCH(DMI_PRODUCT_NAME, "Xiaomi Book Pro 14"), + }, + }, + { } +}; + enum bitland_mifs_event_id { WMI_EVENT_RESERVED_1 = 1, WMI_EVENT_RESERVED_2 = 2, @@ -161,6 +185,7 @@ struct bitland_mifs_wmi_data { struct device *hwmon_dev; struct device *pp_dev; enum platform_profile_option saved_profile; + bool xiaomi_pp; }; static int bitland_mifs_wmi_call(struct bitland_mifs_wmi_data *data, @@ -213,6 +238,27 @@ static int laptop_profile_get(struct device *dev, if (ret) return ret; + if (data->xiaomi_pp) { + switch (result.data[0]) { + case WMI_PP_XIAOMI_QUIET: + case WMI_PP_XIAOMI_QUIET_ALT: + *profile = PLATFORM_PROFILE_LOW_POWER; + break; + case WMI_PP_XIAOMI_BALANCED: + *profile = PLATFORM_PROFILE_BALANCED; + break; + case WMI_PP_XIAOMI_SMART: + *profile = PLATFORM_PROFILE_BALANCED_PERFORMANCE; + break; + case WMI_PP_XIAOMI_PERFORMANCE: + *profile = PLATFORM_PROFILE_PERFORMANCE; + break; + default: + return -EINVAL; + } + return 0; + } + switch (result.data[0]) { case WMI_PP_BALANCED: *profile = PLATFORM_PROFILE_BALANCED; @@ -272,22 +318,22 @@ static int laptop_profile_set(struct device *dev, switch (profile) { case PLATFORM_PROFILE_LOW_POWER: - val = WMI_PP_QUIET; + val = data->xiaomi_pp ? WMI_PP_XIAOMI_QUIET : WMI_PP_QUIET; break; case PLATFORM_PROFILE_BALANCED: - val = WMI_PP_BALANCED; + val = data->xiaomi_pp ? WMI_PP_XIAOMI_BALANCED : WMI_PP_BALANCED; break; case PLATFORM_PROFILE_BALANCED_PERFORMANCE: ret = bitland_check_performance_capability(data); if (ret) return ret; - val = WMI_PP_PERFORMANCE; + val = data->xiaomi_pp ? WMI_PP_XIAOMI_SMART : WMI_PP_PERFORMANCE; break; case PLATFORM_PROFILE_PERFORMANCE: ret = bitland_check_performance_capability(data); if (ret) return ret; - val = WMI_PP_FULL_SPEED; + val = data->xiaomi_pp ? WMI_PP_XIAOMI_PERFORMANCE : WMI_PP_FULL_SPEED; break; default: return -EOPNOTSUPP; @@ -699,6 +745,8 @@ static int bitland_mifs_wmi_probe(struct wmi_device *wdev, const void *context) return input_register_device(drv_data->input_dev); } + drv_data->xiaomi_pp = dmi_check_system(bitland_mifs_xiaomi_pp_dmi_table); + /* Register platform profile */ drv_data->pp_dev = devm_platform_profile_register(&wdev->dev, DRV_NAME, drv_data, &laptop_profile_ops); base-commit: fe5030c8cc7156223f48530e9b49aa87c0305bcd -- 2.55.0