mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 10:29:52 +00:00
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> gpio-fsm: Fix a build warning Signed-off-by: Phil Elwell <phil@raspberrypi.com> gpio-fsm: Rename 'num-soft-gpios' to avoid warning As of 5.10, the Device Tree parser warns about properties that look like references to "suppliers" of various services. "num-soft-gpios" resembles a declaration of a GPIO called "num-soft", causing the value to be interpreted as a phandle, the owner of which is checked for a "#gpio-cells" property. To avoid this warning, rename the gpio-fsm property to "num-swgpios". Signed-off-by: Phil Elwell <phil@raspberrypi.com> gpio-fsm: Show state info in /sys/class/gpio-fsm Add gpio-fsm sysfs entries under /sys/class/gpio-fsm. For each state machine show the current state, which state (if any) will be entered after a delay, and the current value of that delay. Signed-off-by: Phil Elwell <phil@raspberrypi.com> gpio-fsm: Fix shutdown timeout handling The driver is intended to jump directly to a shutdown state in the event of a timeout during shutdown, but the sense of the test was inverted. Signed-off-by: Phil Elwell <phil@raspberrypi.com> gpio-fsm: Clamp the delay time to zero The sysfs delay_ms value is calculated live, and it is possible for the time left to appear to be negative briefly if the timer handling hasn't completed. Ensure the displayed value never goes below zero, for the sake of appearances. Signed-off-by: Phil Elwell <phil@raspberrypi.com>