]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
hwmon: (pmbus) Clear pmbus fault/warning bits after read
authorVikash Chandola <vikash.chandola@linux.intel.com>
Tue, 22 Feb 2022 13:12:53 +0000 (13:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Mar 2022 13:16:00 +0000 (14:16 +0100)
[ Upstream commit 35f165f08950a876f1b95a61d79c93678fba2fd6 ]

Almost all fault/warning bits in pmbus status registers remain set even
after fault/warning condition are removed. As per pmbus specification
these faults must be cleared by user.
Modify hwmon behavior to clear fault/warning bit after fetching data if
fault/warning bit was set. This allows to get fresh data in next read.

Signed-off-by: Vikash Chandola <vikash.chandola@linux.intel.com>
Link: https://lore.kernel.org/r/20220222131253.2426834-1-vikash.chandola@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/pmbus/pmbus_core.c

index b0e2820a2d578f62ca0db7ac565ca5404065c790..71798fde2ef0c93280698c355f190273b429f05b 100644 (file)
@@ -898,6 +898,11 @@ static int pmbus_get_boolean(struct i2c_client *client, struct pmbus_boolean *b,
                pmbus_update_sensor_data(client, s2);
 
        regval = status & mask;
+       if (regval) {
+               ret = pmbus_write_byte_data(client, page, reg, regval);
+               if (ret)
+                       goto unlock;
+       }
        if (s1 && s2) {
                s64 v1, v2;