Skip to content

Add RP1 PWM controller support

Andrea della Porta linux-arm-kernel linux-devicetree linux-hwmon linux-pwm lkml 15 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v14 Latest3 patches 0 repliesNew
  2. v133 patches 0 repliesSuperseded
  3. v122 patches 4 repliesSuperseded
Earlier versions · 12
VersionPostedPatchesRepliesStatus
v10 posting 2/23 patches2 repliesApplied
v110 of 3 patches0 repliesSuperseded
v10 posting 1/23 patches0 repliesSuperseded
v93 patches5 repliesSuperseded
v83 patches0 repliesSuperseded
v73 patches9 repliesSuperseded
v63 patches8 repliesSuperseded
v53 patches9 repliesSuperseded
v43 patches5 repliesSuperseded
v33 patches4 repliesSuperseded
v23 patches9 repliesSuperseded
v13 patches9 repliesSuperseded

Changes in v14 from the cover letter

- 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]).

Patches in v14 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3dt-bindings: pwm: Add Raspberry Pi RP1 PWM controllerDocumentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml+66 -00 replies
2/3pwm: rp1: Add RP1 PWM controller driverMAINTAINERS drivers/pwm/Kconfig drivers/pwm/Makefile +1 more+443 -00 replies
3/3pwm: rp1: Register auxiliary device for the fan tachometerMAINTAINERS drivers/pwm/Kconfig drivers/pwm/pwm-rp1.c +1 more+67 -00 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchKrzysztof Kozlowski
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v14 thread

Cover letter [PATCH v14 0/3] Add RP1 PWM controller support

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/[email protected]/
[2] - https://lore.kernel.org/all/[email protected]/
[3] - https://lore.kernel.org/all/[email protected]/
[4] - https://lore.kernel.org/all/[email protected]/

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

 .../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

Signature · 1 line
2.51.0