Message ID | 20230318080543.1226700-2-frank@crawford.emu.id.au (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | hwmon (it87): Add scaling macro for recent ADC voltages | expand |
On Sat, Mar 18, 2023 at 07:05:42PM +1100, Frank Crawford wrote: > Generalise scaling to include all recent ADC values. > > This includes correction of an existing error for voltage scaling for > chips that have 10.9mV ADCs, where scaling was not performed. > > Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> Applied. Note that I changed both subject and description to focus on the bug fix. Guenter > --- > > v2: > * Split out the change to the scaling in a separate patch. > > --- > drivers/hwmon/it87.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c > index 66f7ceaa7c3f..e9614eb557d4 100644 > --- a/drivers/hwmon/it87.c > +++ b/drivers/hwmon/it87.c > @@ -515,6 +515,8 @@ static const struct it87_devices it87_devices[] = { > #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) > +#define has_scaling(data) ((data)->features & (FEAT_12MV_ADC | \ > + FEAT_10_9MV_ADC)) > > struct it87_sio_data { > int sioaddr; > @@ -3134,7 +3136,7 @@ static int it87_probe(struct platform_device *pdev) > "Detected broken BIOS defaults, disabling PWM interface\n"); > > /* Starting with IT8721F, we handle scaling of internal voltages */ > - if (has_12mv_adc(data)) { > + if (has_scaling(data)) { > if (sio_data->internal & BIT(0)) > data->in_scaled |= BIT(3); /* in3 is AVCC */ > if (sio_data->internal & BIT(1))
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 66f7ceaa7c3f..e9614eb557d4 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -515,6 +515,8 @@ static const struct it87_devices it87_devices[] = { #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) +#define has_scaling(data) ((data)->features & (FEAT_12MV_ADC | \ + FEAT_10_9MV_ADC)) struct it87_sio_data { int sioaddr; @@ -3134,7 +3136,7 @@ static int it87_probe(struct platform_device *pdev) "Detected broken BIOS defaults, disabling PWM interface\n"); /* Starting with IT8721F, we handle scaling of internal voltages */ - if (has_12mv_adc(data)) { + if (has_scaling(data)) { if (sio_data->internal & BIT(0)) data->in_scaled |= BIT(3); /* in3 is AVCC */ if (sio_data->internal & BIT(1))
Generalise scaling to include all recent ADC values. This includes correction of an existing error for voltage scaling for chips that have 10.9mV ADCs, where scaling was not performed. Signed-off-by: Frank Crawford <frank@crawford.emu.id.au> --- v2: * Split out the change to the scaling in a separate patch. --- drivers/hwmon/it87.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)