mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 10:08:59 +00:00
82 lines
2.5 KiB
Diff
82 lines
2.5 KiB
Diff
|
From a2948fd59692f1d30ce64035bed33b32997a0ad7 Mon Sep 17 00:00:00 2001
|
||
|
From: Phil Elwell <phil@raspberrypi.com>
|
||
|
Date: Mon, 16 May 2022 12:16:46 +0100
|
||
|
Subject: [PATCH] overlays: Add gpio-hog overlay
|
||
|
|
||
|
Add an overlay to activate a hog on a specified pin. Note that
|
||
|
hogged GPIOs are not available for other uses, i.e. drivers or
|
||
|
gpioset/gpioget.
|
||
|
|
||
|
Inspired by a Forum thread here:
|
||
|
|
||
|
https://forums.raspberrypi.com/viewtopic.php?t=334286
|
||
|
|
||
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
||
|
---
|
||
|
arch/arm/boot/dts/overlays/Makefile | 1 +
|
||
|
arch/arm/boot/dts/overlays/README | 11 ++++++++
|
||
|
.../boot/dts/overlays/gpio-hog-overlay.dts | 27 +++++++++++++++++++
|
||
|
3 files changed, 39 insertions(+)
|
||
|
create mode 100644 arch/arm/boot/dts/overlays/gpio-hog-overlay.dts
|
||
|
|
||
|
--- a/arch/arm/boot/dts/overlays/Makefile
|
||
|
+++ b/arch/arm/boot/dts/overlays/Makefile
|
||
|
@@ -59,6 +59,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
|
||
|
goodix.dtbo \
|
||
|
googlevoicehat-soundcard.dtbo \
|
||
|
gpio-fan.dtbo \
|
||
|
+ gpio-hog.dtbo \
|
||
|
gpio-ir.dtbo \
|
||
|
gpio-ir-tx.dtbo \
|
||
|
gpio-key.dtbo \
|
||
|
--- a/arch/arm/boot/dts/overlays/README
|
||
|
+++ b/arch/arm/boot/dts/overlays/README
|
||
|
@@ -1061,6 +1061,17 @@ Params: gpiopin GPIO use
|
||
|
millicelcius (default 55000)
|
||
|
|
||
|
|
||
|
+Name: gpio-hog
|
||
|
+Info: Activate a "hog" for a GPIO - request that the kernel configures it as
|
||
|
+ an output, driven low or high as indicated by the presence or absence
|
||
|
+ of the active_low parameter. Note that a hogged GPIO is not available
|
||
|
+ to other drivers or for gpioset/gpioget.
|
||
|
+Load: dtoverlay=gpio-hog,<param>=<val>
|
||
|
+Params: gpio GPIO pin to hog (default 26)
|
||
|
+ active_low If set, the hog drives the GPIO low (defaults
|
||
|
+ to off - the GPIO is driven high)
|
||
|
+
|
||
|
+
|
||
|
Name: gpio-ir
|
||
|
Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core-
|
||
|
based gpio_ir_recv driver maps received keys directly to a
|
||
|
--- /dev/null
|
||
|
+++ b/arch/arm/boot/dts/overlays/gpio-hog-overlay.dts
|
||
|
@@ -0,0 +1,27 @@
|
||
|
+// Configure a "hog" on the specified GPIO
|
||
|
+/dts-v1/;
|
||
|
+/plugin/;
|
||
|
+
|
||
|
+#include <dt-bindings/gpio/gpio.h>
|
||
|
+
|
||
|
+/ {
|
||
|
+ compatible = "brcm,bcm2835";
|
||
|
+
|
||
|
+ fragment@0 {
|
||
|
+ target = <&gpio>;
|
||
|
+ __overlay__ {
|
||
|
+ hog: hog@1a {
|
||
|
+ gpio-hog;
|
||
|
+ gpios = <26 GPIO_ACTIVE_HIGH>;
|
||
|
+ output-high;
|
||
|
+ };
|
||
|
+ };
|
||
|
+ };
|
||
|
+
|
||
|
+ __overrides__ {
|
||
|
+ gpio = <&hog>,"reg:0",
|
||
|
+ <&hog>,"gpios:0";
|
||
|
+ active_low = <&hog>,"output-high!",
|
||
|
+ <&hog>,"output-low?";
|
||
|
+ };
|
||
|
+};
|