[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D9TQ4OLSV5U7.1NJ2JIKUN6QR3@gmail.com>
Date: Sun, 11 May 2025 20:35:30 -0300
From: "Kurt Borja" <kuurtb@...il.com>
To: "Antheas Kapenekakis" <lkml@...heas.dev>,
<platform-driver-x86@...r.kernel.org>
Cc: "Armin Wolf" <W_Armin@....de>, "Jonathan Corbet" <corbet@....net>, "Hans
de Goede" <hdegoede@...hat.com>, Ilpo Järvinen
<ilpo.jarvinen@...ux.intel.com>, "Jean Delvare" <jdelvare@...e.com>,
"Guenter Roeck" <linux@...ck-us.net>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-hwmon@...r.kernel.org>
Subject: Re: [PATCH v1 08/10] platform/x86: msi-wmi-platform: Drop excess
fans in dual fan devices
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@...heas.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);
> }
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists