Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84530
b: refs/heads/master
c: 38a1f0e
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare authored and Mark M. Hoffman committed Feb 8, 2008
1 parent 1cb0c63 commit c98a2c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d5b0b5d62823f08ab4988e1b179fd5a9bddced31
refs/heads/master: 38a1f0e9aed014be66c474ecd9fe8513646de833
12 changes: 10 additions & 2 deletions trunk/drivers/hwmon/adm1031.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,18 +542,26 @@ set_fan_div(struct device *dev, const char *buf, size_t count, int nr)
return -EINVAL;

mutex_lock(&data->update_lock);
/* Get fresh readings */
data->fan_div[nr] = adm1031_read_value(client,
ADM1031_REG_FAN_DIV(nr));
data->fan_min[nr] = adm1031_read_value(client,
ADM1031_REG_FAN_MIN(nr));

/* Write the new clock divider and fan min */
old_div = FAN_DIV_FROM_REG(data->fan_div[nr]);
data->fan_div[nr] = (tmp & 0xC0) | (0x3f & data->fan_div[nr]);
new_min = data->fan_min[nr] * old_div /
FAN_DIV_FROM_REG(data->fan_div[nr]);
data->fan_min[nr] = new_min > 0xff ? 0xff : new_min;
data->fan[nr] = data->fan[nr] * old_div /
FAN_DIV_FROM_REG(data->fan_div[nr]);

adm1031_write_value(client, ADM1031_REG_FAN_DIV(nr),
data->fan_div[nr]);
adm1031_write_value(client, ADM1031_REG_FAN_MIN(nr),
data->fan_min[nr]);

/* Invalidate the cache: fan speed is no longer valid */
data->valid = 0;
mutex_unlock(&data->update_lock);
return count;
}
Expand Down

0 comments on commit c98a2c1

Please sign in to comment.