hwmon: (ad7314) Add 'name' sysfs attribute
[pandora-kernel.git] / drivers / hwmon / f75375s.c
index 9638d58..040a820 100644 (file)
@@ -6,10 +6,10 @@
  * Datasheets available at:
  *
  * f75375:
- * http://www.fintek.com.tw/files/productfiles/2005111152950.pdf
+ * http://www.fintek.com.tw/files/productfiles/F75375_V026P.pdf 
  *
  * f75373:
- * http://www.fintek.com.tw/files/productfiles/2005111153128.pdf
+ * http://www.fintek.com.tw/files/productfiles/F75373_V025P.pdf
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -159,7 +159,7 @@ static inline void f75375_write8(struct i2c_client *client, u8 reg,
 static inline void f75375_write16(struct i2c_client *client, u8 reg,
                u16 value)
 {
-       int err = i2c_smbus_write_byte_data(client, reg, (value << 8));
+       int err = i2c_smbus_write_byte_data(client, reg, (value >> 8));
        if (err)
                return;
        i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF));
@@ -304,20 +304,21 @@ 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));
                break;
        case 2: /* AUTOMATIC*/
-               fanmode  |= (2 << FAN_CTRL_MODE(nr));
+               fanmode  |= (1 << FAN_CTRL_MODE(nr));
                break;
        case 3: /* fan speed */
                break;
        }
        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;
 }