aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/w83627hf.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index 2169d8c8bbe4..20ae425a1980 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -1319,6 +1319,24 @@ static int __devexit w83627hf_remove(struct platform_device *pdev)
1319} 1319}
1320 1320
1321 1321
1322/* Registers 0x50-0x5f are banked */
1323static inline void w83627hf_set_bank(struct w83627hf_data *data, u16 reg)
1324{
1325 if ((reg & 0x00f0) == 0x50) {
1326 outb_p(W83781D_REG_BANK, data->addr + W83781D_ADDR_REG_OFFSET);
1327 outb_p(reg >> 8, data->addr + W83781D_DATA_REG_OFFSET);
1328 }
1329}
1330
1331/* Not strictly necessary, but play it safe for now */
1332static inline void w83627hf_reset_bank(struct w83627hf_data *data, u16 reg)
1333{
1334 if (reg & 0xff00) {
1335 outb_p(W83781D_REG_BANK, data->addr + W83781D_ADDR_REG_OFFSET);
1336 outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
1337 }
1338}
1339
1322static int w83627hf_read_value(struct w83627hf_data *data, u16 reg) 1340static int w83627hf_read_value(struct w83627hf_data *data, u16 reg)
1323{ 1341{
1324 int res, word_sized; 1342 int res, word_sized;
@@ -1329,12 +1347,7 @@ static int w83627hf_read_value(struct w83627hf_data *data, u16 reg)
1329 && (((reg & 0x00ff) == 0x50) 1347 && (((reg & 0x00ff) == 0x50)
1330 || ((reg & 0x00ff) == 0x53) 1348 || ((reg & 0x00ff) == 0x53)
1331 || ((reg & 0x00ff) == 0x55)); 1349 || ((reg & 0x00ff) == 0x55));
1332 if (reg & 0xff00) { 1350 w83627hf_set_bank(data, reg);
1333 outb_p(W83781D_REG_BANK,
1334 data->addr + W83781D_ADDR_REG_OFFSET);
1335 outb_p(reg >> 8,
1336 data->addr + W83781D_DATA_REG_OFFSET);
1337 }
1338 outb_p(reg & 0xff, data->addr + W83781D_ADDR_REG_OFFSET); 1351 outb_p(reg & 0xff, data->addr + W83781D_ADDR_REG_OFFSET);
1339 res = inb_p(data->addr + W83781D_DATA_REG_OFFSET); 1352 res = inb_p(data->addr + W83781D_DATA_REG_OFFSET);
1340 if (word_sized) { 1353 if (word_sized) {
@@ -1344,11 +1357,7 @@ static int w83627hf_read_value(struct w83627hf_data *data, u16 reg)
1344 (res << 8) + inb_p(data->addr + 1357 (res << 8) + inb_p(data->addr +
1345 W83781D_DATA_REG_OFFSET); 1358 W83781D_DATA_REG_OFFSET);
1346 } 1359 }
1347 if (reg & 0xff00) { 1360 w83627hf_reset_bank(data, reg);
1348 outb_p(W83781D_REG_BANK,
1349 data->addr + W83781D_ADDR_REG_OFFSET);
1350 outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
1351 }
1352 mutex_unlock(&data->lock); 1361 mutex_unlock(&data->lock);
1353 return res; 1362 return res;
1354} 1363}
@@ -1419,12 +1428,7 @@ static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value)
1419 || ((reg & 0xff00) == 0x200)) 1428 || ((reg & 0xff00) == 0x200))
1420 && (((reg & 0x00ff) == 0x53) 1429 && (((reg & 0x00ff) == 0x53)
1421 || ((reg & 0x00ff) == 0x55)); 1430 || ((reg & 0x00ff) == 0x55));
1422 if (reg & 0xff00) { 1431 w83627hf_set_bank(data, reg);
1423 outb_p(W83781D_REG_BANK,
1424 data->addr + W83781D_ADDR_REG_OFFSET);
1425 outb_p(reg >> 8,
1426 data->addr + W83781D_DATA_REG_OFFSET);
1427 }
1428 outb_p(reg & 0xff, data->addr + W83781D_ADDR_REG_OFFSET); 1432 outb_p(reg & 0xff, data->addr + W83781D_ADDR_REG_OFFSET);
1429 if (word_sized) { 1433 if (word_sized) {
1430 outb_p(value >> 8, 1434 outb_p(value >> 8,
@@ -1434,11 +1438,7 @@ static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value)
1434 } 1438 }
1435 outb_p(value & 0xff, 1439 outb_p(value & 0xff,
1436 data->addr + W83781D_DATA_REG_OFFSET); 1440 data->addr + W83781D_DATA_REG_OFFSET);
1437 if (reg & 0xff00) { 1441 w83627hf_reset_bank(data, reg);
1438 outb_p(W83781D_REG_BANK,
1439 data->addr + W83781D_ADDR_REG_OFFSET);
1440 outb_p(0, data->addr + W83781D_DATA_REG_OFFSET);
1441 }
1442 mutex_unlock(&data->lock); 1442 mutex_unlock(&data->lock);
1443 return 0; 1443 return 0;
1444} 1444}