Commit 14605e67 authored by Dmitry Bazhenov's avatar Dmitry Bazhenov Committed by Kleber Sacilotto de Souza

hwmon: (pmbus) Fix page count auto-detection.

BugLink: https://bugs.launchpad.net/bugs/1810947

commit e7c6a556 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: default avatarDmitry Bazhenov <bazhenov.dn@gmail.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 6875af7c
...@@ -117,6 +117,8 @@ static int pmbus_identify(struct i2c_client *client, ...@@ -117,6 +117,8 @@ static int pmbus_identify(struct i2c_client *client,
} else { } else {
info->pages = 1; info->pages = 1;
} }
pmbus_clear_faults(client);
} }
if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) { if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
......
...@@ -1759,7 +1759,10 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data, ...@@ -1759,7 +1759,10 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK)) if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
client->flags |= I2C_CLIENT_PEC; 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) { if (info->identify) {
ret = (*info->identify)(client, info); ret = (*info->identify)(client, info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment