All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hwmon: (adt7475) Fixes for acoustics and hysteresis
@ 2023-02-22  0:52 Tony O'Brien
  2023-02-22  0:52 ` [PATCH v2 1/2] hwmon: (adt7475) Display smoothing attributes in correct order Tony O'Brien
  2023-02-22  0:52 ` [PATCH v2 2/2] hwmon: (adt7475) Fix masking of hysteresis registers Tony O'Brien
  0 siblings, 2 replies; 5+ messages in thread
From: Tony O'Brien @ 2023-02-22  0:52 UTC (permalink / raw
  To: jdelvare, linux, linux-hwmon; +Cc: chris.packham, hdegoede, linux-kernel

The patches contained herein fix the ADT7475 driver.  The first fixes
the reading of the Enhanced Acoustics Register 2, and the second fixes the
setting of the hysteresis registers.

Tony O'Brien (2):
  hwmon: (adt7475) Display smoothing attributes in correct order
    changes in v2:
    - None
  hwmon: (adt7475) Fix masking of hysteresis registers
    changes in v2:
    - Removed erroneous fix for clamping the hysteresis value. It
      should be an absolute value and not a relative value.

 drivers/hwmon/adt7475.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.39.2


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

* [PATCH v2 1/2] hwmon: (adt7475) Display smoothing attributes in correct order
  2023-02-22  0:52 [PATCH v2 0/2] hwmon: (adt7475) Fixes for acoustics and hysteresis Tony O'Brien
@ 2023-02-22  0:52 ` Tony O'Brien
  2023-02-25 15:02   ` Guenter Roeck
  2023-02-22  0:52 ` [PATCH v2 2/2] hwmon: (adt7475) Fix masking of hysteresis registers Tony O'Brien
  1 sibling, 1 reply; 5+ messages in thread
From: Tony O'Brien @ 2023-02-22  0:52 UTC (permalink / raw
  To: jdelvare, linux, linux-hwmon; +Cc: chris.packham, hdegoede, linux-kernel

Throughout the ADT7475 driver, attributes relating to the temperature
sensors are displayed in the order Remote 1, Local, Remote 2.  Make
temp_st_show() conform to this expectation so that values set by
temp_st_store() can be displayed using the correct attribute.

Fixes: 8f05bcc33e74 ("hwmon: (adt7475) temperature smoothing")
Signed-off-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz>
---
Changes in v2:
- None
 drivers/hwmon/adt7475.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
index 51b3d16c3223..77222c35a38e 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -556,11 +556,11 @@ static ssize_t temp_st_show(struct device *dev, struct device_attribute *attr,
 		val = data->enh_acoustics[0] & 0xf;
 		break;
 	case 1:
-		val = (data->enh_acoustics[1] >> 4) & 0xf;
+		val = data->enh_acoustics[1] & 0xf;
 		break;
 	case 2:
 	default:
-		val = data->enh_acoustics[1] & 0xf;
+		val = (data->enh_acoustics[1] >> 4) & 0xf;
 		break;
 	}
 
-- 
2.39.2


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

* [PATCH v2 2/2] hwmon: (adt7475) Fix masking of hysteresis registers
  2023-02-22  0:52 [PATCH v2 0/2] hwmon: (adt7475) Fixes for acoustics and hysteresis Tony O'Brien
  2023-02-22  0:52 ` [PATCH v2 1/2] hwmon: (adt7475) Display smoothing attributes in correct order Tony O'Brien
