Skip to contentSkip to conversation

hwmon: fix corsair-psu fan rpm calculation

PATCH Applied Wilken Gottwalt 2 participants 2 messages Nov 13, 2020

Subsystems (2)
lore
Share & tools
lore

Wilken Gottwalt

author maintainer
#0 lore raw

PATCH 1/1 hwmon: fix corsair-psu fan rpm calculation

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")
---
 drivers/hwmon/corsair-psu.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/hwmon/corsair-psu.c +1 -6
index 5d19a888231a..99494056f4bd 100644
@@ -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:
Signature · 1 line
2.29.2
maintainer Applied
#1 lore raw
Quoted 6 lines · Wilken Gottwalt

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

Applied.

Thanks,
Guenter

Quoted 22 lines
---
 drivers/hwmon/corsair-psu.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/hwmon/corsair-psu.c +1 -6
index 5d19a888231a..99494056f4bd 100644
@@ -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: