diff options
author | Erik Rosen <erik.rosen@metormote.com> | 2021-06-09 11:32:05 +0200 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2021-06-17 13:21:46 +0200 |
commit | dbc0860f7a3d43604c380822a456d26ef6f70a06 (patch) | |
tree | 918521228b372ed549be2d0292b0cced872a8b63 /drivers/hwmon | |
parent | docs: hwmon: adm1177.rst: avoid using ReSt :doc:`foo` markup (diff) | |
download | linux-dbc0860f7a3d43604c380822a456d26ef6f70a06.tar.xz linux-dbc0860f7a3d43604c380822a456d26ef6f70a06.zip |
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/pmbus/pmbus_core.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index 01a1ffc74bb6..a5367df1cee8 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c @@ -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 * limit registers need to be disabled. */ - ret = i2c_smbus_read_byte_data(client, PMBUS_WRITE_PROTECT); - if (ret > 0 && (ret & PB_WP_ANY)) - data->flags |= PMBUS_WRITE_PROTECTED | PMBUS_SKIP_STATUS_CHECK; + if (!(data->flags & PMBUS_NO_WRITE_PROTECT)) { + ret = i2c_smbus_read_byte_data(client, PMBUS_WRITE_PROTECT); + if (ret > 0 && (ret & PB_WP_ANY)) + data->flags |= PMBUS_WRITE_PROTECTED | PMBUS_SKIP_STATUS_CHECK; + } if (data->info->pages) pmbus_clear_faults(client); |