hwmon: (pmbus) Add new pmbus flag NO_WRITE_PROTECT
Some PMBus chips respond with invalid data when reading the WRITE_PROTECT register. For such chips, this flag should be set so that the PMBus core driver doesn't use the WRITE_PROTECT command to determine its behavior. Signed-off-by: Erik Rosen <erik.rosen@metormote.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
ff53b77e1e
commit
dbc0860f7a
|
@ -2231,9 +2231,11 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
|
||||||
* faults, and we should not try it. Also, in that case, writes into
|
* faults, and we should not try it. Also, in that case, writes into
|
||||||
* limit registers need to be disabled.
|
* limit registers need to be disabled.
|
||||||
*/
|
*/
|
||||||
ret = i2c_smbus_read_byte_data(client, PMBUS_WRITE_PROTECT);
|
if (!(data->flags & PMBUS_NO_WRITE_PROTECT)) {
|
||||||
if (ret > 0 && (ret & PB_WP_ANY))
|
ret = i2c_smbus_read_byte_data(client, PMBUS_WRITE_PROTECT);
|
||||||
data->flags |= PMBUS_WRITE_PROTECTED | PMBUS_SKIP_STATUS_CHECK;
|
if (ret > 0 && (ret & PB_WP_ANY))
|
||||||
|
data->flags |= PMBUS_WRITE_PROTECTED | PMBUS_SKIP_STATUS_CHECK;
|
||||||
|
}
|
||||||
|
|
||||||
if (data->info->pages)
|
if (data->info->pages)
|
||||||
pmbus_clear_faults(client);
|
pmbus_clear_faults(client);
|
||||||
|
|
|
@ -56,6 +56,15 @@
|
||||||
*/
|
*/
|
||||||
#define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(3)
|
#define PMBUS_READ_STATUS_AFTER_FAILED_CHECK BIT(3)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PMBUS_NO_WRITE_PROTECT
|
||||||
|
*
|
||||||
|
* Some PMBus chips respond with invalid data when reading the WRITE_PROTECT
|
||||||
|
* register. For such chips, this flag should be set so that the PMBus core
|
||||||
|
* driver doesn't use the WRITE_PROTECT command to determine its behavior.
|
||||||
|
*/
|
||||||
|
#define PMBUS_NO_WRITE_PROTECT BIT(4)
|
||||||
|
|
||||||
struct pmbus_platform_data {
|
struct pmbus_platform_data {
|
||||||
u32 flags; /* Device specific flags */
|
u32 flags; /* Device specific flags */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue