Commit 86c908d9 authored by Erik Rosen's avatar Erik Rosen Committed by Guenter Roeck

hwmon: (pmbus) Add new flag PMBUS_READ_STATUS_AFTER_FAILED_CHECK

Some PMBus chips end up in an undefined state when trying to read an
unsupported register. For such chips, it is necessary to reset the
chip pmbus controller to a known state after a failed register check.
This can be done by reading a known register. By setting this flag the
driver will try to read the STATUS register after each failed
register check. This read may fail, but it will put the chip into a
known state.
Signed-off-by: default avatarErik Rosen <erik.rosen@metormote.com>
Link: https://lore.kernel.org/r/20210507194023.61138-2-erik.rosen@metormote.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 5c1c78e0
...@@ -523,6 +523,8 @@ static bool pmbus_check_register(struct i2c_client *client, ...@@ -523,6 +523,8 @@ static bool pmbus_check_register(struct i2c_client *client,
rv = func(client, page, reg); rv = func(client, page, reg);
if (rv >= 0 && !(data->flags & PMBUS_SKIP_STATUS_CHECK)) if (rv >= 0 && !(data->flags & PMBUS_SKIP_STATUS_CHECK))
rv = pmbus_check_status_cml(client); rv = pmbus_check_status_cml(client);
if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK))
data->read_status(client, -1);
pmbus_clear_fault_page(client, -1); pmbus_clear_fault_page(client, -1);
return rv >= 0; return rv >= 0;
} }
......
...@@ -43,6 +43,19 @@ ...@@ -43,6 +43,19 @@
*/ */
#define PMBUS_NO_CAPABILITY BIT(2) #define PMBUS_NO_CAPABILITY BIT(2)
/*
* PMBUS_READ_STATUS_AFTER_FAILED_CHECK
*
* Some PMBus chips end up in an undefined state when trying to read an
* unsupported register. For such chips, it is necessary to reset the
* chip pmbus controller to a known state after a failed register check.
* This can be done by reading a known register. By setting this flag the
* driver will try to read the STATUS register after each failed
* register check. This read may fail, but it will put the chip in a
* known state.
*/
#define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(3)
struct pmbus_platform_data { struct pmbus_platform_data {
u32 flags; /* Device specific flags */ u32 flags; /* Device specific flags */
......
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