Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Nov 2019 15:38:14 +0100
From:      Milan Obuch <freebsd-hackers@dino.sk>
To:        freebsd-hackers@freebsd.org
Subject:   Where is GPIO pin name stored?
Message-ID:  <20191123153814.13a29e20@zeta.dino.sk>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191123153814.13a29e20>