# Linux Device Driver References - pinctrl [TOC] ## Notes On a board, a pin may have more than one capability. For example, in the [Raspberry Pin pinout](https://pinout.xyz/), `Alt0` function of GPIO3 suggests that it is capable of outputting clock signal in I2C (the SCL signal in I2C protocol term), but this is not its sole capability. The Alt2 on the table shows "DPI VSYNC". The [DPI tab](https://pinout.xyz/pinout/dpi) in the same page suggests that, if jointly used with other 27 pins and configured properly, those pins are capable of driving a RGB24 display, in which the GPIO3 plays a role of outputting VSYNC signal for display. Which pin does what is what needs to be selected. The pinctrl subsystem is a subsystem for this purpose. Pinctrl control can be broken down to two part: the configurations, and devices that consume the cofiguration. The pin-muxing configurations are listed in the upper level of device tree, and those configuration are named. Device drivers request those configurations by setting properties whose name is of the form `pinctrl-0`, `pinctrl-1`. Their names are paired by `pinctrl-names` properties. On boot, the pinctrl subsystem always find the pinctrl that matches the name `default`, and set it to the default. Note that a pinctrl state may be refused. In this case, the probe function will not run. Also note that in this case there will no error in probe failed, as the failure comes from pinctrl subsystem, not the probe. ## References ### [Introduction to Pin Muxing and GPIO Control Under Linux - Neil Armstrong, BayLibr](https://youtu.be/v8j1atWLRXo) {%youtube VdiZjLd0DPM %} ### [Tutorial: Spelunking for Hardware Data - Matt Porter, Konsulko Group](https://youtu.be/HO68sK6E0B8) {%youtube HO68sK6E0B8 %} ### [Linus Walleij - GPIO and Pin Control for Embedded Systems](https://youtu.be/AvuOKGvka9g) {%youtube AvuOKGvka9g %} ### [Webinar: Linux Embarcado: Desvendando o Pin Control Subsystem - Kernel Linux](https://youtu.be/FQGu9jarCWY) This is not in English, but it really has a lot of demo in it. You may try AI translations. {%youtube FQGu9jarCWY %}