diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-04-01 23:09:36 -0400 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-04-19 09:32:37 -0400 |
commit | f838aa2611045fb1409c461fdd5102a6d8ae79f2 (patch) | |
tree | 5fd0498acf463b30089b8ea6bd922888a52c507b /drivers/hwmon | |
parent | 559313c4e9b29f5d0ba246f69d1052ef2fd9b423 (diff) |
hwmon: (it87) Add support for VIN7 to VIN10 on IT8620E
IT8620E supports three additional voltage sensors.
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/it87.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index aa3ec50527a3..96876755376c 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -219,7 +219,12 @@ static bool fix_pwm_polarity; | |||
219 | #define IT87_REG_FAN_DIV 0x0b | 219 | #define IT87_REG_FAN_DIV 0x0b |
220 | #define IT87_REG_FAN_16BIT 0x0c | 220 | #define IT87_REG_FAN_16BIT 0x0c |
221 | 221 | ||
222 | /* Monitors: 9 voltage (0 to 7, battery), 6 temp (1 to 6), 3 fan (1 to 3) */ | 222 | /* |
223 | * Monitors: | ||
224 | * - up to 13 voltage (0 to 7, battery, avcc, 10 to 12) | ||
225 | * - up to 6 temp (1 to 6) | ||
226 | * - up to 6 fan (1 to 6) | ||
227 | */ | ||
223 | 228 | ||
224 | static const u8 IT87_REG_FAN[] = { 0x0d, 0x0e, 0x0f, 0x80, 0x82, 0x4c }; | 229 | static const u8 IT87_REG_FAN[] = { 0x0d, 0x0e, 0x0f, 0x80, 0x82, 0x4c }; |
225 | static const u8 IT87_REG_FAN_MIN[] = { 0x10, 0x11, 0x12, 0x84, 0x86, 0x4e }; | 230 | static const u8 IT87_REG_FAN_MIN[] = { 0x10, 0x11, 0x12, 0x84, 0x86, 0x4e }; |
@@ -233,7 +238,7 @@ static const u8 IT87_REG_PWM[] = { 0x15, 0x16, 0x17, 0x7f, 0xa7, 0xaf }; | |||
233 | static const u8 IT87_REG_PWM_DUTY[] = { 0x63, 0x6b, 0x73, 0x7b, 0xa3, 0xab }; | 238 | static const u8 IT87_REG_PWM_DUTY[] = { 0x63, 0x6b, 0x73, 0x7b, 0xa3, 0xab }; |
234 | 239 | ||
235 | static const u8 IT87_REG_VIN[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, | 240 | static const u8 IT87_REG_VIN[] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, |
236 | 0x27, 0x28, 0x2f }; | 241 | 0x27, 0x28, 0x2f, 0x2c, 0x2d, 0x2e }; |
237 | 242 | ||
238 | #define IT87_REG_TEMP(nr) (0x29 + (nr)) | 243 | #define IT87_REG_TEMP(nr) (0x29 + (nr)) |
239 | 244 | ||
@@ -478,7 +483,7 @@ struct it87_data { | |||
478 | u16 in_scaled; /* Internal voltage sensors are scaled */ | 483 | u16 in_scaled; /* Internal voltage sensors are scaled */ |
479 | u16 in_internal; /* Bitfield, internal sensors (for labels) */ | 484 | u16 in_internal; /* Bitfield, internal sensors (for labels) */ |
480 | u16 has_in; /* Bitfield, voltage sensors enabled */ | 485 | u16 has_in; /* Bitfield, voltage sensors enabled */ |
481 | u8 in[10][3]; /* [nr][0]=in, [1]=min, [2]=max */ | 486 | u8 in[13][3]; /* [nr][0]=in, [1]=min, [2]=max */ |
482 | u8 has_fan; /* Bitfield, fans enabled */ | 487 | u8 has_fan; /* Bitfield, fans enabled */ |
483 | u16 fan[6][2]; /* Register values, [nr][0]=fan, [1]=min */ | 488 | u16 fan[6][2]; /* Register values, [nr][0]=fan, [1]=min */ |
484 | u8 has_temp; /* Bitfield, temp sensors enabled */ | 489 | u8 has_temp; /* Bitfield, temp sensors enabled */ |
@@ -861,6 +866,9 @@ static SENSOR_DEVICE_ATTR_2(in7_max, S_IRUGO | S_IWUSR, show_in, set_in, | |||
861 | 866 | ||
862 | static SENSOR_DEVICE_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 8, 0); | 867 | static SENSOR_DEVICE_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 8, 0); |
863 | static SENSOR_DEVICE_ATTR_2(in9_input, S_IRUGO, show_in, NULL, 9, 0); | 868 | static SENSOR_DEVICE_ATTR_2(in9_input, S_IRUGO, show_in, NULL, 9, 0); |
869 | static SENSOR_DEVICE_ATTR_2(in10_input, S_IRUGO, show_in, NULL, 10, 0); | ||
870 | static SENSOR_DEVICE_ATTR_2(in11_input, S_IRUGO, show_in, NULL, 11, 0); | ||
871 | static SENSOR_DEVICE_ATTR_2(in12_input, S_IRUGO, show_in, NULL, 12, 0); | ||
864 | 872 | ||
865 | /* Up to 6 temperatures */ | 873 | /* Up to 6 temperatures */ |
866 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, | 874 | static ssize_t show_temp(struct device *dev, struct device_attribute *attr, |
@@ -1764,7 +1772,7 @@ static umode_t it87_in_is_visible(struct kobject *kobj, | |||
1764 | int i = index / 5; /* voltage index */ | 1772 | int i = index / 5; /* voltage index */ |
1765 | int a = index % 5; /* attribute index */ | 1773 | int a = index % 5; /* attribute index */ |
1766 | 1774 | ||
1767 | if (index >= 40) { /* in8, in9 only have input attributes */ | 1775 | if (index >= 40) { /* in8 and higher only have input attributes */ |
1768 | i = index - 40 + 8; | 1776 | i = index - 40 + 8; |
1769 | a = 0; | 1777 | a = 0; |
1770 | } | 1778 | } |
@@ -1828,8 +1836,10 @@ static struct attribute *it87_attributes_in[] = { | |||
1828 | &sensor_dev_attr_in7_beep.dev_attr.attr, /* 39 */ | 1836 | &sensor_dev_attr_in7_beep.dev_attr.attr, /* 39 */ |
1829 | 1837 | ||
1830 | &sensor_dev_attr_in8_input.dev_attr.attr, /* 40 */ | 1838 | &sensor_dev_attr_in8_input.dev_attr.attr, /* 40 */ |
1831 | |||
1832 | &sensor_dev_attr_in9_input.dev_attr.attr, /* 41 */ | 1839 | &sensor_dev_attr_in9_input.dev_attr.attr, /* 41 */ |
1840 | &sensor_dev_attr_in10_input.dev_attr.attr, /* 41 */ | ||
1841 | &sensor_dev_attr_in11_input.dev_attr.attr, /* 41 */ | ||
1842 | &sensor_dev_attr_in12_input.dev_attr.attr, /* 41 */ | ||
1833 | }; | 1843 | }; |
1834 | 1844 | ||
1835 | static const struct attribute_group it87_group_in = { | 1845 | static const struct attribute_group it87_group_in = { |
@@ -2738,12 +2748,21 @@ static int it87_probe(struct platform_device *pdev) | |||
2738 | if (has_six_temp(data)) { | 2748 | if (has_six_temp(data)) { |
2739 | u8 reg = it87_read_value(data, IT87_REG_TEMP456_ENABLE); | 2749 | u8 reg = it87_read_value(data, IT87_REG_TEMP456_ENABLE); |
2740 | 2750 | ||
2751 | /* Check for additional temperature sensors */ | ||
2741 | if ((reg & 0x03) >= 0x02) | 2752 | if ((reg & 0x03) >= 0x02) |
2742 | data->has_temp |= (1 << 3); | 2753 | data->has_temp |= (1 << 3); |
2743 | if (((reg >> 2) & 0x03) >= 0x02) | 2754 | if (((reg >> 2) & 0x03) >= 0x02) |
2744 | data->has_temp |= (1 << 4); | 2755 | data->has_temp |= (1 << 4); |
2745 | if (((reg >> 4) & 0x03) >= 0x02) | 2756 | if (((reg >> 4) & 0x03) >= 0x02) |
2746 | data->has_temp |= (1 << 5); | 2757 | data->has_temp |= (1 << 5); |
2758 | |||
2759 | /* Check for additional voltage sensors */ | ||
2760 | if ((reg & 0x03) == 0x01) | ||
2761 | data->has_in |= (1 << 10); | ||
2762 | if (((reg >> 2) & 0x03) == 0x01) | ||
2763 | data->has_in |= (1 << 11); | ||
2764 | if (((reg >> 4) & 0x03) == 0x01) | ||
2765 | data->has_in |= (1 << 12); | ||
2747 | } | 2766 | } |
2748 | 2767 | ||
2749 | data->has_beep = !!sio_data->beep_pin; | 2768 | data->has_beep = !!sio_data->beep_pin; |