nuttx/drivers/ioexpander
Justin Hammond 1528b470b9 drivers/ioexpander: List the registered pins in /proc/gpio.
The pins a board publishes are visible in /dev and each can be read
through its own node, but surveying a whole board that way means an open
and two ioctls per pin, and the signal and interrupt counters the upper
half keeps are not reachable through any of them.

Adds a list of registered pins and publishes it as /proc/gpio, behind
GPIO_PROCFS: a quality of life view of the same kind as /proc/pinctrl
and /proc/reset.  Every common field comes from state the upper half
already holds: the pin type, the value through go_read(), how many times
the pin has been registered for signals, and how many interrupts it has
taken.  Lines carry the same key:value tokens in the same order, so the
file is machine parseable.

Lower halves may supply an optional go_describe() adding what only they
can say, such as which pad carries the line or how its trigger is
configured.  It writes text into a caller supplied buffer and the upper
half owns the line, so a lower half needs no procfs knowledge.  A lower
half without it is listed with the common tokens alone.

The pin type index is bounded before use: it comes from the lower half
and the name table cannot cover a type the enumeration does not define.
A pin that cannot be read reports val:- rather than a zero that would
read as a real level.

procfs_register() appends without checking for duplicates, so the entry
is claimed once for the lifetime of the system rather than whenever the
list is empty; pins come and go at run time.

The name is held in a buffer as long as the one gpio_pin_register()
accepts, so a listing always names the same string as /dev.

The pin type name table is declared without an explicit size so that the
assertion beside it compares against the enumeration and can fail; sized
as [GPIO_NPINTYPES] it would have been tautological.

Documents the entry, its tokens, and how a lower half describes a pin.

Off by default: with GPIO_PROCFS unset the list, the lock and the procfs
entry are compiled out, and go_describe() is one more member at the end
of a structure existing lower halves do not reach.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-19 00:46:56 +08:00
..
aw9523b.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
aw9523b.h drivers/ioexpander/aw9523b: New driver for AW9523B i/o expander 2025-08-29 09:10:50 -03:00
CMakeLists.txt drives/ioexpander: add support to PI4IOE IO Expander 2026-07-28 10:18:01 +08:00
gpio.c drivers/ioexpander: List the registered pins in /proc/gpio. 2026-08-19 00:46:56 +08:00
gpio_lower_half.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
icjx.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
icjx.h drivers/ioexpander/icjx: add option to set filters during initialization 2025-04-24 10:05:56 -03:00
ioe_dummy.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
ioe_rpmsg.c sim/configs/rpserver/rpproxy_virtio: Change the sim 32bit to 64bit compilation 2024-11-15 14:01:11 +08:00
iso1h812g.c gpio: Fix GPIO expanders warnings 2026-08-01 11:15:11 +08:00
iso1h812g.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
iso1i813t.c gpio: Fix GPIO expanders warnings 2026-08-01 11:15:11 +08:00
iso1i813t.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
Kconfig drivers/ioexpander: List the registered pins in /proc/gpio. 2026-08-19 00:46:56 +08:00
Make.defs drives/ioexpander: add support to PI4IOE IO Expander 2026-07-28 10:18:01 +08:00
mcp23x08.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
mcp23x08.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
mcp23x17.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
mcp23x17.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pca9538.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pca9538.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pca9555.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pca9555.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pca9557.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pca9557.h drivers/ioexpander: Add support for PCA9557 2025-03-25 15:46:09 -03:00
pcf8574.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pcf8574.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pcf8575.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
pcf8575.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
pi4ioe5v6408.c drives/ioexpander: add support to PI4IOE IO Expander 2026-07-28 10:18:01 +08:00
skeleton.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sx1509.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
sx1509.h drivers: migrate to SPDX identifier 2024-11-06 18:02:25 +08:00
tca64xx.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
tca64xx.h drivers/tca64xx: Add support for PCAL6416 2025-08-26 09:46:09 +08:00