aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83795.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-10-28 14:31:46 -0400
committerJean Delvare <khali@endymion.delvare>2010-10-28 14:31:46 -0400
commit6f9dfd85f7b14dd3ea87106909dc54def08947b1 (patch)
tree9125e0dc58c36738ffb6dba087aa74492bc4bcbe /drivers/hwmon/w83795.c
parent80646b95863ba282330d07290c79254c2f002139 (diff)
hwmon: (w83795) Fix in17-in20 gain factor
Gain bit set means 1x gain and cleared means 8x gain, not the other way around. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r--drivers/hwmon/w83795.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index 62deffcc64a3..77b4f7859df9 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -1335,7 +1335,7 @@ show_in(struct device *dev, struct device_attribute *attr, char *buf)
1335 case IN_READ: 1335 case IN_READ:
1336 /* calculate this value again by sensors as sensors3.conf */ 1336 /* calculate this value again by sensors as sensors3.conf */
1337 if ((index >= 17) && 1337 if ((index >= 17) &&
1338 ((data->has_gain >> (index - 17)) & 1)) 1338 !((data->has_gain >> (index - 17)) & 1))
1339 val *= 8; 1339 val *= 8;
1340 break; 1340 break;
1341 case IN_MAX: 1341 case IN_MAX:
@@ -1345,7 +1345,7 @@ show_in(struct device *dev, struct device_attribute *attr, char *buf)
1345 val |= (data->in_lsb[lsb_idx][nr] >> 1345 val |= (data->in_lsb[lsb_idx][nr] >>
1346 IN_LSB_SHIFT_IDX[lsb_idx][IN_LSB_SHIFT]) & 0x03; 1346 IN_LSB_SHIFT_IDX[lsb_idx][IN_LSB_SHIFT]) & 0x03;
1347 if ((index >= 17) && 1347 if ((index >= 17) &&
1348 ((data->has_gain >> (index - 17)) & 1)) 1348 !((data->has_gain >> (index - 17)) & 1))
1349 val *= 8; 1349 val *= 8;
1350 break; 1350 break;
1351 } 1351 }
@@ -1373,7 +1373,7 @@ store_in(struct device *dev, struct device_attribute *attr,
1373 val = in_to_reg(index, val); 1373 val = in_to_reg(index, val);
1374 1374
1375 if ((index >= 17) && 1375 if ((index >= 17) &&
1376 ((data->has_gain >> (index - 17)) & 1)) 1376 !((data->has_gain >> (index - 17)) & 1))
1377 val /= 8; 1377 val /= 8;
1378 val = SENSORS_LIMIT(val, 0, 0x3FF); 1378 val = SENSORS_LIMIT(val, 0, 0x3FF);
1379 mutex_lock(&data->update_lock); 1379 mutex_lock(&data->update_lock);