From: Bozhen Peng <bozhenpeng93@gmail.com>
To: Mingyou Chen <qby140326@gmail.com>,
Ilya Gladyshev <ilya.gladyshev@linux.dev>
Cc: Hans de Goede <hansg@kernel.org>,
Ilpo Jarvinen <ilpo.jarvinen@linux.intel.com>,
Armin Wolf <W_Armin@gmx.de>, Randy Dunlap <rdunlap@infradead.org>,
Jonathan Corbet <corbet@lwn.net>,
platform-driver-x86@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v3] platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT
Date: Sun, 29 Nov 2026 23:40:11 -0800 [thread overview]
Message-ID: <eb0668d7-7332-4280-92e7-eceb3ed89a01@gmail.com> (raw)
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.
Link: https://lkml.iu.edu/hypermail/linux/kernel/2611.2/17183.html
Signed-off-by: Bozhen Peng <bozhenpeng93@gmail.com>
---
Thanks everyone for your work, and Mingyou for the reminder! I've ported
the WUJIE15 PRO HPT support to the new quirks framework.
Changes in v3:
- Use the existing quirks table on the post-merge pdx86/for-next base,
as Mingyou suggested.
- Drop the redmi-wmi change now that the drivers have been merged.
- Drop the model-specific documentation section.
I built the x86-64 kernel and modules and booted the matching 7.4.0-rc2
kernel on my WUJIE15 PRO HPT. I checked that the Bitland profile choices
are low-power, balanced and performance.
I tested s2idle resume. It kept performance with the charger connected
and restored balanced after I unplugged the charger during sleep.
drivers/platform/x86/bitland-mifs-wmi.c | 134 +++++++++++++++++++++++++++++---
1 file changed, 124 insertions(+), 10 deletions(-)
diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index 7bad8942249d43bd378d7adf8da26261fd684df7..88b35afe02a3ce65d53433387e23b848e4e64d29 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -94,10 +94,24 @@ struct bitland_profile_entry {
bool battery; /* Set in place of the AC entry while on battery */
};
+struct bitland_hwmon_config {
+ const struct hwmon_chip_info *chip_info;
+ const char * const *fan_labels;
+ size_t num_fans;
+};
+
+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;
size_t num_profile_entries;
+ int (*check_performance_capability)(void);
+ const struct bitland_hwmon_config *hwmon;
+ bool disable_extra_controls;
bool return_code_at_end;
bool skip_ac_type_check;
};
@@ -140,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 = {
@@ -155,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,
+ },
{}
};
@@ -344,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 = {
@@ -353,6 +408,9 @@ static int bitland_pp_check_capability(struct bitland_mifs_wmi_data *data)
struct bitland_mifs_output_head_rc output;
int ret;
+ if (data->quirks->check_performance_capability)
+ return data->quirks->check_performance_capability();
+
if (data->quirks->skip_ac_type_check)
return power_supply_is_system_supplied() > 0 ? 0 : -EOPNOTSUPP;
@@ -552,12 +610,21 @@ static const struct platform_profile_ops laptop_profile_ops = {
.profile_set = laptop_profile_set,
};
-static const char *const fan_labels[] = {
+static const char * const default_fan_labels[] = {
"CPU", /* 0 */
"GPU", /* 1 */
"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)
+{
+ return data->quirks->hwmon ?: &default_hwmon_config;
+}
+
static int laptop_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *val)
{
@@ -603,13 +670,15 @@ static int laptop_hwmon_read_string(struct device *dev,
enum hwmon_sensor_types type, u32 attr,
int channel, const char **str)
{
- if (type == hwmon_fan && attr == hwmon_fan_label) {
- if (channel >= 0 && channel < ARRAY_SIZE(fan_labels)) {
- *str = fan_labels[channel];
- return 0;
- }
- }
- return -EINVAL;
+ struct bitland_mifs_wmi_data *data = dev_get_drvdata(dev);
+ const struct bitland_hwmon_config *config = bitland_hwmon_config(data);
+
+ if (type != hwmon_fan || attr != hwmon_fan_label ||
+ channel < 0 || channel >= config->num_fans)
+ return -EINVAL;
+
+ *str = config->fan_labels[channel];
+ return 0;
}
static const struct hwmon_channel_info *laptop_hwmon_info[] = {
@@ -620,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,
@@ -631,6 +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)
{
@@ -809,7 +901,27 @@ static const struct attribute *const laptop_attrs[] = {
&dev_attr_fan_boost.attr,
NULL,
};
-ATTRIBUTE_GROUPS(laptop);
+
+static umode_t laptop_attr_is_visible(struct kobject *kobj,
+ const struct attribute *attr, int n)
+{
+ struct bitland_mifs_wmi_data *data = dev_get_drvdata(kobj_to_dev(kobj));
+
+ if (data->quirks->disable_extra_controls)
+ return 0;
+
+ return attr->mode;
+}
+
+static const struct attribute_group laptop_group = {
+ .attrs_const = laptop_attrs,
+ .is_visible_const = laptop_attr_is_visible,
+};
+
+static const struct attribute_group *laptop_groups[] = {
+ &laptop_group,
+ NULL
+};
static const struct key_entry bitland_mifs_wmi_keymap[] = {
{ KE_KEY, BI_HOTKEY_CODE(WMI_EVENT_OPEN_APP, 1, 0), { KEY_PROG1 } },
@@ -900,6 +1012,7 @@ static int bitland_notifier_callback(struct notifier_block *nb,
static int bitland_mifs_wmi_probe(struct wmi_device *wdev, const void *context)
{
+ const struct bitland_hwmon_config *hwmon;
struct bitland_mifs_wmi_data *drv_data;
enum bitland_wmi_device_type dev_type =
(enum bitland_wmi_device_type)(unsigned long)context;
@@ -971,10 +1084,11 @@ static int bitland_mifs_wmi_probe(struct wmi_device *wdev, const void *context)
}
/* Register hwmon */
+ hwmon = bitland_hwmon_config(drv_data);
drv_data->hwmon_dev = devm_hwmon_device_register_with_info(&wdev->dev,
"bitland_mifs",
drv_data,
- &laptop_chip_info,
+ hwmon->chip_info,
NULL);
if (IS_ERR(drv_data->hwmon_dev))
return PTR_ERR(drv_data->hwmon_dev);
base-commit: 9c82959c37bf69c2ace8a0f975cf2129ec1fd982
next reply other threads:[~2026-11-30 7:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 7:40 Bozhen Peng [this message]
2026-11-30 12:04 ` [PATCH v3] platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT Ilpo Järvinen
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=eb0668d7-7332-4280-92e7-eceb3ed89a01@gmail.com \
--to=bozhenpeng93@gmail.com \
--cc=W_Armin@gmx.de \
--cc=corbet@lwn.net \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=ilya.gladyshev@linux.dev \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=qby140326@gmail.com \
--cc=rdunlap@infradead.org \
/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