aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-03-09 14:57:09 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-03-15 01:39:21 -0400
commit98f7ba197f9ef366856b5cc9ef4f46e852f3d1c8 (patch)
tree1452ce9e6920e78c1d260e2c0b9087e25b3ba050 /drivers/hwmon/f71882fg.c
parent44c4dc521e99c0b2946973090b27c9bd4eb81b63 (diff)
hwmon/f71882fg: Only allow negative auto point temps if fan_neg_temp is enabled
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r--drivers/hwmon/f71882fg.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 6c3de065e04b..67ac85870592 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -84,6 +84,9 @@
84 84
85#define F71882FG_REG_FAN_HYST(nr) (0x98 + (nr)) 85#define F71882FG_REG_FAN_HYST(nr) (0x98 + (nr))
86 86
87#define F71882FG_REG_FAN_FAULT_T 0x9F
88#define F71882FG_FAN_NEG_TEMP_EN 0x20
89
87#define F71882FG_REG_POINT_PWM(pwm, point) (0xAA + (point) + (16 * (pwm))) 90#define F71882FG_REG_POINT_PWM(pwm, point) (0xAA + (point) + (16 * (pwm)))
88#define F71882FG_REG_POINT_TEMP(pwm, point) (0xA6 + (point) + (16 * (pwm))) 91#define F71882FG_REG_POINT_TEMP(pwm, point) (0xA6 + (point) + (16 * (pwm)))
89#define F71882FG_REG_POINT_MAPPING(nr) (0xAF + 16 * (nr)) 92#define F71882FG_REG_POINT_MAPPING(nr) (0xAF + 16 * (nr))
@@ -127,6 +130,7 @@ struct f71882fg_data {
127 struct mutex update_lock; 130 struct mutex update_lock;
128 int temp_start; /* temp numbering start (0 or 1) */ 131 int temp_start; /* temp numbering start (0 or 1) */
129 char valid; /* !=0 if following fields are valid */ 132 char valid; /* !=0 if following fields are valid */
133 char auto_point_temp_signed;
130 unsigned long last_updated; /* In jiffies */ 134 unsigned long last_updated; /* In jiffies */
131 unsigned long last_limits; /* In jiffies */ 135 unsigned long last_limits; /* In jiffies */
132 136
@@ -1853,7 +1857,7 @@ static ssize_t store_pwm_auto_point_temp(struct device *dev,
1853 1857
1854 val /= 1000; 1858 val /= 1000;
1855 1859
1856 if (data->type == f71889fg) 1860 if (data->auto_point_temp_signed)
1857 val = SENSORS_LIMIT(val, -128, 127); 1861 val = SENSORS_LIMIT(val, -128, 127);
1858 else 1862 else
1859 val = SENSORS_LIMIT(val, 0, 127); 1863 val = SENSORS_LIMIT(val, 0, 127);
@@ -1900,7 +1904,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
1900 struct f71882fg_data *data; 1904 struct f71882fg_data *data;
1901 struct f71882fg_sio_data *sio_data = pdev->dev.platform_data; 1905 struct f71882fg_sio_data *sio_data = pdev->dev.platform_data;
1902 int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3; 1906 int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3;
1903 u8 start_reg; 1907 u8 start_reg, reg;
1904 1908
1905 data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL); 1909 data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL);
1906 if (!data) 1910 if (!data)
@@ -1970,6 +1974,16 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
1970 } 1974 }
1971 1975
1972 if (start_reg & 0x02) { 1976 if (start_reg & 0x02) {
1977 switch (data->type) {
1978 case f71889fg:
1979 reg = f71882fg_read8(data, F71882FG_REG_FAN_FAULT_T);
1980 if (reg & F71882FG_FAN_NEG_TEMP_EN)
1981 data->auto_point_temp_signed = 1;
1982 break;
1983 default:
1984 break;
1985 }
1986
1973 data->pwm_enable = 1987 data->pwm_enable =
1974 f71882fg_read8(data, F71882FG_REG_PWM_ENABLE); 1988 f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
1975 1989