bcm27xx: switch to kernel v6.1
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-5.15 / 950-0913-overlays-Add-gpio-hog-overlay.patch
1 From a2948fd59692f1d30ce64035bed33b32997a0ad7 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Mon, 16 May 2022 12:16:46 +0100
4 Subject: [PATCH] overlays: Add gpio-hog overlay
5
6 Add an overlay to activate a hog on a specified pin. Note that
7 hogged GPIOs are not available for other uses, i.e. drivers or
8 gpioset/gpioget.
9
10 Inspired by a Forum thread here:
11
12 https://forums.raspberrypi.com/viewtopic.php?t=334286
13
14 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
15 ---
16 arch/arm/boot/dts/overlays/Makefile | 1 +
17 arch/arm/boot/dts/overlays/README | 11 ++++++++
18 .../boot/dts/overlays/gpio-hog-overlay.dts | 27 +++++++++++++++++++
19 3 files changed, 39 insertions(+)
20 create mode 100644 arch/arm/boot/dts/overlays/gpio-hog-overlay.dts
21
22 --- a/arch/arm/boot/dts/overlays/Makefile
23 +++ b/arch/arm/boot/dts/overlays/Makefile
24 @@ -59,6 +59,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
25 goodix.dtbo \
26 googlevoicehat-soundcard.dtbo \
27 gpio-fan.dtbo \
28 + gpio-hog.dtbo \
29 gpio-ir.dtbo \
30 gpio-ir-tx.dtbo \
31 gpio-key.dtbo \
32 --- a/arch/arm/boot/dts/overlays/README
33 +++ b/arch/arm/boot/dts/overlays/README
34 @@ -1061,6 +1061,17 @@ Params: gpiopin GPIO use
35 millicelcius (default 55000)
36
37
38 +Name: gpio-hog
39 +Info: Activate a "hog" for a GPIO - request that the kernel configures it as
40 + an output, driven low or high as indicated by the presence or absence
41 + of the active_low parameter. Note that a hogged GPIO is not available
42 + to other drivers or for gpioset/gpioget.
43 +Load: dtoverlay=gpio-hog,<param>=<val>
44 +Params: gpio GPIO pin to hog (default 26)
45 + active_low If set, the hog drives the GPIO low (defaults
46 + to off - the GPIO is driven high)
47 +
48 +
49 Name: gpio-ir
50 Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core-
51 based gpio_ir_recv driver maps received keys directly to a
52 --- /dev/null
53 +++ b/arch/arm/boot/dts/overlays/gpio-hog-overlay.dts
54 @@ -0,0 +1,27 @@
55 +// Configure a "hog" on the specified GPIO
56 +/dts-v1/;
57 +/plugin/;
58 +
59 +#include <dt-bindings/gpio/gpio.h>
60 +
61 +/ {
62 + compatible = "brcm,bcm2835";
63 +
64 + fragment@0 {
65 + target = <&gpio>;
66 + __overlay__ {
67 + hog: hog@1a {
68 + gpio-hog;
69 + gpios = <26 GPIO_ACTIVE_HIGH>;
70 + output-high;
71 + };
72 + };
73 + };
74 +
75 + __overrides__ {
76 + gpio = <&hog>,"reg:0",
77 + <&hog>,"gpios:0";
78 + active_low = <&hog>,"output-high!",
79 + <&hog>,"output-low?";
80 + };
81 +};