hwmon: (gl518sm) Fix the reported fan speed
PATCH 1/1 hwmon: (gl518sm) Fix the reported fan speed
The fan speeds reported by the gl518sm driver are twice as much as they should. It's currently reporting the number of pulses per minute, not rotations per minute, while typical fans emit two pulses per rotation. This explains why all reports with this driver had very high speed values (between 9000 to 12000 RPM). Odd that nobody ever actually complained about this bug.
--- drivers/hwmon/gl518sm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hwmon/gl518sm.c +3 -3
@@ -96,10 +96,10 @@ static inline u8 FAN_TO_REG(long rpm, inlong rpmdiv;if (rpm =0 )return 0 ; - rpmdiv =SENSORS_LIMIT (rpm,1 ,1920000 ) * div; -return SENSORS_LIMIT ((960000 + rpmdiv /2 ) / rpmdiv,1 ,255 ); + rpmdiv =SENSORS_LIMIT (rpm,1 ,960000 ) * div; +return SENSORS_LIMIT ((480000 + rpmdiv /2 ) / rpmdiv,1 ,255 ); } -#define FAN_FROM_REG (val,div) ((val)=0 ? 0 : (960000/((val)*(div)))) +#define FAN_FROM_REG (val,div) ((val)=0 ? 0 : (480000/((val)*(div))))#define IN_TO_REG (val) (SENSORS_LIMIT((((val)+9)/19),0,255))#define IN_FROM_REG (val) ((val)*19)
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 7 lines · Jean Delvare
The fan speeds reported by the gl518sm driver are twice as much as they should. It's currently reporting the number of pulses per minute, not rotations per minute, while typical fans emit two pulses per rotation. This explains why all reports with this driver had very high speed values (between 9000 to 12000 RPM). Odd that nobody ever actually complained about this bug.
(...)
Hong-Gunn Chew tested the gl518sm driver with my 6 patches applied and reported success.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Jean:
Quoted 11 lines · Jean Delvare
The fan speeds reported by the gl518sm driver are twice as much as they should. It's currently reporting the number of pulses per minute, not rotations per minute, while typical fans emit two pulses per rotation. This explains why all reports with this driver had very high speed values (between 9000 to 12000 RPM). Odd that nobody ever actually complained about this bug.
Signed-off-by Jean Delvare <[email protected]>--- drivers/hwmon/gl518sm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Applied to hwmon-2.6.git/testing, thanks.
Signature · 8 lines
Mark M. Hoffman [email protected] _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors