Skip to content

Commit

Permalink
dtoverlay: Add a dtoverlay for pwm-gpio
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Gover <[email protected]>
  • Loading branch information
timg236 authored and pelwell committed Nov 4, 2024
1 parent 1ae3178 commit 23993a2
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
proto-codec.dtbo \
pwm.dtbo \
pwm-2chan.dtbo \
pwm-gpio.dtbo \
pwm-ir-tx.dtbo \
pwm1.dtbo \
qca7000.dtbo \
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -3935,6 +3935,12 @@ Params: pin Output pin (default 18) - see table
clock PWM clock frequency (informational)


Name: pwm-gpio
Info: Configures the software PWM GPIO driver
Load: dtoverlay=pwm-gpio,<param>=<val>
Params: gpio Output pin (default 4)


Name: pwm-ir-tx
Info: Use GPIO pin as pwm-assisted infrared transmitter output.
This is an alternative to "gpio-ir-tx". pwm-ir-tx makes use
Expand Down
38 changes: 38 additions & 0 deletions arch/arm/boot/dts/overlays/pwm-gpio-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Device tree overlay for software GPIO PWM.
/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2835";

fragment@0 {
target = <&gpio>;
__overlay__ {
pwm_gpio_pins: pwm_gpio_pins@4 {
brcm,pins = <4>; /* gpio 4 */
brcm,function = <1>; /* output */
brcm,pull = <0>; /* pull-none */
};
};
};

fragment@1 {
target-path = "/";
__overlay__ {
pwm_gpio: pwm_gpio@4 {
compatible = "pwm-gpio";
pinctrl-names = "default";
pinctrl-0 = <&pwm_gpio_pins>;
gpios = <&gpio 4 0>;
};
};
};

__overrides__ {
gpio = <&pwm_gpio>,"gpios:4",
<&pwm_gpio_pins>,"brcm,pins:0",
/* modify reg values to allow multiple instantiation */
<&pwm_gpio>,"reg:0",
<&pwm_gpio_pins>,"reg:0";
};
};

0 comments on commit 23993a2

Please sign in to comment.