[PATCH v4 0/3] Add RP1 PWM controller support

Andrea della Porta posted 3 patches 4 days, 16 hours ago
.../bindings/pwm/raspberrypi,rp1-pwm.yaml     |  54 +++
.../boot/dts/broadcom/bcm2712-rpi-5-b.dts     |  12 +
arch/arm64/boot/dts/broadcom/rp1-common.dtsi  |   9 +
drivers/pwm/Kconfig                           |   9 +
drivers/pwm/Makefile                          |   1 +
drivers/pwm/pwm-rp1.c                         | 422 ++++++++++++++++++
6 files changed, 507 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml
create mode 100644 drivers/pwm/pwm-rp1.c
[PATCH v4 0/3] Add RP1 PWM controller support
Posted by Andrea della Porta 4 days, 16 hours ago
This patchset adds support for the PWM controller found on the
Raspberry Pi RP1 southbridge. This is necessary to operate the
cooling fan connected to one of the PWM channels.

The tachometer pin for the fan speed is managed by the firmware 
running on the RP1's M-core. It uses the PHASE2 register
to report the RPM, which is then exported by this driver via
syscon registers. A subsequent patch will add a new device
and driver to read the RPM and export this value via hwmon.
 
Subsequent patches will also add the CPU thermal zone, which
acts as a consumer of the PWM device.

Best regards,
Andrea

CHANGES in V4:

- s/rp1_pwm/rp1_pwm1/ in the DTS, so adding rp1_pwm0 in the
  future will be unambiguous
- the driver can now be compiled as module. Since it cannot
  be unloaded (due to syscon registration), substitute
  builtin_platform_driver for module_platform_driver.
- preserved the polarity bit when setting up the channel on
  rp1_pwm_request()
- rp1_pwm_round_waveform_tohw(): capped duty_ticks to be no
  more than period_ticks, and adjusted offset_ticks
  accordingly (best effort)
- the syscon registration is moved at the end of the probe
  function, to avoid leaking if the probing bail out
  prematurely
- fixed the erroneous casting about pwm_chip/rp1_pwm struct
  in suspend/resume functions.

Naushir Patuck (2):
  dt-bindings: pwm: Add Raspberry Pi RP1 PWM controller
  pwm: rp1: Add RP1 PWM controller driver

Stanimir Varbanov (1):
  arm64: dts: broadcom: rpi-5: Add RP1 PWM node

 .../bindings/pwm/raspberrypi,rp1-pwm.yaml     |  54 +++
 .../boot/dts/broadcom/bcm2712-rpi-5-b.dts     |  12 +
 arch/arm64/boot/dts/broadcom/rp1-common.dtsi  |   9 +
 drivers/pwm/Kconfig                           |   9 +
 drivers/pwm/Makefile                          |   1 +
 drivers/pwm/pwm-rp1.c                         | 422 ++++++++++++++++++
 6 files changed, 507 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml
 create mode 100644 drivers/pwm/pwm-rp1.c

-- 
2.35.3