Where is GPIO pin name stored?

Milan Obuch freebsd-hackers at dino.sk
Sat Nov 23 14:38:21 UTC 2019


Hi,

gpio controller has a device method, gpio_pin_getname, which sets name
for any gpio pin this driver controlls. It is possible, however, to
change this name with gpioctl invoked as

gpioctl [ -f /dev/gpiocX ] -n <pin number/name> <new name>

and in gpio pin listing this new name is used subsequently.

Where is this name stored? Is it possible to get this new, changed name
somehow from driver programatically?

I found the way it is done in gpioctl, but this is from upper layer
(related to gpiobus - in sys/dev/gpio/gpiobus.c). I need it from lower
layer. Looking in sys/dev/gpio/gpiobusvar.h, I think I need access to
gpiobus_softc related to my gpio controller device...

Use case:

I implemented interrupt driver for my AXI GPIO core device. It does
nothing special, just prints a line similar to

gpio4: btns0 status 1

on console, in this case, when first button gets pressed. This could be
changed to create a devd event so one could easily attach some event
handling script via some /etc/devd.conf entry.

It would be good to see this new name here as well.

Regards,
Milan


More information about the freebsd-hackers mailing list