hwmon: (pmbus) Add power good support
authorPatrick Rudolph <patrick.rudolph@9elements.com>
Thu, 17 Nov 2022 18:40:22 +0000 (19:40 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 5 Dec 2022 00:45:03 +0000 (16:45 -0800)
Update error flags with regulation out if regulator is on & power
good status bit is set

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
Link: https://lore.kernel.org/r/20221117184022.1808508-1-Naresh.Solanki@9elements.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/pmbus_core.c

index 7ec04934747e12c9327d806de7a7ca70ed8260a9..20ca26e19db756c6c5ce37352ee999b30a5d469d 100644 (file)
@@ -2827,9 +2827,13 @@ static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsigned
        if (status < 0)
                return status;
 
-       if (pmbus_regulator_is_enabled(rdev) && (status & PB_STATUS_OFF))
-               *flags |= REGULATOR_ERROR_FAIL;
+       if (pmbus_regulator_is_enabled(rdev)) {
+               if (status & PB_STATUS_OFF)
+                       *flags |= REGULATOR_ERROR_FAIL;
 
+               if (status & PB_STATUS_POWER_GOOD_N)
+                       *flags |= REGULATOR_ERROR_REGULATION_OUT;
+       }
        /*
         * Unlike most other status bits, PB_STATUS_{IOUT_OC,VOUT_OV} are
         * defined strictly as fault indicators (not warnings).