hwmon: (f75375s) Properly map the F75387 automatic modes to pwm_enable
commitb17d6561acc16265b65b1e0d27b649829b61a7e3
authorNikolaus Schulz <schulz@macnetix.de>
Tue, 28 Feb 2012 21:15:53 +0000 (28 16:15 -0500)
committerGuenter Roeck <guenter.roeck@ericsson.com>
Fri, 2 Mar 2012 19:56:43 +0000 (2 11:56 -0800)
tree0bcfd3e723d7af6787f5c9a01d825a1cc665bab1
parentedeea102857e33b5e9b17a3a2640da390732a693
hwmon: (f75375s) Properly map the F75387 automatic modes to pwm_enable

The F75387 supports automatic fan control using either PWM duty cycle or
RPM speed values.  Make the driver detect the latter mode, and expose the
different modes in sysfs as per pwm_enable, so that the user can switch
between them.

The interpretation of the pwm_enable attribute for the F75387 is adjusted
to be a superset of those values used for similar Fintek chips which do
not support automatic duty mode, with 2 mapping to automatic speed mode,
and moving automatic duty mode to the new value 4.

Toggling the duty mode via pwm_enable is currently denied for the F75387,
as the chip then simply reinterprets the fan configuration register values
according to the new mode, switching between RPM and PWM units, which
makes this a dangerous operation.

This patch introduces a new pwm mode into the driver. This is necessary
because the new mode (automatic pwm mode, 4) may already be enabled by the
BIOS, and the driver should not break existing functionality. This was seen
on at least one board.

Signed-off-by: Nikolaus Schulz <mail@microschulz.de>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
drivers/hwmon/f75375s.c