Re: [PATCH v14 0/3] Add RP1 PWM controller support

From: Gary Guo

Date: Tue Dec 01 2026 - 15:21:49 EST


On Wed Nov 25, 2026 at 4:24 PM GMT, Andrea della Porta wrote:
> Hi,
>
> This patchset adds support for the PWM controller found in the
> Raspberry Pi RP1 southbridge, used on the Raspberry Pi 5 to drive the
> cooling fan.
>
> Since v13, the driver also registers a "fan" auxiliary device
> (pwm_rp1.fan.<id>). On the Raspberry Pi 5 the RP1 firmware measures the
> fan tachometer pulses and writes the RPM value in the phase register of
> PWM channel 2; the companion hwmon driver, sent as a separate series to
> the hwmon list, binds to that auxiliary device and reads the value
> through rp1_pwm_read_tachometer(), exported in the 'RP1_PWM' symbol
> namespace. This is the approach agreed in [1], and it removes the need
> for any dedicated DT node or binding for the fan.
>
> The DTS node for the controller is already in v7.4-rc1 [2]. The DT binding
> has been applied by Rob [3] for consistency to v7.4 and is part of v7.4-rc2: as
> a consequence, patch 1 is included only to make this series apply 'logically'
> on top of v7.4-rc1 and can be dropped when rebasing.
>
> Changes in v14:
> - rp1_pwm_round_waveform_fromhw(): fixed a u32 overflow in the duty_offset
> computation when the period register holds U32_MAX, and return a zeroed
> duty_length/duty_offset when the inverted output is constantly low,
> instead of a duty_offset equal to the period, which is rejected by
> pwm_wf_valid() (reported by Sashiko AI review [4]).
>
> Changes in v13:
> - dropped the DTS patch, already merged.
> - add patch 3, registering the auxiliary device for the fan tachometer
> and exporting the accessor used by the hwmon auxiliary driver. The
> exported function was originally part of the fan patchset. Since it
> is really part of the pwm driver to be taken by Uwe, I moved it in
> this patchset.
> - Kconfig: pwm module now depends on AUXILIARY_BUS.
> - added a macro to define the phase channel number from which to read
> the fan speed.
> - removed the 'Tested-by' tag from Gary (see V12) since the patchset
> has been significally changed and need to be tested again.
> - the controller private data is passed to the auxiliary device as
> platform data, so the exported accessor no longer depends on how the
> parent platform device stores its driver data.
> - dropped the unused 'pwm' argument from rp1_pwm_apply_config().
> - added a MAINTAINERS entry for the driver, its DT binding and header.
>
> [1] - https://lore.kernel.org/all/ae9a4df9-b1f2-4f00-ab86-d9cf8d9bc387@xxxxxxxxxxxx/
> [2] - https://lore.kernel.org/all/7c437a10-985b-402c-b3ac-cfa97c53d014@xxxxxxxxxxxx/
> [3] - https://lore.kernel.org/all/20261102192302.GA882027-robh@xxxxxxxxxx/
> [4] - https://lore.kernel.org/all/sashiko-outbox-231741@xxxxxxxxxx/
>
> Thanks,
> Andrea
>
> This version has been prepared with the help of an AI coding assistant
> (Claude Opus 5.5).
>
> Andrea della Porta (1):
> pwm: rp1: Register auxiliary device for the fan tachometer
>
> Naushir Patuck (2):
> dt-bindings: pwm: Add Raspberry Pi RP1 PWM controller
> pwm: rp1: Add RP1 PWM controller driver

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
Tested-by: Gary Guo <gary@xxxxxxxxxxx>

Best,
Gary

>
> .../bindings/pwm/raspberrypi,rp1-pwm.yaml | 66 +++
> MAINTAINERS | 8 +
> drivers/pwm/Kconfig | 12 +
> drivers/pwm/Makefile | 1 +
> drivers/pwm/pwm-rp1.c | 477 ++++++++++++++++++
> include/soc/bcm2835/raspberrypi-pwm-rp1.h | 12 +
> 6 files changed, 576 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml
> create mode 100644 drivers/pwm/pwm-rp1.c
> create mode 100644 include/soc/bcm2835/raspberrypi-pwm-rp1.h
>
>
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4