hwmon: (pmbus/tps53679) Select page 0 for single-page parts
Subsystems (3)
v2 cover hwmon: (pmbus/tps53679) Select page 0 for single-page parts
From: Sanman Pradhan <[email protected]>
For single-page TPS53676 and TPS536C7 configurations the PAGE register is never normalised: pmbus_set_page() only writes PAGE when info->pages > 1, so a page left selected by the boot firmware persists and telemetry is read from the wrong page. Select page 0 explicitly in the two identify routines.
Patch 1 fixes the pre-existing TPS53676 issue and carries Fixes/stable tags. Patch 2 fixes the newly added TPS536C7 support; the TPS536C7 series has already been applied by the hwmon maintainer but is not yet in a released kernel, so patch 2 carries no stable tag.
These patches are based on top of the previously submitted TPS536C7 series.
Changes in v2:
- Drop the PAGE read-back/verify; just write PAGE = 0.
Sanman Pradhan (2):
hwmon: (pmbus/tps53679) Select page 0 for single-page TPS53676
hwmon: (pmbus/tps53679) Select page 0 for single-page TPS536C7
drivers/hwmon/pmbus/tps53679.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
Signature · 1 line
2.34.1
PATCH v2 1/2 hwmon: (pmbus/tps53679) Select page 0 for single-page TPS53676
From: Sanman Pradhan <[email protected]>
tps53676_identify() derives the number of PMBus pages but does not ensure that page 0 is selected for single-page configurations. pmbus_set_page() does not update the PAGE register when info->pages is 1, so if boot firmware leaves PAGE set to another value subsequent register accesses may target the wrong page.
For single-page devices, select page 0 explicitly.
--- drivers/hwmon/pmbus/tps53679.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hwmon/pmbus/tps53679.c +9 -0
@@ -246,6 +246,15 @@ static int tps53676_identify(struct i2c_client *client,if (phases_b >0 ) { info->pages =2 ; info->phases[1 ] = phases_b; + }else { +/* +* pmbus_set_page() does not update the PAGE register on +* single-page devices, so select page 0 explicitly in case +* the boot firmware left the device on another page. +*/ + ret =i2c_smbus_write_byte_data (client,PMBUS_PAGE ,0 ); +if (ret <0 ) +return ret; }return 0 ;
Signature · 1 line
2.34.1
Re: [PATCH v2 1/2] hwmon: (pmbus/tps53679) Select page 0 for single-page TPS53676
Quoted 8 lines · Sanman
From: Sanman Pradhan <[email protected]>
tps53676_identify()derives the number of PMBus pages but does not ensure that page 0 is selected for single-page configurations.pmbus_set_page()does not update the PAGE register wheninfo->pagesis 1, so if boot firmware leaves PAGE set to another value subsequent register accesses may target the wrong page.
Quoted 5 lines
For single-page devices, select page 0 explicitly.
Fixes cb3d37b59012 ("hwmon: (pmbus/tps53679) Add support for TI TPS53676")Signed-off-by Sanman Pradhan <[email protected]>
Applied.
Thanks,
Guenter
PATCH v2 2/2 hwmon: (pmbus/tps53679) Select page 0 for single-page TPS536C7
In reply to Pradhan, SanmanFrom: Sanman Pradhan <[email protected]>
tps536c7_identify() sets info->pages to 1 for a single-channel part and then accesses page 0 (writing PMBUS_PHASE) without ensuring PAGE is actually 0. pmbus_set_page() does not update the PAGE register when info->pages is 1, so if boot firmware left PAGE set to another value the PHASE writes and subsequent telemetry may target the wrong page.
Select page 0 explicitly before configuring PHASE.
--- drivers/hwmon/pmbus/tps53679.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/hwmon/pmbus/tps53679.c +11 -0
@@ -284,6 +284,17 @@ static int tps536c7_identify(struct i2c_client *client,*/ info->pages = phases_b ?2 :1 ; +/* +* pmbus_set_page() does not update the PAGE register on single-page +* devices, so select page 0 explicitly in case the boot firmware +* left the device on another page. +*/ +if (info->pages ==1 ) { + ret =i2c_smbus_write_byte_data (client,PMBUS_PAGE ,0 ); +if (ret <0 ) +return ret; + } +/* * With info->phases[] left unset the PMBus core never programs the * PHASE selector, so make sure each page reports the aggregate
Signature · 1 line
2.34.1
Re: [PATCH v2 2/2] hwmon: (pmbus/tps53679) Select page 0 for single-page TPS536C7
Quoted 11 lines · Sanman
From: Sanman Pradhan <[email protected]>
tps536c7_identify()setsinfo->pagesto 1 for a single-channel part and then accesses page 0 (writingPMBUS_PHASE) without ensuring PAGE is actually 0.pmbus_set_page()does not update the PAGE register wheninfo->pagesis 1, so if boot firmware left PAGE set to another value the PHASE writes and subsequent telemetry may target the wrong page.Select page 0 explicitly before configuring PHASE.
Signed-off-by Sanman Pradhan <[email protected]>
Applied.
Thanks,
Guenter