gpio: Add gpio-fsm driver

The gpio-fsm driver implements simple state machines that allow GPIOs
to be controlled in response to inputs from other GPIOs - real and
soft/virtual - and time delays. It can:
+ create dummy GPIOs for drivers that demand them,
+ drive multiple GPIOs from a single input, with optional delays,
+ add a debounce circuit to an input,
+ drive pattern sequences onto LEDs
etc.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
This commit is contained in:
Phil Elwell
2020-09-30 12:00:54 +01:00
committed by popcornmix
parent a0dbf12877
commit 03e2f7d4f8
4 changed files with 1134 additions and 0 deletions

View File

@@ -1162,6 +1162,15 @@ config HTC_EGPIO
several HTC phones. It provides basic support for input several HTC phones. It provides basic support for input
pins, output pins, and irqs. pins, output pins, and irqs.
config GPIO_FSM
tristate "GPIO FSM support"
help
The GPIO FSM driver allows the creation of state machines for
manipulating GPIOs (both real and virtual), with state transitions
triggered by GPIO edges or delays.
If unsure, say N.
config GPIO_JANZ_TTL config GPIO_JANZ_TTL
tristate "Janz VMOD-TTL Digital IO Module" tristate "Janz VMOD-TTL Digital IO Module"
depends on MFD_JANZ_CMODIO depends on MFD_JANZ_CMODIO

View File

@@ -60,6 +60,7 @@ obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o
obj-$(CONFIG_GPIO_EXAR) += gpio-exar.o obj-$(CONFIG_GPIO_EXAR) += gpio-exar.o
obj-$(CONFIG_GPIO_F7188X) += gpio-f7188x.o obj-$(CONFIG_GPIO_F7188X) += gpio-f7188x.o
obj-$(CONFIG_GPIO_FTGPIO010) += gpio-ftgpio010.o obj-$(CONFIG_GPIO_FTGPIO010) += gpio-ftgpio010.o
obj-$(CONFIG_GPIO_FSM) += gpio-fsm.o
obj-$(CONFIG_GPIO_GE_FPGA) += gpio-ge.o obj-$(CONFIG_GPIO_GE_FPGA) += gpio-ge.o
obj-$(CONFIG_GPIO_GPIO_MM) += gpio-gpio-mm.o obj-$(CONFIG_GPIO_GPIO_MM) += gpio-gpio-mm.o
obj-$(CONFIG_GPIO_GRGPIO) += gpio-grgpio.o obj-$(CONFIG_GPIO_GRGPIO) += gpio-grgpio.o

1103
drivers/gpio/gpio-fsm.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* This header provides constants for binding rpi,gpio-fsm.
*/
#ifndef _DT_BINDINGS_GPIO_FSM_H
#define _DT_BINDINGS_GPIO_FSM_H
#define GF_IN 0
#define GF_OUT 1
#define GF_SOFT 2
#define GF_DELAY 3
#define GF_SHUTDOWN 4
#define GF_IO(t, v) (((v) << 16) | ((t) & 0xffff))
#define GF_IP(x) GF_IO(GF_IN, (x))
#define GF_OP(x) GF_IO(GF_OUT, (x))
#define GF_SW(x) GF_IO(GF_SOFT, (x))
#endif