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
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
10 Inspired by a Forum thread here:
12 https://forums.raspberrypi.com/viewtopic.php?t=334286
14 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
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
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) += \
26 googlevoicehat-soundcard.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)
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)
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
53 +++ b/arch/arm/boot/dts/overlays/gpio-hog-overlay.dts
55 +// Configure a "hog" on the specified GPIO
59 +#include <dt-bindings/gpio/gpio.h>
62 + compatible = "brcm,bcm2835";
69 + gpios = <26 GPIO_ACTIVE_HIGH>;
76 + gpio = <&hog>,"reg:0",
78 + active_low = <&hog>,"output-high!",
79 + <&hog>,"output-low?";