aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/it87.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 4d9090f89401..11a28b233006 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -295,10 +295,11 @@ struct it87_devices {
295#define FEAT_SIX_FANS BIT(11) /* Supports six fans */ 295#define FEAT_SIX_FANS BIT(11) /* Supports six fans */
296#define FEAT_10_9MV_ADC BIT(12) 296#define FEAT_10_9MV_ADC BIT(12)
297#define FEAT_AVCC3 BIT(13) /* Chip supports in9/AVCC3 */ 297#define FEAT_AVCC3 BIT(13) /* Chip supports in9/AVCC3 */
298#define FEAT_SIX_PWM BIT(14) /* Chip supports 6 pwm chn */ 298#define FEAT_FIVE_PWM BIT(14) /* Chip supports 5 pwm chn */
299#define FEAT_PWM_FREQ2 BIT(15) /* Separate pwm freq 2 */ 299#define FEAT_SIX_PWM BIT(15) /* Chip supports 6 pwm chn */
300#define FEAT_SIX_TEMP BIT(16) /* Up to 6 temp sensors */ 300#define FEAT_PWM_FREQ2 BIT(16) /* Separate pwm freq 2 */
301#define FEAT_VIN3_5V BIT(17) /* VIN3 connected to +5V */ 301#define FEAT_SIX_TEMP BIT(17) /* Up to 6 temp sensors */
302#define FEAT_VIN3_5V BIT(18) /* VIN3 connected to +5V */
302 303
303static const struct it87_devices it87_devices[] = { 304static const struct it87_devices it87_devices[] = {
304 [it87] = { 305 [it87] = {
@@ -444,8 +445,8 @@ static const struct it87_devices it87_devices[] = {
444 .suffix = "E", 445 .suffix = "E",
445 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS 446 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
446 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS 447 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS
447 | FEAT_IN7_INTERNAL | FEAT_PWM_FREQ2 | FEAT_AVCC3 448 | FEAT_FIVE_PWM | FEAT_IN7_INTERNAL | FEAT_PWM_FREQ2
448 | FEAT_VIN3_5V, 449 | FEAT_AVCC3 | FEAT_VIN3_5V,
449 .peci_mask = 0x07, 450 .peci_mask = 0x07,
450 }, 451 },
451 [it8628] = { 452 [it8628] = {
@@ -477,6 +478,8 @@ static const struct it87_devices it87_devices[] = {
477#define has_in7_internal(data) ((data)->features & FEAT_IN7_INTERNAL) 478#define has_in7_internal(data) ((data)->features & FEAT_IN7_INTERNAL)
478#define has_six_fans(data) ((data)->features & FEAT_SIX_FANS) 479#define has_six_fans(data) ((data)->features & FEAT_SIX_FANS)
479#define has_avcc3(data) ((data)->features & FEAT_AVCC3) 480#define has_avcc3(data) ((data)->features & FEAT_AVCC3)
481#define has_five_pwm(data) ((data)->features & (FEAT_FIVE_PWM \
482 | FEAT_SIX_PWM))
480#define has_six_pwm(data) ((data)->features & FEAT_SIX_PWM) 483#define has_six_pwm(data) ((data)->features & FEAT_SIX_PWM)
481#define has_pwm_freq2(data) ((data)->features & FEAT_PWM_FREQ2) 484#define has_pwm_freq2(data) ((data)->features & FEAT_PWM_FREQ2)
482#define has_six_temp(data) ((data)->features & FEAT_SIX_TEMP) 485#define has_six_temp(data) ((data)->features & FEAT_SIX_TEMP)
@@ -1929,11 +1932,13 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr,
1929 "+5V", 1932 "+5V",
1930 "5VSB", 1933 "5VSB",
1931 "Vbat", 1934 "Vbat",
1935 "AVCC",
1932 }; 1936 };
1933 static const char * const labels_it8721[] = { 1937 static const char * const labels_it8721[] = {
1934 "+3.3V", 1938 "+3.3V",
1935 "3VSB", 1939 "3VSB",
1936 "Vbat", 1940 "Vbat",
1941 "+3.3V",
1937 }; 1942 };
1938 struct it87_data *data = dev_get_drvdata(dev); 1943 struct it87_data *data = dev_get_drvdata(dev);
1939 int nr = to_sensor_dev_attr(attr)->index; 1944 int nr = to_sensor_dev_attr(attr)->index;
@@ -1952,7 +1957,7 @@ static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0);
1952static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1); 1957static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1);
1953static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 2); 1958static SENSOR_DEVICE_ATTR(in8_label, S_IRUGO, show_label, NULL, 2);
1954/* AVCC3 */ 1959/* AVCC3 */
1955static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 0); 1960static SENSOR_DEVICE_ATTR(in9_label, S_IRUGO, show_label, NULL, 3);
1956 1961
1957static umode_t it87_in_is_visible(struct kobject *kobj, 1962static umode_t it87_in_is_visible(struct kobject *kobj,
1958 struct attribute *attr, int index) 1963 struct attribute *attr, int index)
@@ -2475,8 +2480,10 @@ static int __init it87_find(int sioaddr, unsigned short *address,
2475 else 2480 else
2476 sio_data->skip_in |= BIT(9); 2481 sio_data->skip_in |= BIT(9);
2477 2482
2478 if (!has_six_pwm(config)) 2483 if (!has_five_pwm(config))
2479 sio_data->skip_pwm |= BIT(3) | BIT(4) | BIT(5); 2484 sio_data->skip_pwm |= BIT(3) | BIT(4) | BIT(5);
2485 else if (!has_six_pwm(config))
2486 sio_data->skip_pwm |= BIT(5);
2480 2487
2481 if (!has_vid(config)) 2488 if (!has_vid(config))
2482 sio_data->skip_vid = 1; 2489 sio_data->skip_vid = 1;
@@ -2620,6 +2627,50 @@ static int __init it87_find(int sioaddr, unsigned short *address,
2620 sio_data->skip_fan |= BIT(5); 2627 sio_data->skip_fan |= BIT(5);
2621 } 2628 }
2622 2629
2630 /* Check if AVCC is on VIN3 */
2631 reg = superio_inb(sioaddr, IT87_SIO_PINX2_REG);
2632 if (reg & BIT(0))
2633 sio_data->internal |= BIT(0);
2634 else
2635 sio_data->skip_in |= BIT(9);
2636
2637 sio_data->beep_pin = superio_inb(sioaddr,
2638 IT87_SIO_BEEP_PIN_REG) & 0x3f;
2639 } else if (sio_data->type == it8622) {
2640 int reg;
2641
2642 superio_select(sioaddr, GPIO);
2643
2644 /* Check for pwm4, fan4 */
2645 reg = superio_inb(sioaddr, IT87_SIO_GPIO1_REG);
2646 if (reg & BIT(6))
2647 sio_data->skip_fan |= BIT(3);
2648 if (reg & BIT(5))
2649 sio_data->skip_pwm |= BIT(3);
2650
2651 /* Check for pwm3, fan3, pwm5, fan5 */
2652 reg = superio_inb(sioaddr, IT87_SIO_GPIO3_REG);
2653 if (reg & BIT(6))
2654 sio_data->skip_pwm |= BIT(2);
2655 if (reg & BIT(7))
2656 sio_data->skip_fan |= BIT(2);
2657 if (reg & BIT(3))
2658 sio_data->skip_pwm |= BIT(4);
2659 if (reg & BIT(1))
2660 sio_data->skip_fan |= BIT(4);
2661
2662 /* Check for pwm2, fan2 */
2663 reg = superio_inb(sioaddr, IT87_SIO_GPIO5_REG);
2664 if (reg & BIT(1))
2665 sio_data->skip_pwm |= BIT(1);
2666 if (reg & BIT(2))
2667 sio_data->skip_fan |= BIT(1);
2668
2669 /* Check for AVCC */
2670 reg = superio_inb(sioaddr, IT87_SIO_PINX2_REG);
2671 if (!(reg & BIT(0)))
2672 sio_data->skip_in |= BIT(9);
2673
2623 sio_data->beep_pin = superio_inb(sioaddr, 2674 sio_data->beep_pin = superio_inb(sioaddr,
2624 IT87_SIO_BEEP_PIN_REG) & 0x3f; 2675 IT87_SIO_BEEP_PIN_REG) & 0x3f;
2625 } else { 2676 } else {