Message ID | 20230430045032.1723288-1-frank@crawford.emu.id.au (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v1] hwmon: (it87) Allow for chips with only 4 temp sensors | expand |
On Sun, Apr 30, 2023 at 02:50:32PM +1000, Frank Crawford wrote: > 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> Applied to hwmon-next. Thanks, Guenter > --- > drivers/hwmon/it87.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c > index 96c17660ff0f..4c3641d28a6a 100644 > --- a/drivers/hwmon/it87.c > +++ b/drivers/hwmon/it87.c > @@ -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 */
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 96c17660ff0f..4c3641d28a6a 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -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 */
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> --- drivers/hwmon/it87.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)