From 07ee2d3bf91832cb3286898fba9155665a390a79 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Thu, 31 Oct 2024 16:12:54 +0000 Subject: [PATCH] dtoverlay: Add a dtoverlay for pwm-gpio Signed-off-by: Tim Gover --- arch/arm/boot/dts/overlays/Makefile | 1 + arch/arm/boot/dts/overlays/README | 6 +++ .../boot/dts/overlays/pwm-gpio-overlay.dts | 38 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 arch/arm/boot/dts/overlays/pwm-gpio-overlay.dts diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile index b9530c339797c6..6b60068b125c15 100644 --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -217,6 +217,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ proto-codec.dtbo \ pwm.dtbo \ pwm-2chan.dtbo \ + pwm-gpio.dtbo \ pwm-ir-tx.dtbo \ pwm1.dtbo \ qca7000.dtbo \ diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README index e1df8b1ba3c77e..5c6344eb6f9870 100644 --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -3903,6 +3903,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,= +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 diff --git a/arch/arm/boot/dts/overlays/pwm-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pwm-gpio-overlay.dts new file mode 100644 index 00000000000000..f5a1fb38e2578e --- /dev/null +++ b/arch/arm/boot/dts/overlays/pwm-gpio-overlay.dts @@ -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"; + }; +};