Add RP1 PWM controller support
Subsystems (3)
v12 cover Add RP1 PWM controller support
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 will be exported by this driver via a function. A subsequent patch will add the function to read the speed to this driver and 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 V12:
- added a comment to better explain why we don't need to save and restore config registers upon suspend/resume, hopefully Sashiko will stop complaining about that.
- the RMW access to teh global control register is not synchronized via spinlock.
- patch 3 from previous release:
"arm64: dts: broadcom: rpi-5: Add RP1 PWM node"
has been dropped from this patchset since it's already applied to Florian's devicetre-arm64/next branch.
Link to V11:
https://lore.kernel.org/all/[email protected]/
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 +++ drivers/pwm/Kconfig | 7 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-rp1.c | 428 ++++++++++++++++++ 4 files changed, 502 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml create mode 100644 drivers/pwm/pwm-rp1.c
Signature · 1 line
2.35.3
PATCH v12 1/2 dt-bindings: pwm: Add Raspberry Pi RP1 PWM controller
From: Naushir Patuck <[email protected]>
Add the devicetree binding documentation for the PWM controller found in the Raspberry Pi RP1 chipset.
--- .../bindings/pwm/raspberrypi,rp1-pwm.yaml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml
Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml new file +66 -0
@@ -0,0 +1,66 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pwm/raspberrypi,rp1-pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Raspberry Pi RP1 PWM controller + +maintainers: + - Naushir Patuck <[email protected]> + - Andrea della Porta <[email protected]> + - Stanimir Varbanov <[email protected]> + +allOf: + - $ref: pwm.yaml# + +description: | + The PWM peripheral is a flexible waveform generator with a + variety of operational modes. It has the following features: + - four independent output channels + - 32-bit counter widths + - Seven output generation modes + - Optional per-channel output inversion + - Optional duty-cycle data FIFO with DMA support + - Optional sigma-delta noise shaping engine + Serves as a fan speed provider to other nodes for a PWM-connected + fan. + +properties: + compatible: + const: raspberrypi,rp1-pwm + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + "#pwm-cells": + const: 3 + + dmas: + maxItems: 1 + description: | + Phandle to the DMA controller and the channel specifier for + the duty-cycle FIFO. + + dma-names: + items: + - const: tx + +required: + - compatible + - reg + - clocks + +unevaluatedProperties: false + +examples: + - | + pwm@98000 { + compatible = "raspberrypi,rp1-pwm"; + reg = <0x98000 0x100>; + clocks = <&rp1_clocks 17>; + #pwm-cells = <3>; + };
Signature · 1 line
2.35.3
Re: [PATCH v12 1/2] dt-bindings: pwm: Add Raspberry Pi RP1 PWM controller
Quoted 10 lines · Andrea della Porta
From: Naushir Patuck <[email protected]>
Add the devicetree binding documentation for the PWM controller found in the Raspberry Pi RP1 chipset.
Signed-off-by Naushir Patuck <[email protected]>Co-developed-by Stanimir Varbanov <[email protected]>Signed-off-by Stanimir Varbanov <[email protected]>Signed-off-by Andrea della Porta <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>
Quoted 5 lines
--- .../bindings/pwm/raspberrypi,rp1-pwm.yaml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml
Rob Herring
maintainerRe: [PATCH v12 1/2] dt-bindings: pwm: Add Raspberry Pi RP1 PWM controller
In reply to Andrea della PortaQuoted 10 lines · Andrea della Porta
From: Naushir Patuck <[email protected]>
Add the devicetree binding documentation for the PWM controller found in the Raspberry Pi RP1 chipset.
Signed-off-by Naushir Patuck <[email protected]>Co-developed-by Stanimir Varbanov <[email protected]>Signed-off-by Stanimir Varbanov <[email protected]>Signed-off-by Andrea della Porta <[email protected]>Reviewed-by Krzysztof Kozlowski <[email protected]>
Quoted 4 lines
--- .../bindings/pwm/raspberrypi,rp1-pwm.yaml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml
Applied for v7.4 as the .dts user is already applied.
Rob
PATCH v12 2/2 pwm: rp1: Add RP1 PWM controller driver
In reply to Andrea della PortaFrom: Naushir Patuck <[email protected]>
The Raspberry Pi RP1 southbridge features an embedded PWM controller with 4 output channels, alongside an RPM interface to read the fan speed on the Raspberry Pi 5.
Add the supporting driver.
--- drivers/pwm/Kconfig | 7 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-rp1.c | 428 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 436 insertions(+) create mode 100644 drivers/pwm/pwm-rp1.c
drivers/pwm/Kconfig +7 -0
@@ -637,6 +637,13 @@ config PWM_ROCKCHIP Generic PWM framework driver for the PWM controller found on Rockchip SoCs. +config PWM_RASPBERRYPI_RP1 + tristate "RP1 PWM support" + depends on MISC_RP1 || COMPILE_TEST + depends on HAS_IOMEM + help + PWM framework driver for Raspberry Pi RP1 controller. + config PWM_SAMSUNG tristate "Samsung PWM support" depends on PLAT_SAMSUNG || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
drivers/pwm/Makefile +1 -0
@@ -57,6 +57,7 @@ obj-$(CONFIG_PWM_RENESAS_RZG2L_GPT) += pwm-rzg2l-gpt.o obj-$(CONFIG_PWM_RENESAS_RZ_MTU3) += pwm-rz-mtu3.o obj-$(CONFIG_PWM_RENESAS_TPU) += pwm-renesas-tpu.o obj-$(CONFIG_PWM_ROCKCHIP) += pwm-rockchip.o +obj-$(CONFIG_PWM_RASPBERRYPI_RP1) += pwm-rp1.o obj-$(CONFIG_PWM_SAMSUNG) += pwm-samsung.o obj-$(CONFIG_PWM_SIFIVE) += pwm-sifive.o obj-$(CONFIG_PWM_SL28CPLD) += pwm-sl28cpld.o
drivers/pwm/pwm-rp1.c new file +428 -0
428 lines not on this page · raw message
Signature · 1 line
2.35.3
Re: [PATCH v12 2/2] pwm: rp1: Add RP1 PWM controller driver
Quoted 6 lines · Andrea della Porta
From: Naushir Patuck <[email protected]>
The Raspberry Pi RP1 southbridge features an embedded PWM controller with 4 output channels, alongside an RPM interface to read the fan speed on the Raspberry Pi 5.
Quoted 7 lines
Add the supporting driver.
Signed-off-by Naushir Patuck <[email protected]>Co-developed-by Stanimir Varbanov <[email protected]>Signed-off-by Stanimir Varbanov <[email protected]>Co-developed-by Andrea della Porta <[email protected]>Signed-off-by Andrea della Porta <[email protected]>
At a quick glance the code looks alright to me.
Quoted 7 lines
--- drivers/pwm/Kconfig | 7 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-rp1.c | 428 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 436 insertions(+) create mode 100644 drivers/pwm/pwm-rp1.c
Hi Uwe,
since all of the patches have received at least one Reviewed/Tested-By and Sashiko doesn't seem to complain anymore, could we go on with this patchset?
Many thanks,
Andrea
Quoted 49 lines · Andrea della Porta
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 will be exported by this driver via a function. A subsequent patch will add the function to read the speed to this driver and 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,
AndreaCHANGES in V12:
- added a comment to better explain why we don't need to save and restore config registers upon suspend/resume, hopefully Sashiko will stop complaining about that.
- the RMW access to teh global control register is not synchronized via spinlock.
- patch 3 from previous release:
"arm64: dts: broadcom: rpi-5: Add RP1 PWM node"
has been dropped from this patchset since it's already applied to Florian's devicetre-arm64/next branch.Link to V11:
https://lore.kernel.org/all/[email protected]/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 +++ drivers/pwm/Kconfig | 7 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-rp1.c | 428 ++++++++++++++++++ 4 files changed, 502 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/raspberrypi,rp1-pwm.yaml create mode 100644 drivers/pwm/pwm-rp1.cSignature · 1 line
2.35.3