nuttx/drivers/pinctrl/Kconfig
Justin Hammond 771c84068b drivers/pinctrl: Add pad read-back and a procfs entry.
The pinctrl interface is write only: every operation sets a property,
and nothing reports what a pin currently holds.

Adds an optional get_pad method describing one pad as a structure: the
settable fields, each with a validity bit because a pad need not have
them all, and a text member for the controller specific fields the
structure does not cover.  The structure embeds its strings rather than
pointing at them, so the same shape serves both callers.

The first caller is /proc/pinctrl, which renders one key:value line per
pad, every line the same tokens in the same order with - for a field the
pad does not have, so the file is machine parseable.  The framework owns
the format; controllers only supply data.

The second is a new PINCTRLC_GETPAD ioctl, which gives userspace the
read-back that text cannot: reading a pad back after setting it.

PINCTRL_PADNAME() and two lookup helpers let a controller declare its
pad and function-select names in one table instead of inventing its own.

Registration keeps a list, which the renderer iterates; pinctrl_dev_s
gains the pad count.  /proc/pinctrl is claimed when the first controller
appears; procfs_register() requires that procfs is not yet mounted,
which holds because controllers register during board or architecture
start up.

Documents the method, the validity bits and the optional naming, and
records that /proc/pinctrl exists.

Off by default and costs nothing when off.  No in-tree configuration
enables PINCTRL, so this builds only when a board turns it on.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-21 20:04:59 +08:00

28 lines
908 B
Text

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "Pinctrl Support"
config PINCTRL
bool "PINCTRL Driver Support"
default n
---help---
This selection enables selection of common PINCTRL options. This option
should be enabled by all platforms that support PINCTRL interfaces.
See include/nuttx/pinctrl/pinctrl.h for further PINCTRL driver information.
config PINCTRL_PROCFS
bool "PINCTRL procfs entry"
default n
depends on PINCTRL && FS_PROCFS && FS_PROCFS_REGISTER
---help---
Create /proc/pinctrl, listing every registered pin controller and,
for those that supply a get_pad method, one line per pad describing
its current configuration in key:value form.
The rest of the pinctrl interface only writes, so without this there
is no way to ask a controller what a pin is configured as.
endmenu