Skip to content

Commit a3b7ce3

Browse files
pelwellpopcornmix
authored andcommitted
overlays: Add overlay pwm1
pwm1 enables the second PWM interface found on BCM2711. It can only be mapped to GPIOs 40 & 41. See: https://forums.raspberrypi.com/viewtopic.php?t=342458 Signed-off-by: Phil Elwell <[email protected]>
1 parent 917e230 commit a3b7ce3

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

arch/arm/boot/dts/overlays/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
183183
pwm.dtbo \
184184
pwm-2chan.dtbo \
185185
pwm-ir-tx.dtbo \
186+
pwm1.dtbo \
186187
qca7000.dtbo \
187188
qca7000-uart0.dtbo \
188189
ramoops.dtbo \

arch/arm/boot/dts/overlays/README

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,6 +3216,24 @@ Params: gpio_pin Output GPIO (default 18)
32163216
func Pin function (default 2 = Alt5)
32173217

32183218

3219+
Name: pwm1
3220+
Info: Configures one or two PWM channel on PWM1 (BCM2711 only)
3221+
N.B.:
3222+
1) The onboard analogue audio output uses both PWM channels.
3223+
2) So be careful mixing audio and PWM.
3224+
Note that even when only one pin is enabled, both channels are available
3225+
from the PWM driver, so be careful to use the correct one.
3226+
Load: dtoverlay=pwm1,<param>=<val>
3227+
Params: clock PWM clock frequency (informational)
3228+
pins_40 Enable channel 0 (PWM1_0) on GPIO 40
3229+
pins_41 Enable channel 1 (PWM1_1) on GPIO 41
3230+
pins_40_41 Enable channels 0 (PWM1_0) and 1 (PW1_1) on
3231+
GPIOs 40 and 41 (default)
3232+
pull_up Enable pull-ups on the PWM pins (default)
3233+
pull_down Enable pull-downs on the PWM pins
3234+
pull_off Disable pulls on the PWM pins
3235+
3236+
32193237
Name: qca7000
32203238
Info: in-tech's Evaluation Board for PLC Stamp micro
32213239
This uses spi0 and a separate GPIO interrupt to connect the QCA7000.

arch/arm/boot/dts/overlays/overlay_map.dts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@
7777
renamed = "miniuart-bt";
7878
};
7979

80+
pwm1 {
81+
bcm2711;
82+
};
83+
8084
ramoops {
8185
bcm2835;
8286
bcm2711 = "ramoops-pi4";
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/dts-v1/;
2+
/plugin/;
3+
4+
#include <dt-bindings/pinctrl/bcm2835.h>
5+
6+
/ {
7+
compatible = "brcm,bcm2711";
8+
9+
fragment@0 {
10+
target = <&pins>;
11+
__overlay__ {
12+
brcm,pins = <40 41>;
13+
};
14+
};
15+
16+
fragment@1 {
17+
target = <&pins>;
18+
__dormant__ {
19+
brcm,pins = <40>;
20+
};
21+
};
22+
23+
fragment@2 {
24+
target = <&pins>;
25+
__dormant__ {
26+
brcm,pins = <41>;
27+
};
28+
};
29+
30+
fragment@3 {
31+
target = <&gpio>;
32+
__overlay__ {
33+
pins: pwm1_overlay_pins {
34+
brcm,pins = <40 41>;
35+
brcm,function = <BCM2835_FSEL_ALT0>;
36+
brcm,pull = <BCM2835_PUD_UP>;
37+
};
38+
};
39+
};
40+
41+
fragment@4 {
42+
target = <&pwm1>;
43+
pwm: __overlay__ {
44+
status = "okay";
45+
assigned-clock-rates = <100000000>;
46+
pinctrl-names = "default";
47+
pinctrl-0 = <&pins>;
48+
};
49+
};
50+
51+
__overrides__ {
52+
clock = <&pwm>, "assigned-clock-rates:0";
53+
pins_40_41 = <0>,"+0-1-2";
54+
pins_40 = <0>,"-0+1-2";
55+
pins_41 = <0>,"-0-1+2";
56+
pull_up = <&pins>, "brcm,pull:0=", <BCM2835_PUD_UP>;
57+
pull_down = <&pins>, "brcm,pull:0=", <BCM2835_PUD_DOWN>;
58+
pull_off = <&pins>, "brcm,pull:0=", <BCM2835_PUD_OFF>;
59+
};
60+
};

0 commit comments

Comments
 (0)