From: "Kurt Borja" <kuurtb@gmail.com>
To: "Antheas Kapenekakis" <lkml@antheas.dev>,
<platform-driver-x86@vger.kernel.org>
Cc: "Armin Wolf" <W_Armin@gmx.de>, "Jonathan Corbet" <corbet@lwn.net>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Jean Delvare" <jdelvare@suse.com>,
"Guenter Roeck" <linux@roeck-us.net>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v1 08/10] platform/x86: msi-wmi-platform: Drop excess fans in dual fan devices
Date: Sun, 11 May 2025 20:35:30 -0300 [thread overview]
Message-ID: <D9TQ4OLSV5U7.1NJ2JIKUN6QR3@gmail.com> (raw)
In-Reply-To: <20250511204427.327558-9-lkml@antheas.dev>
[-- Attachment #1: Type: text/plain, Size: 3221 bytes --]
On Sun May 11, 2025 at 5:44 PM -03, Antheas Kapenekakis wrote:
> Currently, the platform driver always exposes 4 fans, since the
> underlying WMI interface reads 4 values from the EC. However, most
> devices only have two fans. Therefore, at least in the case of the
> Claw series, quirk the driver to only show two hwmon fans.
>
> Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
> ---
> drivers/platform/x86/msi-wmi-platform.c | 28 ++++++++++++++++++++++---
> 1 file changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/msi-wmi-platform.c b/drivers/platform/x86/msi-wmi-platform.c
> index 46928fb4da8a6..eaf0eb25e349b 100644
> --- a/drivers/platform/x86/msi-wmi-platform.c
> +++ b/drivers/platform/x86/msi-wmi-platform.c
> @@ -121,6 +121,7 @@ enum msi_wmi_platform_method {
> struct msi_wmi_platform_quirk {
> bool shift_mode; /* Shift mode is supported */
> bool charge_threshold; /* Charge threshold is supported */
> + bool dual_fans; /* For devices with two hwmon fans */
> int pl_min; /* Minimum PLx value */
> int pl1_max; /* Maximum PL1 value */
> int pl2_max; /* Maximum PL2 value */
> @@ -216,6 +217,7 @@ static struct msi_wmi_platform_quirk quirk_default = {};
> static struct msi_wmi_platform_quirk quirk_gen1 = {
> .shift_mode = true,
> .charge_threshold = true,
> + .dual_fans = true,
> .pl_min = 8,
> .pl1_max = 43,
> .pl2_max = 45
> @@ -223,6 +225,7 @@ static struct msi_wmi_platform_quirk quirk_gen1 = {
> static struct msi_wmi_platform_quirk quirk_gen2 = {
> .shift_mode = true,
> .charge_threshold = true,
> + .dual_fans = true,
> .pl_min = 8,
> .pl1_max = 30,
> .pl2_max = 37
> @@ -635,6 +638,23 @@ static const struct hwmon_chip_info msi_wmi_platform_chip_info = {
> .info = msi_wmi_platform_info,
> };
>
> +static const struct hwmon_channel_info * const msi_wmi_platform_info_dual[] = {
> + HWMON_CHANNEL_INFO(fan,
> + HWMON_F_INPUT,
> + HWMON_F_INPUT
> + ),
> + HWMON_CHANNEL_INFO(pwm,
> + HWMON_PWM_ENABLE,
> + HWMON_PWM_ENABLE
> + ),
> + NULL
> +};
> +
> +static const struct hwmon_chip_info msi_wmi_platform_chip_info_dual = {
> + .ops = &msi_wmi_platform_ops,
> + .info = msi_wmi_platform_info_dual,
> +};
> +
> static int msi_wmi_platform_profile_probe(void *drvdata, unsigned long *choices)
> {
> set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
> @@ -1227,9 +1247,11 @@ static int msi_wmi_platform_hwmon_init(struct msi_wmi_platform_data *data)
> {
> struct device *hdev;
>
> - hdev = devm_hwmon_device_register_with_info(&data->wdev->dev, "msi_wmi_platform", data,
> - &msi_wmi_platform_chip_info,
> - msi_wmi_platform_hwmon_groups);
> + hdev = devm_hwmon_device_register_with_info(
> + &data->wdev->dev, "msi_wmi_platform", data,
> + data->quirks->dual_fans ? &msi_wmi_platform_chip_info_dual :
> + &msi_wmi_platform_chip_info,
This is the wrong approach.
Add the quirk and control visibility from msi_wmi_platform_is_visible(),
like I mentioned in the cover-letter.
--
~ Kurt
> + msi_wmi_platform_hwmon_groups);
>
> return PTR_ERR_OR_ZERO(hdev);
> }
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-05-11 23:35 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-11 20:44 [PATCH v1 00/10] platform/x86: msi-wmi-platform: Add fan curves/platform profile/tdp/battery limiting Antheas Kapenekakis
2025-05-11 20:44 ` [PATCH v1 01/10] platform/x86: msi-wmi-platform: Use input buffer for returning result Antheas Kapenekakis
2025-05-11 23:31 ` Kurt Borja
2025-05-13 19:42 ` Armin Wolf
2025-05-11 20:44 ` [PATCH v1 02/10] platform/x86: msi-wmi-platform: Add unlocked msi_wmi_platform_query Antheas Kapenekakis
2025-05-12 19:21 ` Kurt Borja
2025-05-12 20:51 ` Antheas Kapenekakis
2025-05-12 21:23 ` Kurt Borja
2025-05-12 21:51 ` Antheas Kapenekakis
2025-05-13 19:45 ` Armin Wolf
2025-05-13 19:47 ` Armin Wolf
2025-05-11 20:44 ` [PATCH v1 03/10] platform/x86: msi-wmi-platform: Add quirk system Antheas Kapenekakis
2025-05-11 23:32 ` Kurt Borja
2025-05-13 20:43 ` Armin Wolf
2025-05-11 20:44 ` [PATCH v1 04/10] platform/x86: msi-wmi-platform: Add support for fan control Antheas Kapenekakis
2025-05-11 23:32 ` Kurt Borja
2025-05-13 20:58 ` Armin Wolf
2025-05-19 1:35 ` Armin Wolf
2025-05-11 20:44 ` [PATCH v1 05/10] platform/x86: msi-wmi-platform: Add platform profile through shift mode Antheas Kapenekakis
2025-05-11 23:33 ` Kurt Borja
2025-05-12 21:59 ` Antheas Kapenekakis
2025-05-19 1:51 ` Armin Wolf
2025-05-19 1:58 ` Armin Wolf
2025-05-11 20:44 ` [PATCH v1 06/10] platform/x86: msi-wmi-platform: Add PL1/PL2 support via firmware attributes Antheas Kapenekakis
2025-05-11 23:34 ` Kurt Borja
2025-05-12 10:22 ` Antheas Kapenekakis
2025-05-19 2:08 ` Armin Wolf
2025-05-11 20:44 ` [PATCH v1 07/10] platform/x86: msi-wmi-platform: Add charge_threshold support Antheas Kapenekakis
2025-05-11 23:34 ` Kurt Borja
2025-05-19 2:32 ` Armin Wolf
2025-05-11 20:44 ` [PATCH v1 08/10] platform/x86: msi-wmi-platform: Drop excess fans in dual fan devices Antheas Kapenekakis
2025-05-11 23:35 ` Kurt Borja [this message]
2025-05-11 20:44 ` [PATCH v1 09/10] platform/x86: msi-wmi-platform: Update header text Antheas Kapenekakis
2025-05-19 2:33 ` Armin Wolf
2025-05-11 20:44 ` [PATCH v1 10/10] platform/x86: msi-wmi-platform: Restore fan curves on PWM disable and unload Antheas Kapenekakis
2025-05-12 19:16 ` Kurt Borja
2025-05-12 20:50 ` Antheas Kapenekakis
2025-05-11 23:30 ` [PATCH v1 00/10] platform/x86: msi-wmi-platform: Add fan curves/platform profile/tdp/battery limiting Kurt Borja
2025-05-12 10:16 ` Antheas Kapenekakis
2025-05-12 19:05 ` Kurt Borja
2025-05-19 2:37 ` Armin Wolf
2025-05-30 20:50 ` Antheas Kapenekakis
2025-05-30 21:15 ` Armin Wolf
2025-05-30 21:28 ` Antheas Kapenekakis
2025-05-30 22:00 ` Armin Wolf
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=D9TQ4OLSV5U7.1NJ2JIKUN6QR3@gmail.com \
--to=kuurtb@gmail.com \
--cc=W_Armin@gmx.de \
--cc=corbet@lwn.net \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jdelvare@suse.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lkml@antheas.dev \
--cc=platform-driver-x86@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).