[PATCH v2 0/1] hwmon: Add fan tachometer support for Raspberry Pi RP1

From: Andrea della Porta

Date: Tue Nov 24 2026 - 12:35:39 EST


Hi,

This patch adds fan tachometer / RPM monitoring support for the
Raspberry Pi RP1 southbridge found on the Raspberry Pi 5.

The fan speed is measured by the RP1 Cortex-M firmware, which writes the
computed RPM value into a register of the RP1 PWM controller block.

Following the discussion on the RFC [1], the driver is now implemented
as an auxiliary driver: the RP1 PWM driver registers a "fan" auxiliary
device (pwm_rp1.fan.<id>) and this driver binds to it, reading the RPM
through rp1_pwm_read_tachometer(), exported by the PWM driver in the
'RP1_PWM' symbol namespace (as suggested in the auxiliary bus
documentation and agreed in [2]).

This series depends on the RP1 PWM series [3], which provides both the
auxiliary device and the exported accessor.

Changes since RFC:
- converted from platform driver to auxiliary driver
- dropped the 'raspberrypi,rp1-fan' DT binding and the DTS node: the
device is now instantiated by the PWM driver
- dropped the DT phandle lookup, device link and reference handling:
the auxiliary device is a child of the PWM controller, so the driver
model already guarantees the correct lifetime and unbind ordering
- rp1_pwm_read_tachometer() now takes the auxiliary device and returns
the RPM through a pointer, separating it from the error code
- Kconfig: depend on PWM_RASPBERRYPI_RP1 without the COMPILE_TEST
alternative, fixing the link error reported by the kernel test robot
when the hwmon driver is built-in and the PWM driver is a module
- removed <linux/mod_devicetable.h> and the other unneeded includes (Uwe)
- updated Documentation/hwmon/rp1-fan.rst to reflect the changes
- added a dedicated MAINTAINERS entry for the driver, instead of adding
it to the RP1 PCI driver entry

[1] - https://lore.kernel.org/all/cover.1792748690.git.andrea.porta@xxxxxxxx/
[2] - https://lore.kernel.org/all/ae9a4df9-b1f2-4f00-ab86-d9cf8d9bc387@xxxxxxxxxxxx/
[3] - https://lore.kernel.org/all/20261124173658.31030-1-andrea.porta@xxxxxxxx/

Thanks,
Andrea

This version has been prepared with the help of an AI coding assistant
(Claude Opus 5.5).

Andrea della Porta (1):
hwmon: Add driver for Raspberry Pi RP1 fan tachometer

Documentation/hwmon/index.rst | 1 +
Documentation/hwmon/rp1-fan.rst | 43 ++++++++++++++++++
MAINTAINERS | 7 +++
drivers/hwmon/Kconfig | 11 +++++
drivers/hwmon/Makefile | 1 +
drivers/hwmon/rp1-hwmon.c | 78 +++++++++++++++++++++++++++++++++
6 files changed, 141 insertions(+)
create mode 100644 Documentation/hwmon/rp1-fan.rst
create mode 100644 drivers/hwmon/rp1-hwmon.c


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
prerequisite-patch-id: 8a9c7c53e94bfc4dd1dc40e8277f22c1f410f404
prerequisite-patch-id: 3053bded44bcd6a78ecae5a255ae876c5a9cb49b
prerequisite-patch-id: ade915a82dd15722ecb44802d307ff9d60a79228
--
2.51.0