mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/4] platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT
@ 2026-12-02  4:00 Bozhen Peng
  2026-12-02  4:01 ` [PATCH v4 1/4] platform/x86: bitland-mifs-wmi: Allow per-model hwmon configuration Bozhen Peng
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bozhen Peng @ 2026-12-02  4:00 UTC (permalink / raw)
  To: Ilpo Jarvinen, Mingyou Chen, Ilya Gladyshev
  Cc: Hans de Goede, Armin Wolf, platform-driver-x86, linux-kernel

Hi Ilpo,

Thanks for the review. I've split out the preparatory changes as you
suggested. HPT support is now in the last patch. The final driver code
is unchanged from v3.

I build-tested each patch with W=1.

Bozhen Peng (4):
  platform/x86: bitland-mifs-wmi: Allow per-model hwmon configuration
  platform/x86: bitland-mifs-wmi: Allow quirks to override the power
    check
  platform/x86: bitland-mifs-wmi: Add a quirk to hide extra controls
  platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT

 drivers/platform/x86/bitland-mifs-wmi.c | 134 ++++++++++++++++++++++--
 1 file changed, 124 insertions(+), 10 deletions(-)


base-commit: 9c82959c37bf69c2ace8a0f975cf2129ec1fd982

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

* [PATCH v4 1/4] platform/x86: bitland-mifs-wmi: Allow per-model hwmon configuration
  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
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Bozhen Peng @ 2026-12-02  4:01 UTC (permalink / raw)
  To: Ilpo Jarvinen, Mingyou Chen, Ilya Gladyshev
  Cc: Hans de Goede, Armin Wolf, platform-driver-x86, linux-kernel

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);

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

* [PATCH v4 2/4] platform/x86: bitland-mifs-wmi: Allow quirks to override the power check
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: Bozhen Peng @ 2026-12-02  4:02 UTC (permalink / raw)
  To: Ilpo Jarvinen, Mingyou Chen, Ilya Gladyshev
  Cc: Hans de Goede, Armin Wolf, platform-driver-x86, linux-kernel

The WUJIE15 PRO HPT needs a different power check before allowing the
performance profile. Add an optional callback to the quirks and keep
the existing check when no callback is provided.

No functional change intended.

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

diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index 04125c602f3bde13426fa463415cdafe0b0d07fe..43f709714edac3d731378349f9fb5cbf6b1fc09b 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -105,6 +105,7 @@ 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;
+	int (*check_performance_capability)(void);
 	const struct bitland_hwmon_config *hwmon;
 
 	bool return_code_at_end;
@@ -362,6 +363,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;
 

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

* [PATCH v4 3/4] platform/x86: bitland-mifs-wmi: Add a quirk to hide extra controls
  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 ` Bozhen Peng
  2 siblings, 0 replies; 4+ messages in thread
From: Bozhen Peng @ 2026-12-02  4:03 UTC (permalink / raw)
  To: Ilpo Jarvinen, Mingyou Chen, Ilya Gladyshev
  Cc: Hans de Goede, Armin Wolf, platform-driver-x86, linux-kernel

The WUJIE15 PRO HPT does not support the GPU mode, keyboard RGB mode
or fan-boost controls. Add a quirk to hide their sysfs attributes.
Existing models keep the same attributes and permissions.

No functional change intended.

Signed-off-by: Bozhen Peng <bozhenpeng93@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 43f709714edac3d731378349f9fb5cbf6b1fc09b..9fa77e667a1a8ec7e152555fd47a56711e484095 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -108,6 +108,7 @@ struct bitland_mifs_quirks {
 	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;
 };
@@ -836,7 +837,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 } },

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

end of thread, other threads:[~2026-12-02  4:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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®