Commit 6b14a546 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

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: default avatarJean Delvare <khali@linux-fr.org>
parent af1713e0
...@@ -122,6 +122,9 @@ superio_exit(int base) ...@@ -122,6 +122,9 @@ superio_exit(int base)
/* status nr from 0 to 2 */ /* status nr from 0 to 2 */
#define F71805F_REG_STATUS(nr) (0x36 + (nr)) #define F71805F_REG_STATUS(nr) (0x36 + (nr))
/* individual register bits */
#define FAN_CTRL_SKIP 0x80
/* /*
* Data structures and manipulation thereof * Data structures and manipulation thereof
*/ */
...@@ -143,7 +146,7 @@ struct f71805f_data { ...@@ -143,7 +146,7 @@ struct f71805f_data {
u8 in_low[9]; u8 in_low[9];
u16 fan[3]; u16 fan[3];
u16 fan_low[3]; u16 fan_low[3];
u8 fan_enabled; /* Read once at init time */ u8 fan_ctrl[3];
u8 temp[3]; u8 temp[3];
u8 temp_high[3]; u8 temp_high[3];
u8 temp_hyst[3]; u8 temp_hyst[3];
...@@ -281,7 +284,8 @@ static struct f71805f_data *f71805f_update_device(struct device *dev) ...@@ -281,7 +284,8 @@ static struct f71805f_data *f71805f_update_device(struct device *dev)
F71805F_REG_IN_LOW(nr)); F71805F_REG_IN_LOW(nr));
} }
for (nr = 0; nr < 3; nr++) { for (nr = 0; nr < 3; nr++) {
if (data->fan_enabled & (1 << nr)) if (data->fan_ctrl[nr] & FAN_CTRL_SKIP)
continue;
data->fan_low[nr] = f71805f_read16(data, data->fan_low[nr] = f71805f_read16(data,
F71805F_REG_FAN_LOW(nr)); F71805F_REG_FAN_LOW(nr));
} }
...@@ -304,7 +308,8 @@ static struct f71805f_data *f71805f_update_device(struct device *dev) ...@@ -304,7 +308,8 @@ static struct f71805f_data *f71805f_update_device(struct device *dev)
F71805F_REG_IN(nr)); F71805F_REG_IN(nr));
} }
for (nr = 0; nr < 3; nr++) { for (nr = 0; nr < 3; nr++) {
if (data->fan_enabled & (1 << nr)) if (data->fan_ctrl[nr] & FAN_CTRL_SKIP)
continue;
data->fan[nr] = f71805f_read16(data, data->fan[nr] = f71805f_read16(data,
F71805F_REG_FAN(nr)); F71805F_REG_FAN(nr));
} }
...@@ -798,9 +803,8 @@ static void __devinit f71805f_init_device(struct f71805f_data *data) ...@@ -798,9 +803,8 @@ static void __devinit f71805f_init_device(struct f71805f_data *data)
/* Fan monitoring can be disabled. If it is, we won't be polling /* Fan monitoring can be disabled. If it is, we won't be polling
the register values, and won't create the related sysfs files. */ the register values, and won't create the related sysfs files. */
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
reg = f71805f_read8(data, F71805F_REG_FAN_CTRL(i)); data->fan_ctrl[i] = f71805f_read8(data,
if (!(reg & 0x80)) F71805F_REG_FAN_CTRL(i));
data->fan_enabled |= (1 << i);
} }
} }
...@@ -831,7 +835,7 @@ static int __devinit f71805f_probe(struct platform_device *pdev) ...@@ -831,7 +835,7 @@ static int __devinit f71805f_probe(struct platform_device *pdev)
if ((err = sysfs_create_group(&pdev->dev.kobj, &f71805f_group))) if ((err = sysfs_create_group(&pdev->dev.kobj, &f71805f_group)))
goto exit_free; goto exit_free;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if (!(data->fan_enabled & (1 << i))) if (data->fan_ctrl[i] & FAN_CTRL_SKIP)
continue; continue;
if ((err = sysfs_create_group(&pdev->dev.kobj, if ((err = sysfs_create_group(&pdev->dev.kobj,
&f71805f_group_fan[i]))) &f71805f_group_fan[i])))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment