mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 10:08:59 +00:00
f07e572f64
bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G bcm2710: boot tested on RPi 3B v1.2 bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
152 lines
3.7 KiB
Diff
152 lines
3.7 KiB
Diff
From d27d1447e49bc6ffa92f787f7bc5c2eea29ba7d2 Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.com>
|
|
Date: Wed, 30 Sep 2020 12:08:08 +0100
|
|
Subject: [PATCH] overlays: Add fsm-demo overlay
|
|
|
|
fsm-demo demonstrates the usage of the gpio-fsm driver. It is
|
|
designed to be used with a set of "traffic light" LEDs on GPIOs
|
|
7, 8 and 25.
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
|
---
|
|
arch/arm/boot/dts/overlays/Makefile | 1 +
|
|
arch/arm/boot/dts/overlays/README | 8 ++
|
|
.../boot/dts/overlays/fsm-demo-overlay.dts | 104 ++++++++++++++++++
|
|
3 files changed, 113 insertions(+)
|
|
create mode 100644 arch/arm/boot/dts/overlays/fsm-demo-overlay.dts
|
|
|
|
--- a/arch/arm/boot/dts/overlays/Makefile
|
|
+++ b/arch/arm/boot/dts/overlays/Makefile
|
|
@@ -44,6 +44,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
|
|
enc28j60-spi2.dtbo \
|
|
exc3000.dtbo \
|
|
fe-pi-audio.dtbo \
|
|
+ fsm-demo.dtbo \
|
|
goodix.dtbo \
|
|
googlevoicehat-soundcard.dtbo \
|
|
gpio-fan.dtbo \
|
|
--- a/arch/arm/boot/dts/overlays/README
|
|
+++ b/arch/arm/boot/dts/overlays/README
|
|
@@ -767,6 +767,14 @@ Load: dtoverlay=fe-pi-audio
|
|
Params: <None>
|
|
|
|
|
|
+Name: fsm-demo
|
|
+Info: A demonstration of the gpio-fsm driver. The GPIOs are chosen to work
|
|
+ nicely with a "traffic-light" display of red, amber and green LEDs on
|
|
+ GPIOs 7, 8 and 25 respectively.
|
|
+Load: dtoverlay=fsm-demo,<param>=<val>
|
|
+Params: fsm_debug Enable debug logging (default off)
|
|
+
|
|
+
|
|
Name: goodix
|
|
Info: Enables I2C connected Goodix gt9271 multiple touch controller using
|
|
GPIOs 4 and 17 (pins 7 and 11 on GPIO header) for interrupt and reset.
|
|
--- /dev/null
|
|
+++ b/arch/arm/boot/dts/overlays/fsm-demo-overlay.dts
|
|
@@ -0,0 +1,104 @@
|
|
+// Demo overlay for the gpio-fsm driver
|
|
+/dts-v1/;
|
|
+/plugin/;
|
|
+
|
|
+#include <dt-bindings/gpio/gpio-fsm.h>
|
|
+
|
|
+#define BUTTON1 GF_IP(0)
|
|
+#define BUTTON2 GF_SW(0)
|
|
+#define RED GF_OP(0) // GPIO7
|
|
+#define AMBER GF_OP(1) // GPIO8
|
|
+#define GREEN GF_OP(2) // GPIO25
|
|
+
|
|
+/{
|
|
+ compatible = "brcm,bcm2835";
|
|
+
|
|
+ fragment@0 {
|
|
+ target-path = "/";
|
|
+ __overlay__ {
|
|
+ fsm_demo: fsm-demo {
|
|
+ compatible = "rpi,gpio-fsm";
|
|
+
|
|
+ debug = <0>;
|
|
+ gpio-controller;
|
|
+ #gpio-cells = <2>;
|
|
+ num-soft-gpios = <1>;
|
|
+ gpio-line-names = "button2";
|
|
+ input-gpios = <&gpio 6 1>; // BUTTON1 (active-low)
|
|
+ output-gpios = <&gpio 7 0>, // RED
|
|
+ <&gpio 8 0>, // AMBER
|
|
+ <&gpio 25 0>; // GREEN
|
|
+ shutdown-timeout-ms = <2000>;
|
|
+
|
|
+ start {
|
|
+ start_state;
|
|
+ set = <RED 1>, <AMBER 0>, <GREEN 0>;
|
|
+ start2 = <GF_DELAY 250>;
|
|
+ };
|
|
+
|
|
+ start2 {
|
|
+ set = <RED 0>, <AMBER 1>;
|
|
+ go = <GF_DELAY 250>;
|
|
+ };
|
|
+
|
|
+ go {
|
|
+ set = <RED 0>, <AMBER 0>, <GREEN 1>;
|
|
+ ready_wait = <BUTTON1 0>;
|
|
+ shutdown1 = <GF_SHUTDOWN 0>;
|
|
+ };
|
|
+
|
|
+ ready_wait {
|
|
+ // Clear the soft GPIO
|
|
+ set = <BUTTON2 0>;
|
|
+ ready = <GF_DELAY 1000>;
|
|
+ shutdown1 = <GF_SHUTDOWN 0>;
|
|
+ };
|
|
+
|
|
+ ready {
|
|
+ stopping = <BUTTON1 1>, <BUTTON2 1>;
|
|
+ shutdown1 = <GF_SHUTDOWN 0>;
|
|
+ };
|
|
+
|
|
+ stopping {
|
|
+ set = <GREEN 0>, <AMBER 1>;
|
|
+ stopped = <GF_DELAY 1000>;
|
|
+ };
|
|
+
|
|
+ stopped {
|
|
+ set = <AMBER 0>, <RED 1>;
|
|
+ get_set = <GF_DELAY 3000>;
|
|
+ shutdown1 = <GF_SHUTDOWN 0>;
|
|
+ };
|
|
+
|
|
+ get_set {
|
|
+ set = <AMBER 1>;
|
|
+ go = <GF_DELAY 1000>;
|
|
+ };
|
|
+
|
|
+ shutdown1 {
|
|
+ set = <RED 0>, <AMBER 0>, <GREEN 1>;
|
|
+ shutdown2 = <GF_SHUTDOWN 250>;
|
|
+ };
|
|
+
|
|
+ shutdown2 {
|
|
+ set = <AMBER 1>, <GREEN 0>;
|
|
+ shutdown3 = <GF_SHUTDOWN 250>;
|
|
+ };
|
|
+
|
|
+ shutdown3 {
|
|
+ set = <RED 1>, <AMBER 0>;
|
|
+ shutdown4 = <GF_SHUTDOWN 250>;
|
|
+ };
|
|
+
|
|
+ shutdown4 {
|
|
+ shutdown_state;
|
|
+ set = <RED 0>;
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+ };
|
|
+
|
|
+ __overrides__ {
|
|
+ fsm_debug = <&fsm_demo>,"debug:0";
|
|
+ };
|
|
+};
|