hwmon: (it87) Allow for chips with only 4 temp sensors
authorFrank Crawford <frank@crawford.emu.id.au>
Sun, 30 Apr 2023 04:50:32 +0000 (14:50 +1000)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 8 Jun 2023 13:41:17 +0000 (06:41 -0700)
Some chips are known to only have 4 temperature sensors and there is no
requirement to test for more.  Currently only the IT8622E fits this
category.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
Link: https://lore.kernel.org/r/20230430045032.1723288-1-frank@crawford.emu.id.au
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/it87.c

index 96c1766..4c3641d 100644 (file)
@@ -319,6 +319,7 @@ struct it87_devices {
 #define FEAT_CONF_NOEXIT       BIT(19) /* Chip should not exit conf mode */
 #define FEAT_FOUR_FANS         BIT(20) /* Supports four fans */
 #define FEAT_FOUR_PWM          BIT(21) /* Supports four fan controls */
+#define FEAT_FOUR_TEMP         BIT(22)
 
 static const struct it87_devices it87_devices[] = {
        [it87] = {
@@ -475,7 +476,7 @@ static const struct it87_devices it87_devices[] = {
                .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
                  | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS
                  | FEAT_FIVE_PWM | FEAT_IN7_INTERNAL | FEAT_PWM_FREQ2
-                 | FEAT_AVCC3 | FEAT_VIN3_5V,
+                 | FEAT_AVCC3 | FEAT_VIN3_5V | FEAT_FOUR_TEMP,
                .peci_mask = 0x07,
                .smbus_bitmap = BIT(1) | BIT(2),
        },
@@ -527,6 +528,7 @@ static const struct it87_devices it87_devices[] = {
                                                     FEAT_SIX_PWM))
 #define has_six_pwm(data)      ((data)->features & FEAT_SIX_PWM)
 #define has_pwm_freq2(data)    ((data)->features & FEAT_PWM_FREQ2)
+#define has_four_temp(data)    ((data)->features & FEAT_FOUR_TEMP)
 #define has_six_temp(data)     ((data)->features & FEAT_SIX_TEMP)
 #define has_vin3_5v(data)      ((data)->features & FEAT_VIN3_5V)
 #define has_conf_noexit(data)  ((data)->features & FEAT_CONF_NOEXIT)
@@ -3393,7 +3395,9 @@ static int it87_probe(struct platform_device *pdev)
        data->need_in7_reroute = sio_data->need_in7_reroute;
        data->has_in = 0x3ff & ~sio_data->skip_in;
 
-       if (has_six_temp(data)) {
+       if (has_four_temp(data)) {
+               data->has_temp |= BIT(3);
+       } else if (has_six_temp(data)) {
                u8 reg = it87_read_value(data, IT87_REG_TEMP456_ENABLE);
 
                /* Check for additional temperature sensors */