Coding technique for multiplexed pin configuration


#1

Hi,

I’m looking for guideline / document of pin configuration for multiplexed pins with coding technique description. Can anyone let me know it?

regards,
Marty


#2

Pins are managed inside the kernel using the pinctrl API. Normally each device drivers are responsible for reserving the pins it needs (following description in devicetree).
For pins that have been have been set as GPIO (e.g. claimed by the GPIO device driver) there are higher level APIs to control both for kernel. GPIO is also exposed to userspace (most guide still point the to deprecated sysfs interface) although this should be seen as a last resort; there may be a more suitable kernel driver that is built on top of GPIO (gpio_keys is an especially interesting example).


#3

Hi danielt,

Thank you for your quick and detail explanation. I’ll study your description.

regards,
Marty


#4

No worries.

You might also be interested in this topic:

The tools @Mani is pointing at all use the newer character interface which is better practice than using old sysfs interfaces!


#5

Hi danielt,

Thank you for your additional information, It’s alsohelpful for me.

regards,
Marty