]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
hwmon: (f75375s) Fix register write order when setting fans to full speed
authorNikolaus Schulz <schulz@macnetix.de>
Wed, 22 Feb 2012 22:18:44 +0000 (23:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Mar 2012 00:34:33 +0000 (16:34 -0800)
commit c1c1a3d012fe5e82a9a025fb4b5a4f8ee67a53f6 upstream.

By hwmon sysfs interface convention, setting pwm_enable to zero sets a fan
to full speed.  In the f75375s driver, this need be done by enabling
manual fan control, plus duty mode for the F875387 chip, and then setting
the maximum duty cycle.  Fix a bug where the two necessary register writes
were swapped, effectively discarding the setting to full-speed.

Signed-off-by: Nikolaus Schulz <mail@microschulz.de>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwmon/f75375s.c

index e4ab4918f63d198cb74760a0cd71a4a45d31a855..040a820acd154741a20a8e7680997289ac387c7d 100644 (file)
@@ -304,8 +304,6 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
        case 0: /* Full speed */
                fanmode  |= (3 << FAN_CTRL_MODE(nr));
                data->pwm[nr] = 255;
-               f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
-                               data->pwm[nr]);
                break;
        case 1: /* PWM */
                fanmode  |= (3 << FAN_CTRL_MODE(nr));
@@ -318,6 +316,9 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
        }
        f75375_write8(client, F75375_REG_FAN_TIMER, fanmode);
        data->pwm_enable[nr] = val;
+       if (val == 0)
+               f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
+                               data->pwm[nr]);
        return 0;
 }