summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-04-03 23:56:53 +0930
committerJoel Stanley <joel@jms.id.au>2019-03-20 15:13:32 +1030
commitade8659868cc154466dc3fa768d9d55709e2f262 (patch)
tree12e31115533079e20b096ecdc0371f6241a42e73 /drivers/hwmon
parent3d2b51afcdb3afcc26f05346f8e9c27cddb691bc (diff)
downloadblackbird-obmc-linux-ade8659868cc154466dc3fa768d9d55709e2f262.tar.gz
blackbird-obmc-linux-ade8659868cc154466dc3fa768d9d55709e2f262.zip
pmbus (core): One-shot retries for failure to set page
Work around the shonky behaviour seen with the MAX31785 where we fail to set the page register in some circumstances. There's no real elegant way to do this. We can propagate the error up, but that forces us to retry the operation way up the call tree in any number of places. It also forces callers to split out pmbus_set_page() from the pmbus_{read,write}_{byte,word}_data() functions in order to differentiate between a failure to set the page and a failure to read a register (that might not exist, in which case an error is anticiptated). OpenBMC-Staging-Count: 6 Cc: Eddie James <eajames@linux.vnet.ibm.com> Cc: Matt Spinler <mspinler@linux.vnet.ibm.com> Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Eddie James <eajames@linux.vnet.ibm.com> Tested-by: George Keishing <gkeishin@in.ibm.com> Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/pmbus/pmbus_core.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 2e2b5851139c..dc986d8fca20 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -168,9 +168,17 @@ int pmbus_set_page(struct i2c_client *client, int page)
return 0;
if (!(data->info->func[page] & PMBUS_PAGE_VIRTUAL)) {
+ dev_dbg(&client->dev, "Want page %u, %u cached\n", page,
+ data->currpage);
+
rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE, page);
- if (rv < 0)
- return rv;
+ if (rv) {
+ rv = i2c_smbus_write_byte_data(client, PMBUS_PAGE,
+ page);
+ dev_dbg(&client->dev,
+ "Failed to set page %u, performed one-shot retry %s: %d\n",
+ page, rv ? "and failed" : "with success", rv);
+ }
rv = i2c_smbus_read_byte_data(client, PMBUS_PAGE);
if (rv < 0)
OpenPOWER on IntegriCloud