Skip to contentSkip to conversation

hwmon: (adt7475) Fixes for acoustics and hysteresis

PATCH Applied Tony O'Brien 2 participants 5 messages Feb 22, 2023 – Feb 25, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover hwmon: (adt7475) Fixes for acoustics and hysteresis

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(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH v2 1/2 hwmon: (adt7475) Display smoothing attributes in correct order

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

---
Changes in v2:
- None

 drivers/hwmon/adt7475.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/adt7475.c +2 -2
index 51b3d16c3223..77222c35a38e 100644
@@ -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;
 	}
 
Signature · 1 line
2.39.2
maintainer Applied
#2 lore raw

Re: [PATCH v2 1/2] hwmon: (adt7475) Display smoothing attributes in correct order

Quoted 7 lines · Tony O'Brien

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

Applied.

Thanks,
Guenter

Quoted 24 lines

---
Changes in v2:
- None

 drivers/hwmon/adt7475.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/adt7475.c +2 -2
index 51b3d16c3223..77222c35a38e 100644
@@ -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;
 	}
 
#3 lore raw

PATCH v2 2/2 hwmon: (adt7475) Fix masking of hysteresis registers

In reply to Tony O'Brien

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

---
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(-)
drivers/hwmon/adt7475.c +2 -2
index 77222c35a38e..6e4c92b500b8 100644
@@ -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);
 		}
 
Signature · 1 line
2.39.2
maintainer Applied
#4 lore raw

Re: [PATCH v2 2/2] hwmon: (adt7475) Fix masking of hysteresis registers

Quoted 6 lines · Tony O'Brien

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

Applied.

Thanks,
Guenter