diff options
| author | Vincent Jardin <[email protected]> | 2026-07-12 20:20:44 +0200 |
|---|---|---|
| committer | Peng Fan <[email protected]> | 2026-07-13 09:16:57 +0800 |
| commit | 350b7c83b6d5dcb7186562c479acd932cefc9292 (patch) | |
| tree | 10747700c86bfbeba614535d2811501e3002c7a2 /lib | |
| parent | cfb427255287b357a4b08b3d3ba9154137270d61 (diff) | |
power: regulator: add generic PMBus UCLASS_REGULATOR adapter
PMBus regulators differ in numeric formats and quirks, not in how they
are driven. Share that common behaviour as a regulator-uclass adapter
so chip drivers and the pmbus CLI do not each reimplement the decode
and transport, and add a catch-all driver on compatible = "pmbus" for
compliant chips that have no dedicated driver yet.
Gated by CONFIG_DM_REGULATOR_PMBUS_HELPER and
CONFIG_DM_REGULATOR_PMBUS_GENERIC.
Signed-off-by: Vincent Jardin <[email protected]>
Signed-off-by: Peng Fan <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pmbus.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/pmbus.c b/lib/pmbus.c index 4192abde91c..62a66593638 100644 --- a/lib/pmbus.c +++ b/lib/pmbus.c @@ -762,6 +762,23 @@ int pmbus_set_active(int bus_seq, u8 addr) } /* + * No MFR_ID chip-match (a spec compliant part with no per chip + * driver, e.g. a Flex / Delta PSU): if a generic / chip + * UCLASS_REGULATOR is bound at this address, reuse its + * VOUT_MODE detected driver_info so telemetry decodes through + * the right per class formats instead of the blanket + * LINEAR16 / LINEAR11 fallback. + */ + if (CONFIG_IS_ENABLED(DM_REGULATOR_PMBUS_HELPER) && + !pmbus_active_state.info) { + const struct pmbus_driver_info *di = + pmbus_regulator_info_by_addr(bus_seq, addr); + + if (di) + pmbus_active_state.info = di; + } + + /* * MFR_MODEL / MFR_REVISION are best effort. Use the same byte * order the matched chip declared; if nothing matched, use the * forward order. |
