summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Jardin <[email protected]>2026-07-12 20:20:47 +0200
committerPeng Fan <[email protected]>2026-07-13 11:23:28 +0800
commita5639a4d7bc53bf8e9a132f4e48eb0237fa588b3 (patch)
tree0a3020725afe8029d3138f0bc941c116b378831b
parent073bc87752f1aa2675bc078b4d7b7347b544c552 (diff)
thermal: pmbus: add PMBus die-temp driver
The driver is a thin UCLASS_THERMAL: its get_temp reads the temperature of its parent regulator through the pmbus helper (READ_TEMPERATURE_1), without any chip-specific code. Signed-off-by: Vincent Jardin <[email protected]> Signed-off-by: Peng Fan <[email protected]>
-rw-r--r--MAINTAINERS1
-rw-r--r--drivers/thermal/Kconfig8
-rw-r--r--drivers/thermal/Makefile1
-rw-r--r--drivers/thermal/pmbus_thermal.c33
4 files changed, 43 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 4c9d33f5b3a..f60c58ed353 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1541,6 +1541,7 @@ F: drivers/power/regulator/mpq8785.c
F: drivers/power/regulator/pmbus_generic.c
F: drivers/power/regulator/pmbus_helper.c
F: drivers/power/regulator/pmbus_helper.h
+F: drivers/thermal/pmbus_thermal.c
F: include/pmbus.h
F: lib/pmbus.c
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 9ad0d699850..3b7e807a024 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -63,4 +63,12 @@ config DM_THERMAL_JC42
Enable support for the JEDEC JC-42.4 temperature sensor found
on the SPD bus of DDR3 and DDR4 DIMMs (TSE2004av and compatible).
+config PMBUS_THERMAL
+ bool "Generic PMBus temperature"
+ depends on DM_REGULATOR_PMBUS_HELPER
+ help
+ Expose the die-temperature reading of any PMBus voltage
+ regulator bound by a pmbus_helper based chip driver
+ as a UCLASS_THERMAL device.
+
endif # if DM_THERMAL
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index c9fa7561b45..475026a5ab2 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -12,3 +12,4 @@ obj-$(CONFIG_SANDBOX) += thermal_sandbox.o
obj-$(CONFIG_TI_DRA7_THERMAL) += ti-bandgap.o
obj-$(CONFIG_TI_LM74_THERMAL) += ti-lm74.o
obj-$(CONFIG_DM_THERMAL_JC42) += jc42.o
+obj-$(CONFIG_PMBUS_THERMAL) += pmbus_thermal.o
diff --git a/drivers/thermal/pmbus_thermal.c b/drivers/thermal/pmbus_thermal.c
new file mode 100644
index 00000000000..c251cea8ddf
--- /dev/null
+++ b/drivers/thermal/pmbus_thermal.c
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2026 Free Mobile - Vincent Jardin
+ *
+ * Generic UCLASS_THERMAL companion for PMBus voltage regulators.
+ *
+ * Works with any chip bound by a pmbus_helper based regulator driver
+ * (drivers/power/regulator/<chip>.c calling
+ * pmbus_regulator_probe_common()). It auto-spawns one
+ * of these thermal devices per regulator.
+ *
+ * The reading is the chip's READ_TEMPERATURE_1 (PMBus 0x8D), decoded
+ * through the parent's pmbus_driver_info.
+ */
+
+#include <dm.h>
+#include <pmbus.h>
+#include <thermal.h>
+
+static int pmbus_thermal_get_temp(struct udevice *dev, int *temp)
+{
+ return pmbus_regulator_read_temp(dev_get_parent(dev), temp);
+}
+
+static const struct dm_thermal_ops pmbus_thermal_ops = {
+ .get_temp = pmbus_thermal_get_temp,
+};
+
+U_BOOT_DRIVER(pmbus_thermal) = {
+ .name = "pmbus_thermal",
+ .id = UCLASS_THERMAL,
+ .ops = &pmbus_thermal_ops,
+};