hwmon: (pmbus) Fix page count auto-detection.
PATCH 1/1 hwmon: (pmbus) Fix page count auto-detection.
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.
--- drivers/hwmon/pmbus/pmbus.c | 2 ++ drivers/hwmon/pmbus/pmbus_core.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus.c +2 -0
@@ -118,6 +118,8 @@ static int pmbus_identify(struct i2c_client *client, }else { info->pages =1 ; } + +pmbus_clear_faults (client); }if (pmbus_check_byte_register (client,0 ,PMBUS_VOUT_MODE )) {
drivers/hwmon/pmbus/pmbus_core.c +4 -1
@@ -2015,7 +2015,10 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,if (ret >=0 && (ret &PB_CAPABILITY_ERROR_CHECK )) 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) { ret = (*info->identify)(client, info);
Signature · 1 line
2.17.1
Quoted 11 lines · Dmitry Bazhenov
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 callingpmbus_clear_faults()after the page count was detected.Signed-off-by Dmitry Bazhenov <[email protected]>
Applied.
Thanks,
Guenter
Quoted 34 lines
--- drivers/hwmon/pmbus/pmbus.c | 2 ++ drivers/hwmon/pmbus/pmbus_core.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-)drivers/hwmon/pmbus/pmbus.c +2
-0@@ -118,6 +118,8 @@ static int pmbus_identify(struct i2c_client *client, }else { info->pages =1 ; } + +pmbus_clear_faults (client); }if (pmbus_check_byte_register (client,0 ,PMBUS_VOUT_MODE )) {drivers/hwmon/pmbus/pmbus_core.c +4
-1@@ -2015,7 +2015,10 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,if (ret >=0 && (ret &PB_CAPABILITY_ERROR_CHECK )) 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) { ret = (*info->identify)(client, info);