From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796024416; b=OFDBRd2mboGlsjnYxzfQSkYUqGBFwezEVedu11OVSq+sbkp0+kylyGrsPrtCiiWjoEX5 r4dGd7q0lXPMlfLT9+vmwS/7YmM9qAFRvdjeqVVkK8Y6HHmaX5XhsxPyRR6vSwJrtBylY c49Om90qaOjb+2Ax1it8VP6p9hxLzgVXSaj5CNGeZ5R8hO/hTCKHDGSTQAEfxBc+E6hEN wS2QKln1d278gefsQRruuuzSBsObhtyeqWVguRwyPCh0teJ7hcjzq7uBlV9RnXkAzebIt FeKUjfWRD9B5gaTcIH7il0c0kwctS5dG9CZ+F/QOBQCQ4w3gqIk1P7unHJk0qhYN/pQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796024416; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:From:Subject:To:Cc: Content-Language:Content-Type:Content-Transfer-Encoding; bh=vPmLiIsjDHy5VLZcbudFLtSD6hdSZDkTHS32i2kKVa0=; b=fdfj7agy1uKKBqEYhx6O4g++s6AN8ZOfehfKzKHP0vJ0ZS0vN/9ucGg2JgoW4MCZgRch ijIQ09QT7VkV4G7Xj2ofzafplu5rfNBlIwQgGMnxTAQfduyecirafnOidiLLkKPgCb88w Egm6KaD/heozpiD9vUIYiTtStAqXZsWParQWwnr5Fp9oCy4EES0EPBtJTY/HYG3NyQFnz c5nTWukVk6RexlTERCk0gOcoYtYCIJHYpl+f2ECMgbZirOevYW7+A70W4OaA3TeaHuB4O 9WeUrUoMYSXsZEhe04lR36fHyeYGF6/bK/fp9u8WDI5kHE7EtubOBHMov+876YS9gfA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PrHq4rgP; arc=none smtp.remote-ip=209.85.210.181 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72C27606A325 for ; Mon, 30 Nov 2026 07:40:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 72C27606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=PrHq4rgP Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-8b68e59ab33so7358724b3a.2 for ; Sun, 29 Nov 2026 23:40:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796024416; x=1796629216; darn=vger.kernel.org; h=content-transfer-encoding:content-type:content-language:cc:to :subject:from:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=vPmLiIsjDHy5VLZcbudFLtSD6hdSZDkTHS32i2kKVa0=; b=PrHq4rgPQwUCJAlubygMqanMEyBbRIkbDA5hRzXS7W8O19st8Cj/wJnMAY0XUnj6Kq 6dgeBRLQ0pamDyh8H05Ufm6tqh55D/rumXoXi75ml+UIfH58B+PsZG2LF59eaI+/E1Ph yXXnyZWaM3OKdPLlmwMQpnOdKdkDI5e0B6XaLCDYx33K/75bud012n5apGY5E/Ei+HlQ Mcf2YaoJR7dxlPajmxb4arUmOXg6hFHAMz4apFDk3gzgj+fuXikMQ/Q3z8UEVxELL2KO fZt5qgdHDslKenReCGIYCdDkA+YM9XYr7dTwm7MRT3DFmEobi24Aw6b3nfk+BhxqguTE bSAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796024416; x=1796629216; h=content-transfer-encoding:content-type:content-language:cc:to :subject:from:user-agent:mime-version:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=vPmLiIsjDHy5VLZcbudFLtSD6hdSZDkTHS32i2kKVa0=; b=Xx8d624MtABeo1G0GF7tQ7gIUgm+25r0mcKnYac/8Iilzmit4BH31Amt34JxZ8CvMX qWDbYozwOv+QeJnFkmBmiB2sG9F0Blm1LPpdjGD79RqJnnm9Ot13yFNRJLDmcK5k1KFi Zy6gu582aMs4yYzfRW6cuDbea8dDxc8g9MdQmifen0Q/Gz+TVzBBeSFo743EDtTChC42 C3HmZkk/mLl1u5Bsu7Owlgy2sRA51crZpid4m/Q48svvDgVcHMod5UpdQ4jAcJIEZSna nvimu4nTexAIEUJFEYai6ViiTST4iadjVtK+PWlyNSbl5k/C6DL7tVeWSTufJbatEP16 K9Vw== X-Forwarded-Encrypted: i=1; AL+hErEVNVGvkoZOGIBfprJ0VrDsE9PIzRqdpR1UtkIflnlEqbEnFc/BrkurYhRRUgMbT2ElIswiDb0HQJQ=@vger.kernel.org X-Gm-Message-State: APuU4Z+8Z5zgaH3VLIj8r4VjZkzKQzb+ML2LvUjjBubQGV0UlZWw3eoh ydTkDCaqL+nCFFk5G7JITbnEtbjWEEZW67pPCiPb0elCsT1A2gJtduhB X-Gm-Gg: AZFdTZdy1YryNRdGClB5nS5FJMHzAZ/DNjvlv11wZZNlEzlxf51jM8cVprLXCyIPZ7x xkB6hLCiLjIEA0VXjr5Ohf9Jbqp9x2l9IJ7LO6MJt7oJHMYvmZnH6rv8LmqKePLo802uJowCTwe fh6IxqR6gm69ON0cbuS4hRzr23FoGdCu6sqwEL5uZMFIrHjR4+53xq33KHNK8RYpvlISobGVxGB M3FmTxRrdNuzaRT6/n1lNUSzNOqYNkeTNfDuK0muICuADCmQmGXhyX7XTiETWkD6Vz6NfwcB7H7 fE0dxCQuh8wIw/EOfETjIXBzhliHInWTf+R+01/HJSiIFahVtwyZT9bwjnHfZt/nt+/ikZ6cLTi blZiwV73mZ3TUeXOArcMj0XlaVr5Q8MITsDresLoprjX2ftLuD+L3HNBMYQA+AeVUAgKv/+ElNu PIbSPYgsjkuoucjZVVnZRauIJoAq2jqrO0V/3S9ZJ8ZTF7sPC1yBhNRFuAbab3q+C2pYzDD8Qac Sd1vo636zx3+7N7Z383E3xWWB1kNonoB3L0XbGFHwqBKf8qDi3SQNvIqfds1B8yt0BCtHvEyEB3 0elcECI6J3XdHsY3ebJqZ/mbz2hEo1muxXQNkcDfo13BBSqdDgDC2Hp4K8wbSBLmXdbzx2c4m/2 f1N+4jxq3jw== X-Received: by 2002:a05:6a00:138f:b0:8b3:ce6d:8481 with SMTP id d2e1a72fcca58-8c87b4eea9cmr35002018b3a.16.1796024415621; Sun, 29 Nov 2026 23:40:15 -0800 (PST) Received: from ?IPV6:2607:f598:b3da:290:d166:e547:104c:84c3? ([2607:f598:b3da:290:d166:e547:104c:84c3]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c872e485f5sm17398334b3a.22.2026.11.29.23.40.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Nov 2026 23:40:15 -0800 (PST) Message-ID: Date: Sun, 29 Nov 2026 23:40:11 -0800 X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Bozhen Peng Subject: [PATCH v3] platform/x86: bitland-mifs-wmi: Support WUJIE15 PRO HPT To: Mingyou Chen , Ilya Gladyshev Cc: Hans de Goede , Ilpo Jarvinen , Armin Wolf , Randy Dunlap , Jonathan Corbet , platform-driver-x86@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 --- 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