The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bozhen Peng <bozhenpeng93@gmail.com>
To: Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>,
	Mingyou Chen <qby140326@gmail.com>,
	Ilya Gladyshev <ilya.gladyshev@linux.dev>
Cc: Hans de Goede <hansg@kernel.org>, Armin Wolf <W_Armin@gmx.de>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v4 4/4] platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT
Date: Tue, 1 Dec 2026 20:04:14 -0800	[thread overview]
Message-ID: <b0118628-c048-4e01-ad84-5e081977adb2@gmail.com> (raw)
In-Reply-To: <90c6fa9e-6f3a-4618-af97-e39d8daf18ed@gmail.com>

My WUJIE15 PRO HPT uses performance (0), balanced (1) and low-power (2),
which differ from the default mapping.

USB-C is its only external power input. I use the ACPI adapter's _PSR to
check power because the USB-C supply's cached ONLINE value can be stale
after unplugging during suspend. Failed or invalid queries return an error.

HPT reports two fans, in Fan 2/Fan 1 order, and no CPU temperature. I hide
the unsupported GPU mode, keyboard RGB mode and fan-boost controls, while
keeping keyboard backlight brightness available.

Signed-off-by: Bozhen Peng <bozhenpeng93@gmail.com>
---
 drivers/platform/x86/bitland-mifs-wmi.c | 64 +++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index 9fa77e667a1a8ec7e152555fd47a56711e484095..88b35afe02a3ce65d53433387e23b848e4e64d29 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -101,6 +101,9 @@ struct bitland_hwmon_config {
 };
 
 static const struct bitland_hwmon_config default_hwmon_config;
+static const struct bitland_hwmon_config hpt_hwmon_config;
+
+static int bitland_hpt_check_performance_capability(void);
 
 struct bitland_mifs_quirks {
 	const struct bitland_profile_entry *profile_entries;
@@ -151,6 +154,20 @@ static const struct bitland_mifs_quirks tm2424_quirks = {
 	.skip_ac_type_check = true,
 };
 
+static const struct bitland_profile_entry hpt_profile_entries[] = {
+	{ PLATFORM_PROFILE_LOW_POWER,   0x02 },
+	{ PLATFORM_PROFILE_BALANCED,    0x01 },
+	{ PLATFORM_PROFILE_PERFORMANCE, 0x00 },
+};
+
+static const struct bitland_mifs_quirks hpt_quirks = {
+	.profile_entries = hpt_profile_entries,
+	.num_profile_entries = ARRAY_SIZE(hpt_profile_entries),
+	.check_performance_capability = bitland_hpt_check_performance_capability,
+	.hwmon = &hpt_hwmon_config,
+	.disable_extra_controls = true,
+};
+
 static const struct dmi_system_id bitland_mifs_dmi_table[] = {
 	{
 		.matches = {
@@ -166,6 +183,14 @@ static const struct dmi_system_id bitland_mifs_dmi_table[] = {
 		},
 		.driver_data = (void *)&tm2424_quirks,
 	},
+	{
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MECHREVO"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "WUJIE15 PRO"),
+			DMI_EXACT_MATCH(DMI_BOARD_NAME, "WUJIE15 Series-HPT"),
+		},
+		.driver_data = (void *)&hpt_quirks,
+	},
 	{}
 };
 
@@ -355,6 +380,25 @@ static int laptop_profile_get(struct device *dev,
 	return -EINVAL;
 }
 
+static int bitland_hpt_check_performance_capability(void)
+{
+	struct acpi_device *adapter;
+	unsigned long long online;
+	acpi_status status;
+
+	adapter = acpi_dev_get_first_match_dev("ACPI0003", NULL, -1);
+	if (!adapter)
+		return -ENODEV;
+
+	/* USB-C ONLINE may be stale on resume; _PSR reads current EC state. */
+	status = acpi_evaluate_integer(adapter->handle, "_PSR", NULL, &online);
+	acpi_dev_put(adapter);
+	if (ACPI_FAILURE(status) || online > 1)
+		return -EIO;
+
+	return online ? 0 : -EOPNOTSUPP;
+}
+
 static int bitland_pp_check_capability(struct bitland_mifs_wmi_data *data)
 {
 	struct bitland_mifs_input input = {
@@ -572,6 +616,9 @@ static const char * const default_fan_labels[] = {
 	"SYS", /* 2 */
 };
 
+/* The HPT firmware returns Fan 2 before Fan 1. */
+static const char * const hpt_fan_labels[] = { "Fan 2", "Fan 1" };
+
 static const struct bitland_hwmon_config *
 bitland_hwmon_config(const struct bitland_mifs_wmi_data *data)
 {
@@ -642,6 +689,12 @@ static const struct hwmon_channel_info *laptop_hwmon_info[] = {
 	NULL
 };
 
+static const struct hwmon_channel_info *hpt_hwmon_info[] = {
+	HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_LABEL,
+			   HWMON_F_INPUT | HWMON_F_LABEL),
+	NULL
+};
+
 static const struct hwmon_ops laptop_hwmon_ops = {
 	.visible = 0444,
 	.read = laptop_hwmon_read,
@@ -653,12 +706,23 @@ static const struct hwmon_chip_info laptop_chip_info = {
 	.info = laptop_hwmon_info,
 };
 
+static const struct hwmon_chip_info hpt_chip_info = {
+	.ops = &laptop_hwmon_ops,
+	.info = hpt_hwmon_info,
+};
+
 static const struct bitland_hwmon_config default_hwmon_config = {
 	.chip_info = &laptop_chip_info,
 	.fan_labels = default_fan_labels,
 	.num_fans = ARRAY_SIZE(default_fan_labels),
 };
 
+static const struct bitland_hwmon_config hpt_hwmon_config = {
+	.chip_info = &hpt_chip_info,
+	.fan_labels = hpt_fan_labels,
+	.num_fans = ARRAY_SIZE(hpt_fan_labels),
+};
+
 static int laptop_kbd_led_set(struct led_classdev *led_cdev,
 			      enum led_brightness value)
 {

  parent reply	other threads:[~2026-12-02  4:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  4:00 [PATCH v4 0/4] platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT Bozhen Peng
2026-12-02  4:01 ` [PATCH v4 1/4] platform/x86: bitland-mifs-wmi: Allow per-model hwmon configuration Bozhen Peng
2026-12-02  4:02 ` [PATCH v4 2/4] platform/x86: bitland-mifs-wmi: Allow quirks to override the power check Bozhen Peng
2026-12-02  4:03 ` [PATCH v4 3/4] platform/x86: bitland-mifs-wmi: Add a quirk to hide extra controls Bozhen Peng
2026-12-02  5:40   ` Mingyou Chen
2026-12-02  4:04 ` Bozhen Peng [this message]
2026-12-02  5:33   ` [PATCH v4 4/4] platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT 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=b0118628-c048-4e01-ad84-5e081977adb2@gmail.com \
    --to=bozhenpeng93@gmail.com \
    --cc=W_Armin@gmx.de \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=ilya.gladyshev@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --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