openwrt/target/linux/bcm27xx/patches-6.6/950-1391-overlays-Add-pwm-pio-overlay.patch
Álvaro Fernández Rojas 3a5584e0df bcm27xx: pull 6.6 patches from RPi repo
Adds latest 6.6 patches from the Raspberry Pi repository.

These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.6.y/
With the following command:
git format-patch -N v6.6.67..HEAD
(HEAD -> 811ff707533bcd67cdcd368bbd46223082009b12)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
(cherry picked from commit 692205305db14deeff1a2dc4a6d7f87e19fc418b)
2024-12-28 14:11:52 +01:00

100 lines
2.6 KiB
Diff

From ba7e2e3d03a432acbc338c6c03e46dcd97cfa1b3 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 7 Nov 2024 11:41:33 +0000
Subject: [PATCH] overlays: Add pwm-pio overlay
Add an overlay to enable a single-channel PIO-assisted PWM interface on any
header pin.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/Makefile | 1 +
arch/arm/boot/dts/overlays/README | 8 ++++
arch/arm/boot/dts/overlays/overlay_map.dts | 4 ++
.../arm/boot/dts/overlays/pwm-pio-overlay.dts | 39 +++++++++++++++++++
4 files changed, 52 insertions(+)
create mode 100644 arch/arm/boot/dts/overlays/pwm-pio-overlay.dts
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -219,6 +219,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
pwm-2chan.dtbo \
pwm-gpio.dtbo \
pwm-ir-tx.dtbo \
+ pwm-pio.dtbo \
pwm1.dtbo \
qca7000.dtbo \
qca7000-uart0.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -3926,6 +3926,14 @@ Params: gpio_pin Output G
func Pin function (default 2 = Alt5)
+Name: pwm-pio
+Info: Configures a GPIO pin as PIO-assisted PWM output. Unlike hardware PWM,
+ this can be used on any RP1 GPIO in bank 0 (0-27). Up to 4 are
+ supported, assuming nothing else is using PIO. Pi 5 only.
+Load: dtoverlay=pwm-pio,<param>=<val>
+Params: gpio Output GPIO (0-27, default 4)
+
+
Name: pwm1
Info: Configures one or two PWM channel on PWM1 (BCM2711 only)
N.B.:
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -240,6 +240,10 @@
bcm2712;
};
+ pwm-pio {
+ bcm2712;
+ };
+
pwm1 {
bcm2711;
};
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/pwm-pio-overlay.dts
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0
+// Device tree overlay for RP1 PIO PWM.
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "brcm,bcm2712";
+
+ fragment@0 {
+ target = <&gpio>;
+ __overlay__ {
+ pwm_pio_pins: pwm_pio_pins@4 {
+ brcm,pins = <4>; /* gpio 4 */
+ function = "pio";
+ bias-disable;
+ };
+ };
+ };
+
+ fragment@1 {
+ target-path = "/";
+ __overlay__ {
+ pwm_pio: pwm_pio@4 {
+ compatible = "raspberrypi,pwm-pio-rp1";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm_pio_pins>;
+ gpios = <&gpio 4 0>;
+ };
+ };
+ };
+
+ __overrides__ {
+ gpio = <&pwm_pio>,"gpios:4",
+ <&pwm_pio_pins>,"brcm,pins:0",
+ /* modify reg values to allow multiple instantiation */
+ <&pwm_pio>,"reg:0",
+ <&pwm_pio_pins>,"reg:0";
+ };
+};