linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hwmon (it87): Add scaling macro for recent ADC voltages
@ 2023-03-18  8:05 Frank Crawford
  2023-03-18  8:05 ` [PATCH v2 1/2] " Frank Crawford
  2023-03-18  8:05 ` [PATCH v2 2/2] hwmon (it87): Generalise matching labels Frank Crawford
  0 siblings, 2 replies; 5+ messages in thread
From: Frank Crawford @ 2023-03-18  8:05 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck; +Cc: linux-hwmon, Frank Crawford

Generalise scaling to include all recent ADC values and match the labels
for internal voltage sensors.

This includes correction of an existing error for voltage scaling for
chips that have 10.9mV ADCs, where scaling was not performed.

---

Changes since v1:
 * Split the original patch into two separate patches, one logical
   change per patch.

Frank Crawford (2):
  hwmon: (it87) Add scaling macro for recent ADC voltages
  hwmon: (it87) Generalise matching labels

 drivers/hwmon/it87.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] hwmon (it87): Add scaling macro for recent ADC voltages
  2023-03-18  8:05 [PATCH v2 0/2] hwmon (it87): Add scaling macro for recent ADC voltages Frank Crawford
@ 2023-03-18  8:05 ` Frank Crawford
  2023-03-21 15:00   ` Guenter Roeck
  2023-03-18  8:05 ` [PATCH v2 2/2] hwmon (it87): Generalise matching labels Frank Crawford
  1 sibling, 1 reply; 5+ messages in thread
From: Frank Crawford @ 2023-03-18  8:05 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck; +Cc: linux-hwmon, Frank Crawford

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(-)

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))
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] hwmon (it87): Generalise matching labels
  2023-03-18  8:05 [PATCH v2 0/2] hwmon (it87): Add scaling macro for recent ADC voltages Frank Crawford
  2023-03-18  8:05 ` [PATCH v2 1/2] " Frank Crawford
@ 2023-03-18  8:05 ` Frank Crawford
  2023-03-21 15:02   ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Frank Crawford @ 2023-03-18  8:05 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck; +Cc: linux-hwmon, Frank Crawford

Apply scaling macro to match the labels for internal voltage sensors.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
---

v2:
 * Split out the change to match labels to a separate patch.

---
 drivers/hwmon/it87.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index e9614eb557d4..f774a0732a7c 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -2004,7 +2004,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr,
 
 	if (has_vin3_5v(data) && nr == 0)
 		label = labels[0];
-	else if (has_12mv_adc(data) || has_10_9mv_adc(data))
+	else if (has_scaling(data))
 		label = labels_it8721[nr];
 	else
 		label = labels[nr];
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] hwmon (it87): Add scaling macro for recent ADC voltages
  2023-03-18  8:05 ` [PATCH v2 1/2] " Frank Crawford
@ 2023-03-21 15:00   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-03-21 15:00 UTC (permalink / raw)
  To: Frank Crawford; +Cc: Jean Delvare, linux-hwmon

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))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] hwmon (it87): Generalise matching labels
  2023-03-18  8:05 ` [PATCH v2 2/2] hwmon (it87): Generalise matching labels Frank Crawford
@ 2023-03-21 15:02   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-03-21 15:02 UTC (permalink / raw)
  To: Frank Crawford; +Cc: Jean Delvare, linux-hwmon

On Sat, Mar 18, 2023 at 07:05:43PM +1100, Frank Crawford wrote:
> Apply scaling macro to match the labels for internal voltage sensors.
> 
> Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>

Applied. Please note that I updated the subject because "Generalise
matching labels" didn't really describe what the patch is doing.

> ---
> 
> v2:
>  * Split out the change to match labels to a separate patch.
> 
> ---
>  drivers/hwmon/it87.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
> index e9614eb557d4..f774a0732a7c 100644
> --- a/drivers/hwmon/it87.c
> +++ b/drivers/hwmon/it87.c
> @@ -2004,7 +2004,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr,
>  
>  	if (has_vin3_5v(data) && nr == 0)
>  		label = labels[0];
> -	else if (has_12mv_adc(data) || has_10_9mv_adc(data))
> +	else if (has_scaling(data))
>  		label = labels_it8721[nr];
>  	else
>  		label = labels[nr];

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-21 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-18  8:05 [PATCH v2 0/2] hwmon (it87): Add scaling macro for recent ADC voltages Frank Crawford
2023-03-18  8:05 ` [PATCH v2 1/2] " Frank Crawford
2023-03-21 15:00   ` Guenter Roeck
2023-03-18  8:05 ` [PATCH v2 2/2] hwmon (it87): Generalise matching labels Frank Crawford
2023-03-21 15:02   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).