提交 1282ab3f 编写于 作者: L Linus Torvalds

Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Couple of regressions, couple of zero-day bugs, a minor enhancement.
Nothing really major.

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (f75375s) Let f75375_update_device treat pwmX as a measured value
  hwmon: (f75375s) Fix bit shifting in f75375_write16
  hwmon: (f75375s) Fix reading of wrong register when initializing the F75387
  hwmon: (f75375s) Fix automatic pwm mode setting for F75373 & F75375
  hwmon: (w83627ehf) Remove duplicate code
...@@ -172,7 +172,7 @@ static inline void f75375_write8(struct i2c_client *client, u8 reg, ...@@ -172,7 +172,7 @@ static inline void f75375_write8(struct i2c_client *client, u8 reg,
static inline void f75375_write16(struct i2c_client *client, u8 reg, static inline void f75375_write16(struct i2c_client *client, u8 reg,
u16 value) 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) if (err)
return; return;
i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF)); i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF));
...@@ -200,9 +200,6 @@ static struct f75375_data *f75375_update_device(struct device *dev) ...@@ -200,9 +200,6 @@ static struct f75375_data *f75375_update_device(struct device *dev)
f75375_read16(client, F75375_REG_FAN_MIN(nr)); f75375_read16(client, F75375_REG_FAN_MIN(nr));
data->fan_target[nr] = data->fan_target[nr] =
f75375_read16(client, F75375_REG_FAN_EXP(nr)); f75375_read16(client, F75375_REG_FAN_EXP(nr));
data->pwm[nr] = f75375_read8(client,
F75375_REG_FAN_PWM_DUTY(nr));
} }
for (nr = 0; nr < 4; nr++) { for (nr = 0; nr < 4; nr++) {
data->in_max[nr] = data->in_max[nr] =
...@@ -218,6 +215,8 @@ static struct f75375_data *f75375_update_device(struct device *dev) ...@@ -218,6 +215,8 @@ static struct f75375_data *f75375_update_device(struct device *dev)
if (time_after(jiffies, data->last_updated + 2 * HZ) if (time_after(jiffies, data->last_updated + 2 * HZ)
|| !data->valid) { || !data->valid) {
for (nr = 0; nr < 2; nr++) { for (nr = 0; nr < 2; nr++) {
data->pwm[nr] = f75375_read8(client,
F75375_REG_FAN_PWM_DUTY(nr));
/* assign MSB, therefore shift it by 8 bits */ /* assign MSB, therefore shift it by 8 bits */
data->temp11[nr] = data->temp11[nr] =
f75375_read8(client, F75375_REG_TEMP(nr)) << 8; f75375_read8(client, F75375_REG_TEMP(nr)) << 8;
...@@ -369,7 +368,7 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) ...@@ -369,7 +368,7 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
fanmode |= (3 << FAN_CTRL_MODE(nr)); fanmode |= (3 << FAN_CTRL_MODE(nr));
break; break;
case 2: /* AUTOMATIC*/ case 2: /* AUTOMATIC*/
fanmode |= (2 << FAN_CTRL_MODE(nr)); fanmode |= (1 << FAN_CTRL_MODE(nr));
break; break;
case 3: /* fan speed */ case 3: /* fan speed */
break; break;
...@@ -723,7 +722,7 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data, ...@@ -723,7 +722,7 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
if (data->kind == f75387) { if (data->kind == f75387) {
bool manu, duty; bool manu, duty;
if (!(conf & (1 << F75387_FAN_CTRL_LINEAR(nr)))) if (!(mode & (1 << F75387_FAN_CTRL_LINEAR(nr))))
data->pwm_mode[nr] = 1; data->pwm_mode[nr] = 1;
manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1);
......
...@@ -2349,11 +2349,6 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) ...@@ -2349,11 +2349,6 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
/* Read fan clock dividers immediately */ /* Read fan clock dividers immediately */
w83627ehf_update_fan_div_common(dev, data); w83627ehf_update_fan_div_common(dev, data);
/* Read pwm data to save original values */
w83627ehf_update_pwm_common(dev, data);
for (i = 0; i < data->pwm_num; i++)
data->pwm_enable_orig[i] = data->pwm_enable[i];
/* Read pwm data to save original values */ /* Read pwm data to save original values */
w83627ehf_update_pwm_common(dev, data); w83627ehf_update_pwm_common(dev, data);
for (i = 0; i < data->pwm_num; i++) for (i = 0; i < data->pwm_num; i++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册