@ 2023-02-22  0:52 ` Tony O'Brien
  2023-02-25 15:03   ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Tony O'Brien @ 2023-02-22  0:52 UTC (permalink / raw
  To: jdelvare, linux, linux-hwmon; +Cc: chris.packham, hdegoede, linux-kernel

The wrong bits are masked in the hysteresis register; indices 0 and 2
should zero bits [7:4] and preserve bits [3:0], and index 1 should zero
bits [3:0] and preserve bits [7:4].

Fixes: 1c301fc5394f ("hwmon: Add a driver for the ADT7475 hardware monitoring chip")
Signed-off-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz>
---
Changes in v2:
- Patch headline changed.
- Removed erroneous fix for clamping the hysteresis value. It should be
  an absolute value and not a relative value.
 drivers/hwmon/adt7475.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
index 77222c35a38e..6e4c92b500b8 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -488,10 +488,10 @@ static ssize_t temp_store(struct device *dev, struct device_attribute *attr,
 		val = (temp - val) / 1000;
 
 		if (sattr->index != 1) {
-			data->temp[HYSTERSIS][sattr->index] &= 0xF0;
+			data->temp[HYSTERSIS][sattr->index] &= 0x0F;
 			data->temp[HYSTERSIS][sattr->index] |= (val & 0xF) << 4;
 		} else {
-			data->temp[HYSTERSIS][sattr->index] &= 0x0F;
+			data->temp[HYSTERSIS][sattr->index] &= 0xF0;
 			data->temp[HYSTERSIS][sattr->index] |= (val & 0xF);
 		}
 
-- 
2.39.2


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

* Re: [PATCH v2 1/2] hwmon: (adt7475) Display smoothing attributes in correct order
  2023-02-22  0:52 ` [PATCH v2 1/2] hwmon: (adt7475) Display smoothing attributes in correct order Tony O'Brien
@ 2023-02-25 15:02   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-02-25 15:02 UTC (permalink / raw
  To: Tony O'Brien
  Cc: jdelvare, linux-hwmon, chris.packham, hdegoede, linux-kernel

On Wed, Feb 22, 2023 at 01:52:27PM +1300, Tony O'Brien wrote:
> Throughout the ADT7475 driver, attributes relating to the temperature
> sensors are displayed in the order Remote 1, Local, Remote 2.  Make
> temp_st_show() conform to this expectation so that values set by
> temp_st_store() can be displayed using the correct attribute.
> 
> Fixes: 8f05bcc33e74 ("hwmon: (adt7475) temperature smoothing")
> Signed-off-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz>

Applied.

Thanks,
Guenter

> ---
> Changes in v2:
> - None
>  drivers/hwmon/adt7475.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
> index 51b3d16c3223..77222c35a38e 100644
> --- a/drivers/hwmon/adt7475.c
> +++ b/drivers/hwmon/adt7475.c
> @@ -556,11 +556,11 @@ static ssize_t temp_st_show(struct device *dev, struct device_attribute *attr,
>  		val = data->enh_acoustics[0] & 0xf;
>  		break;
>  	case 1:
> -		val = (data->enh_acoustics[1] >> 4) & 0xf;
> +		val = data->enh_acoustics[1] & 0xf;
>  		break;
>  	case 2:
>  	default:
> -		val = data->enh_acoustics[1] & 0xf;
> +		val = (data->enh_acoustics[1] >> 4) & 0xf;
>  		break;
>  	}
>  

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

* Re: [PATCH v2 2/2] hwmon: (adt7475) Fix masking of hysteresis registers
  2023-02-22  0:52 ` [PATCH v2 2/2] hwmon: (adt7475) Fix masking of hysteresis registers Tony O'Brien
@ 2023-02-25 15:03   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-02-25 15:03 UTC (permalink / raw
  To: Tony O'Brien
  Cc: jdelvare, linux-hwmon, chris.packham, hdegoede, linux-kernel

On Wed, Feb 22, 2023 at 01:52:28PM +1300, Tony O'Brien wrote:
> The wrong bits are masked in the hysteresis register; indices 0 and 2
> should zero bits [7:4] and preserve bits [3:0], and index 1 should zero
> bits [3:0] and preserve bits [7:4].
> 
> Fixes: 1c301fc5394f ("hwmon: Add a driver for the ADT7475 hardware monitoring chip")
> Signed-off-by: Tony O'Brien <tony.obrien@alliedtelesis.co.nz>

Applied.

Thanks,
Guenter

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-22  0:52 [PATCH v2 0/2] hwmon: (adt7475) Fixes for acoustics and hysteresis Tony O'Brien
2023-02-22  0:52 ` [PATCH v2 1/2] hwmon: (adt7475) Display smoothing attributes in correct order Tony O'Brien
2023-02-25 15:02   ` Guenter Roeck
2023-02-22  0:52 ` [PATCH v2 2/2] hwmon: (adt7475) Fix masking of hysteresis registers Tony O'Brien
2023-02-25 15:03   ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.