Re: [PATCH v5 2/3] firmware: raspberrypi: Register PMIC hwmon driver on Pi 5
From: Stefan Wahren
Date: Tue Dec 01 2026 - 07:41:26 EST
Hi Sander,
Am 26.11.26 um 14:03 schrieb Sander Speetjens:
Register the raspberrypi-pmic-hwmon platform devicesince the PMIC hwmon driver rely on the recently added RPI_FIRMWARE_GET_PMIC_ADC, I suggest to check the function of the firmware tag before registering the driver just like the other hwmon driver does. I don't know the behavior on non-Pi 5 platforms, but maybe this also could replace these of_machine_is_compatible() checks?
on BCM2712-based Raspberry Pi 5 systems,
including the BCM2712 D0 revision.
Store the registered device in the firmware state
and unregister it during driver removal
to ensure proper resource cleanup.
Signed-off-by: Sander Speetjens <sander.speetjens@xxxxxxxxx>
---
drivers/firmware/raspberrypi.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index 68512224e3ce..a694ecc18f9c 100644
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -34,6 +34,7 @@ struct rpi_firmware {
struct platform_device *hwmon_dev;
struct platform_device *clk_dev;
+ struct platform_device *pmic_dev;
struct platform_device *rtc_dev;
};
@@ -249,6 +250,23 @@ static void rpi_register_clk_driver(struct device *dev, struct rpi_firmware *fw)
fw->clk_dev = pdev;
}
+static void rpi_register_pmic_driver(struct device *dev, struct rpi_firmware *fw)
+{
+ struct platform_device *pdev;
+
+ /* Only present on Pi 5 (bcm2712) */
+ if (!(of_machine_is_compatible("brcm,bcm2712") ||
+ of_machine_is_compatible("brcm,bcm2712-d0")))
+ return;
Best regards