hwmon: (w83l768ng) Fix fan speed control range
authorJean Delvare <khali@linux-fr.org>
Thu, 12 Dec 2013 07:05:32 +0000 (08:05 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 3 Jan 2014 04:33:30 +0000 (04:33 +0000)
commit362ab737e651f41282a979b9275717537b99451d
treecba0bc2937b3ae4b722261ebc7c1ccac41ed345c
parent22b6374e8ea14ddcc8f7c4e1928d527303ebe406
hwmon: (w83l768ng) Fix fan speed control range

commit 33a7ab91d509fa33b4bcd3ce0038cc80298050da upstream.

The W83L786NG stores the fan speed on 4 bits while the sysfs interface
uses a 0-255 range. Thus the driver should scale the user input down
to map it to the device range, and scale up the value read from the
device before presenting it to the user. The reserved register nibble
should be left unchanged.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/hwmon/w83l786ng.c