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 /include | |
| 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 'include')
| -rw-r--r-- | include/pmbus.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/pmbus.h b/include/pmbus.h index f86e0673e41..0e121fa6637 100644 --- a/include/pmbus.h +++ b/include/pmbus.h @@ -465,6 +465,43 @@ void pmbus_print_telemetry(struct udevice *chip); void pmbus_print_status_word(struct udevice *chip); /* + * Regulator -> thermal bridge. + * + * Read READ_TEMPERATURE_1 (8Dh) from a UCLASS_REGULATOR device that + * was bound by a pmbus_helper based chip driver, decode it through + * the chip's pmbus_driver_info (so the MPS DIRECT 1 degC/LSB quirk + * and the standard LINEAR11 encoding are both handled), select the + * regulator's PAGE first on multi rail parts, and return the result + * in millidegrees Celsius. + * + * This is what the generic drivers/thermal/pmbus_thermal.c companion + * calls on its parent; keeping the decode here avoids exposing the + * regulator-private pmbus_regulator_priv layout to other subsystems. + * + * Returns 0 on success, or a negative errno (-ENODEV if reg is not a + * probed pmbus regulator, -EIO on bus error). + */ +int pmbus_regulator_read_temp(struct udevice *reg_dev, int *temp_mc); + +/* + * Look up the pmbus_driver_info of a probed UCLASS_REGULATOR device at + * (bus_seq, addr) that is driven by a pmbus_helper based chip driver + * (mpq8785, pmbus_generic, ...). Probes the device so its identify + * hook has run and format[] is populated, then returns its + * driver_info. Returns NULL if no such regulator is bound at that + * address, if the device is not a pmbus regulator, or if + * CONFIG_DM_REGULATOR_PMBUS_HELPER is disabled. + * + * Lets pmbus_set_active() -- and thus the pmbus CLI and the board + * boot snapshots -- reuse the rich, VOUT_MODE detected driver_info of + * a DT bound generic / chip regulator when the device is selected by + * raw <bus>:<addr> (which has no chip-match registry entry and would + * otherwise fall back to blanket LINEAR16 / LINEAR11 decoding). + */ +const struct pmbus_driver_info *pmbus_regulator_info_by_addr(int bus_seq, + u8 addr); + +/* * Status bit name decoding. * * Sparse mask to name table. pmbus_print_bits() emits only the bits |
