[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <qf0UI0B6IRDrhWfipl2Yv_LaJN2NsaEhHx8oqzQIvLu0DwDM5xUsVep8so-SE1QyqH1CaXjQXIF7COGUkoCXyI9aoL0u8QLGTZwWGJRPB0w=@protonmail.com>
Date: Sat, 17 Sep 2022 17:11:52 +0000
From: Barnabás Pőcze <pobrn@...tonmail.com>
To: "Luke D. Jones" <luke@...nes.dev>
Cc: hdegoede@...hat.com, markgross@...nel.org,
corentin.chary@...il.com, linux@...ck-us.net, jdelvare@...e.com,
acpi4asus-user@...ts.sourceforge.net,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hwmon@...r.kernel.org
Subject: Re: [PATCH] asus-wmi: Expand support of GPU fan to read RPM and label
Hi
2022. szeptember 16., péntek 2:46 keltezéssel, Luke D. Jones írta:
> The previously added patch to add support for pwm change for TUF laptops
> also is usuable for more than TUF. The same method `0x00110014` is
> used to read the fan RPM.
>
> Add two extra attributes for reading fan2 plus fan2 label.
>
> Signed-off-by: Luke D. Jones <luke@...nes.dev>
> ---
> drivers/platform/x86/asus-wmi.c | 36 +++++++++++++++++++++++++++++++--
> 1 file changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index ae46af731de9..7fe6ce25da0a 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -72,6 +72,7 @@ module_param(fnlock_default, bool, 0444);
> [...]
> +static ssize_t fan2_input_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct asus_wmi *asus = dev_get_drvdata(dev);
> + int value;
> + int ret;
> +
> + ret = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_GPU_FAN_CTRL, &value);
> + if (ret < 0)
> + return ret;
> +
> + value &= 0xffff;
> +
> + return sysfs_emit(buf, "%d\n", value < 0 ? -1 : value * 100);
Can `value` can be negative here? I am not sure because of the `value &= 0xffff` part.
And maybe it would be better to return -ENODATA or something similar instead of printing "-1".
> +}
> [...]
Regards,
Barnabás Pőcze
Powered by blists - more mailing lists