Skip to content

Commit 89d96f1

Browse files
paulfertsergregkh
authored andcommitted
hwmon: (tmp421) report /PVLD condition as fault
[ Upstream commit 540effa ] 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 <fercerpav@gmail.com> Link: https://lore.kernel.org/r/20210924093011.26083-2-fercerpav@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 560271d commit 89d96f1

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

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