aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips')
-rw-r--r--drivers/i2c/chips/via686a.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
index 9370aaf29c3b..137d9b7cacd4 100644
--- a/drivers/i2c/chips/via686a.c
+++ b/drivers/i2c/chips/via686a.c
@@ -78,15 +78,10 @@ SENSORS_INSMOD_1(via686a);
78#define VIA686A_REG_FAN_MIN(nr) (0x3a + (nr)) 78#define VIA686A_REG_FAN_MIN(nr) (0x3a + (nr))
79#define VIA686A_REG_FAN(nr) (0x28 + (nr)) 79#define VIA686A_REG_FAN(nr) (0x28 + (nr))
80 80
81/* the following values are as speced by VIA: */
82static const u8 regtemp[] = { 0x20, 0x21, 0x1f };
83static const u8 regover[] = { 0x39, 0x3d, 0x1d };
84static const u8 reghyst[] = { 0x3a, 0x3e, 0x1e };
85
86/* temps numbered 1-3 */ 81/* temps numbered 1-3 */
87#define VIA686A_REG_TEMP(nr) (regtemp[nr]) 82static const u8 VIA686A_REG_TEMP[] = { 0x20, 0x21, 0x1f };
88#define VIA686A_REG_TEMP_OVER(nr) (regover[nr]) 83static const u8 VIA686A_REG_TEMP_OVER[] = { 0x39, 0x3d, 0x1d };
89#define VIA686A_REG_TEMP_HYST(nr) (reghyst[nr]) 84static const u8 VIA686A_REG_TEMP_HYST[] = { 0x3a, 0x3e, 0x1e };
90/* bits 7-6 */ 85/* bits 7-6 */
91#define VIA686A_REG_TEMP_LOW1 0x4b 86#define VIA686A_REG_TEMP_LOW1 0x4b
92/* 2 = bits 5-4, 3 = bits 7-6 */ 87/* 2 = bits 5-4, 3 = bits 7-6 */
@@ -441,7 +436,8 @@ static ssize_t set_temp_over(struct device *dev, const char *buf,
441 436
442 down(&data->update_lock); 437 down(&data->update_lock);
443 data->temp_over[nr] = TEMP_TO_REG(val); 438 data->temp_over[nr] = TEMP_TO_REG(val);
444 via686a_write_value(client, VIA686A_REG_TEMP_OVER(nr), data->temp_over[nr]); 439 via686a_write_value(client, VIA686A_REG_TEMP_OVER[nr],
440 data->temp_over[nr]);
445 up(&data->update_lock); 441 up(&data->update_lock);
446 return count; 442 return count;
447} 443}
@@ -453,7 +449,8 @@ static ssize_t set_temp_hyst(struct device *dev, const char *buf,
453 449
454 down(&data->update_lock); 450 down(&data->update_lock);
455 data->temp_hyst[nr] = TEMP_TO_REG(val); 451 data->temp_hyst[nr] = TEMP_TO_REG(val);
456 via686a_write_value(client, VIA686A_REG_TEMP_HYST(nr), data->temp_hyst[nr]); 452 via686a_write_value(client, VIA686A_REG_TEMP_HYST[nr],
453 data->temp_hyst[nr]);
457 up(&data->update_lock); 454 up(&data->update_lock);
458 return count; 455 return count;
459} 456}
@@ -763,13 +760,13 @@ static struct via686a_data *via686a_update_device(struct device *dev)
763 } 760 }
764 for (i = 0; i <= 2; i++) { 761 for (i = 0; i <= 2; i++) {
765 data->temp[i] = via686a_read_value(client, 762 data->temp[i] = via686a_read_value(client,
766 VIA686A_REG_TEMP(i)) << 2; 763 VIA686A_REG_TEMP[i]) << 2;
767 data->temp_over[i] = 764 data->temp_over[i] =
768 via686a_read_value(client, 765 via686a_read_value(client,
769 VIA686A_REG_TEMP_OVER(i)); 766 VIA686A_REG_TEMP_OVER[i]);
770 data->temp_hyst[i] = 767 data->temp_hyst[i] =
771 via686a_read_value(client, 768 via686a_read_value(client,
772 VIA686A_REG_TEMP_HYST(i)); 769 VIA686A_REG_TEMP_HYST[i]);
773 } 770 }
774 /* add in lower 2 bits 771 /* add in lower 2 bits
775 temp1 uses bits 7-6 of VIA686A_REG_TEMP_LOW1 772 temp1 uses bits 7-6 of VIA686A_REG_TEMP_LOW1