linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: fix corsair-psu fan rpm calculation
@ 2020-11-13 12:19 Wilken Gottwalt
  2020-11-13 14:39 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Wilken Gottwalt @ 2020-11-13 12:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jean Delvare, Guenter Roeck, Jonathan Corbet, linux-hwmon

The correct fan rpm value is also a LINEAR11 value but without a factor.
Verified by using the fan test button on the psu to let the fan spin up
to maximum for some seconds.

Fixes: 933222c98445 ("hwmon: (corsair-psu) fix unintentional sign extension issue")
Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
---
 drivers/hwmon/corsair-psu.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
index 5d19a888231a..99494056f4bd 100644
--- a/drivers/hwmon/corsair-psu.c
+++ b/drivers/hwmon/corsair-psu.c
@@ -252,12 +252,7 @@ static int corsairpsu_get_value(struct corsairpsu_data *priv, u8 cmd, u8 rail, l
 		*val = corsairpsu_linear11_to_int(tmp & 0xFFFF) * 1000;
 		break;
 	case PSU_CMD_FAN:
-		/*
-		 * this value is best guess, so the calculated value could be wrong, it is hard
-		 * to ge the fan to spin in these semi-passive power supplies, which need a
-		 * quite high load to do so
-		 */
-		*val = ((tmp & 0xFF) << 8) + ((tmp >> 8) & 0xFF);
+		*val = corsairpsu_linear11_to_int(tmp & 0xFFFF);
 		break;
 	case PSU_CMD_RAIL_WATTS:
 	case PSU_CMD_TOTAL_WATTS:
-- 
2.29.2


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

* Re: [PATCH] hwmon: fix corsair-psu fan rpm calculation
  2020-11-13 12:19 [PATCH] hwmon: fix corsair-psu fan rpm calculation Wilken Gottwalt
@ 2020-11-13 14:39 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-11-13 14:39 UTC (permalink / raw)
  To: Wilken Gottwalt; +Cc: linux-kernel, Jean Delvare, Jonathan Corbet, linux-hwmon

On Fri, Nov 13, 2020 at 01:19:54PM +0100, Wilken Gottwalt wrote:
> The correct fan rpm value is also a LINEAR11 value but without a factor.
> Verified by using the fan test button on the psu to let the fan spin up
> to maximum for some seconds.
> 
> Fixes: 933222c98445 ("hwmon: (corsair-psu) fix unintentional sign extension issue")
> Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/corsair-psu.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/hwmon/corsair-psu.c b/drivers/hwmon/corsair-psu.c
> index 5d19a888231a..99494056f4bd 100644
> --- a/drivers/hwmon/corsair-psu.c
> +++ b/drivers/hwmon/corsair-psu.c
> @@ -252,12 +252,7 @@ static int corsairpsu_get_value(struct corsairpsu_data *priv, u8 cmd, u8 rail, l
>  		*val = corsairpsu_linear11_to_int(tmp & 0xFFFF) * 1000;
>  		break;
>  	case PSU_CMD_FAN:
> -		/*
> -		 * this value is best guess, so the calculated value could be wrong, it is hard
> -		 * to ge the fan to spin in these semi-passive power supplies, which need a
> -		 * quite high load to do so
> -		 */
> -		*val = ((tmp & 0xFF) << 8) + ((tmp >> 8) & 0xFF);
> +		*val = corsairpsu_linear11_to_int(tmp & 0xFFFF);
>  		break;
>  	case PSU_CMD_RAIL_WATTS:
>  	case PSU_CMD_TOTAL_WATTS:

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

end of thread, other threads:[~2020-11-13 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 12:19 [PATCH] hwmon: fix corsair-psu fan rpm calculation Wilken Gottwalt
2020-11-13 14:39 ` Guenter Roeck

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