]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
hwmon: (pmbus) Fix page count auto-detection.
authorDmitry Bazhenov <bazhenov.dn@gmail.com>
Mon, 15 Oct 2018 09:21:22 +0000 (14:21 +0500)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:56:11 +0000 (19:56 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836802
commit e7c6a55606b5c46b449d76588968b4d8caae903f upstream.

Devices with compatible="pmbus" field have zero initial page count,
and pmbus_clear_faults() being called before the page count auto-
detection does not actually clear faults because it depends on the
page count. Non-cleared faults in its turn may fail the subsequent
page count auto-detection.

This patch fixes this problem by calling pmbus_clear_fault_page()
for currently set page and calling pmbus_clear_faults() after the
page count was detected.

Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Bazhenov <bazhenov.dn@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/hwmon/pmbus/pmbus.c
drivers/hwmon/pmbus/pmbus_core.c

index 7718e58dbda543d0687af136c53e551f799f349d..7688dab32f6e6088725d75427d9dccabba99f1fd 100644 (file)
@@ -118,6 +118,8 @@ static int pmbus_identify(struct i2c_client *client,
                } else {
                        info->pages = 1;
                }
+
+               pmbus_clear_faults(client);
        }
 
        if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
index a139940cd991a39544feb1cc8f529a7c92e4bba8..924f3ca41c65a56f40007ea3c323bfbfc9b0b980 100644 (file)
@@ -1802,7 +1802,10 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
        if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
                client->flags |= I2C_CLIENT_PEC;
 
-       pmbus_clear_faults(client);
+       if (data->info->pages)
+               pmbus_clear_faults(client);
+       else
+               pmbus_clear_fault_page(client, -1);
 
        if (info->identify) {
                ret = (*info->identify)(client, info);