hwmon: (adt7475) Fixes for acoustics and hysteresis
Subsystems (2)
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
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.
---
Changes in v2:
- None
drivers/hwmon/adt7475.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/adt7475.c +2 -2
@@ -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
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 bytemp_st_store()can be displayed using the correct attribute.Fixes 8f05bcc33e74 ("hwmon: (adt7475) temperature smoothing")Signed-off-by Tony O'Brien <[email protected]>
Applied.
Thanks,
Guenter
Quoted 24 lines
---
Changes in v2:
- Nonedrivers/hwmon/adt7475.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/hwmon/adt7475.c +2
-2@@ -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 ; }
PATCH v2 2/2 hwmon: (adt7475) Fix masking of hysteresis registers
In reply to Tony O'BrienThe 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].
---
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
@@ -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
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")Signed-off-by Tony O'Brien <[email protected]>
Applied.
Thanks,
Guenter