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 1/4] platform/x86: bitland-mifs-wmi: Allow per-model hwmon configuration
Date: Tue, 1 Dec 2026 20:01:13 -0800 [thread overview]
Message-ID: <e6e0fe1e-4375-4857-89bd-6527b55fab5b@gmail.com> (raw)
In-Reply-To: <90c6fa9e-6f3a-4618-af97-e39d8daf18ed@gmail.com>
The WUJIE15 PRO HPT has two fans and no CPU temperature reading.
Move the hwmon chip info and fan labels into a per-model configuration
so its sensor layout can be added separately. Keep the current layout
as the default.
No functional change intended.
Signed-off-by: Bozhen Peng <bozhenpeng93@gmail.com>
---
drivers/platform/x86/bitland-mifs-wmi.c | 43 +++++++++++++++++++------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index 7bad8942249d43bd378d7adf8da26261fd684df7..04125c602f3bde13426fa463415cdafe0b0d07fe 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -94,9 +94,18 @@ 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;
+
struct bitland_mifs_quirks {
const struct bitland_profile_entry *profile_entries;
size_t num_profile_entries;
+ const struct bitland_hwmon_config *hwmon;
bool return_code_at_end;
bool skip_ac_type_check;
@@ -552,12 +561,18 @@ 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 */
};
+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 +618,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[] = {
@@ -631,6 +648,12 @@ static const struct hwmon_chip_info laptop_chip_info = {
.info = laptop_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 int laptop_kbd_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
@@ -900,6 +923,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 +995,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);
next prev parent reply other threads:[~2026-12-02 4:01 UTC|newest]
Thread overview: 5+ 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 ` Bozhen Peng [this message]
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 4:04 ` [PATCH v4 4/4] platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT Bozhen Peng
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=e6e0fe1e-4375-4857-89bd-6527b55fab5b@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
all inboxes | Powered by JetHome®