Skip to content

Commit 540effa

Browse files
paulfertsergroeck
authored andcommitted
hwmon: (tmp421) report /PVLD condition as fault
For both local and remote sensors all the supported ICs can report an "undervoltage lockout" condition which means the conversion wasn't properly performed due to insufficient power supply voltage and so the measurement results can't be trusted. Fixes: 9410700 ("hwmon: Add driver for Texas Instruments TMP421/422/423 sensor chips") Signed-off-by: Paul Fertser <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 2938b29 commit 540effa

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/hwmon/tmp421.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ static int tmp421_read(struct device *dev, enum hwmon_sensor_types type,
179179
return 0;
180180
case hwmon_temp_fault:
181181
/*
182-
* The OPEN bit signals a fault. This is bit 0 of the temperature
183-
* register (low byte).
182+
* Any of OPEN or /PVLD bits indicate a hardware mulfunction
183+
* and the conversion result may be incorrect
184184
*/
185-
*val = tmp421->temp[channel] & 0x01;
185+
*val = !!(tmp421->temp[channel] & 0x03);
186186
return 0;
187187
default:
188188
return -EOPNOTSUPP;
@@ -195,9 +195,6 @@ static umode_t tmp421_is_visible(const void *data, enum hwmon_sensor_types type,
195195
{
196196
switch (attr) {
197197
case hwmon_temp_fault:
198-
if (channel == 0)
199-
return 0;
200-
return 0444;
201198
case hwmon_temp_input:
202199
return 0444;
203200
default:

0 commit comments

Comments
 (0)