diff options
author | Jean Delvare <khali@linux-fr.org> | 2006-12-12 12:18:26 -0500 |
---|---|---|
committer | Jean Delvare <khali@arrakis.delvare> | 2006-12-12 12:18:26 -0500 |
commit | 6b14a546a5a7fde46d20d3c14a4e91a24a3f1be0 (patch) | |
tree | 7cbba9405a38fdae7c83b85687ed6a6db9168a1b /drivers/hwmon/f71805f.c | |
parent | af1713e0f111647052953ba12fd10a59c74a5dde (diff) |
hwmon/f71805f: Store the fan control registers
So far we were only extracting the fan skip bit from the
fan control registers, but we'll soon need more bits so
better store the whole register values.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/f71805f.c')
-rw-r--r-- | drivers/hwmon/f71805f.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index de17a72149d9..dfca856854c3 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c | |||
@@ -122,6 +122,9 @@ superio_exit(int base) | |||
122 | /* status nr from 0 to 2 */ | 122 | /* status nr from 0 to 2 */ |
123 | #define F71805F_REG_STATUS(nr) (0x36 + (nr)) | 123 | #define F71805F_REG_STATUS(nr) (0x36 + (nr)) |
124 | 124 | ||
125 | /* individual register bits */ | ||
126 | #define FAN_CTRL_SKIP 0x80 | ||
127 | |||
125 | /* | 128 | /* |
126 | * Data structures and manipulation thereof | 129 | * Data structures and manipulation thereof |
127 | */ | 130 | */ |
@@ -143,7 +146,7 @@ struct f71805f_data { | |||
143 | u8 in_low[9]; | 146 | u8 in_low[9]; |
144 | u16 fan[3]; | 147 | u16 fan[3]; |
145 | u16 fan_low[3]; | 148 | u16 fan_low[3]; |
146 | u8 fan_enabled; /* Read once at init time */ | 149 | u8 fan_ctrl[3]; |
147 | u8 temp[3]; | 150 | u8 temp[3]; |
148 | u8 temp_high[3]; | 151 | u8 temp_high[3]; |
149 | u8 temp_hyst[3]; | 152 | u8 temp_hyst[3]; |
@@ -281,9 +284,10 @@ static struct f71805f_data *f71805f_update_device(struct device *dev) | |||
281 | F71805F_REG_IN_LOW(nr)); | 284 | F71805F_REG_IN_LOW(nr)); |
282 | } | 285 | } |
283 | for (nr = 0; nr < 3; nr++) { | 286 | for (nr = 0; nr < 3; nr++) { |
284 | if (data->fan_enabled & (1 << nr)) | 287 | if (data->fan_ctrl[nr] & FAN_CTRL_SKIP) |
285 | data->fan_low[nr] = f71805f_read16(data, | 288 | continue; |
286 | F71805F_REG_FAN_LOW(nr)); | 289 | data->fan_low[nr] = f71805f_read16(data, |
290 | F71805F_REG_FAN_LOW(nr)); | ||
287 | } | 291 | } |
288 | for (nr = 0; nr < 3; nr++) { | 292 | for (nr = 0; nr < 3; nr++) { |
289 | data->temp_high[nr] = f71805f_read8(data, | 293 | data->temp_high[nr] = f71805f_read8(data, |
@@ -304,9 +308,10 @@ static struct f71805f_data *f71805f_update_device(struct device *dev) | |||
304 | F71805F_REG_IN(nr)); | 308 | F71805F_REG_IN(nr)); |
305 | } | 309 | } |
306 | for (nr = 0; nr < 3; nr++) { | 310 | for (nr = 0; nr < 3; nr++) { |
307 | if (data->fan_enabled & (1 << nr)) | 311 | if (data->fan_ctrl[nr] & FAN_CTRL_SKIP) |
308 | data->fan[nr] = f71805f_read16(data, | 312 | continue; |
309 | F71805F_REG_FAN(nr)); | 313 | data->fan[nr] = f71805f_read16(data, |
314 | F71805F_REG_FAN(nr)); | ||
310 | } | 315 | } |
311 | for (nr = 0; nr < 3; nr++) { | 316 | for (nr = 0; nr < 3; nr++) { |
312 | data->temp[nr] = f71805f_read8(data, | 317 | data->temp[nr] = f71805f_read8(data, |
@@ -798,9 +803,8 @@ static void __devinit f71805f_init_device(struct f71805f_data *data) | |||
798 | /* Fan monitoring can be disabled. If it is, we won't be polling | 803 | /* Fan monitoring can be disabled. If it is, we won't be polling |
799 | the register values, and won't create the related sysfs files. */ | 804 | the register values, and won't create the related sysfs files. */ |
800 | for (i = 0; i < 3; i++) { | 805 | for (i = 0; i < 3; i++) { |
801 | reg = f71805f_read8(data, F71805F_REG_FAN_CTRL(i)); | 806 | data->fan_ctrl[i] = f71805f_read8(data, |
802 | if (!(reg & 0x80)) | 807 | F71805F_REG_FAN_CTRL(i)); |
803 | data->fan_enabled |= (1 << i); | ||
804 | } | 808 | } |
805 | } | 809 | } |
806 | 810 | ||
@@ -831,7 +835,7 @@ static int __devinit f71805f_probe(struct platform_device *pdev) | |||
831 | if ((err = sysfs_create_group(&pdev->dev.kobj, &f71805f_group))) | 835 | if ((err = sysfs_create_group(&pdev->dev.kobj, &f71805f_group))) |
832 | goto exit_free; | 836 | goto exit_free; |
833 | for (i = 0; i < 3; i++) { | 837 | for (i = 0; i < 3; i++) { |
834 | if (!(data->fan_enabled & (1 << i))) | 838 | if (data->fan_ctrl[i] & FAN_CTRL_SKIP) |
835 | continue; | 839 | continue; |
836 | if ((err = sysfs_create_group(&pdev->dev.kobj, | 840 | if ((err = sysfs_create_group(&pdev->dev.kobj, |
837 | &f71805f_group_fan[i]))) | 841 | &f71805f_group_fan[i]))) |