Finding GPIO names under Linux

Johannes Thoma johannes at johannesthoma.com
Mon May 23 10:05:23 EDT 2016


Dear list,

I am writing a driver which uses the "new" descriptor interface of the 
GPIO library. As far as I have understood it, gpiod_get(8) is the way to 
allocate (and also lock?) GPIOs pins for use. My question is how do I 
find what to pass as the con_id parameter (this should identify the pin 
but please correct me if I am wrong, in that case how to I tell 
gpiod_get which pin I want?). Is there a file somewhere where I can find 
the pin names of my hardware (which is a raspberry 1 for now), something 
like /sys/class/gpio/xxx/gpio_pin_names or so, or do I have to look them 
up in the device tree or somewhere else? Or do I have to
configure the pin somewhere in the device tree? What I would like to
do is offer an interface (via configfs) where the pins the sensor is
attached can be configured dynamically at run-time.

The driver itself is OpenSource (GPL) and can be obtained at

http://github.com/johannesthoma/linux-hc-sro4

(iio branch is currently the dev branch where this problem occurs).

Thanks a lot,

- Johannes





More information about the Kernelnewbies mailing list