mirror of
https://github.com/apache/nuttx.git
synced 2026-08-22 22:18:25 +00:00
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> |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| Kconfig | ||
| Make.defs | ||
| pinctrl.c | ||