Finding GPIO names under Linux

Mike Krinkin krinkin.m.u at gmail.com
Mon May 23 10:23:19 EDT 2016


On Mon, May 23, 2016 at 04:05:23PM +0200, Johannes Thoma wrote:
> 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,

A while ago i was trying to understand how to use descriptor based interface
playing with my RPi, you can find ressults here:

https://github.com/krinkinmu/rpi-gpio-example

(*.tex files are in russian, sorry), IFAIU, you have to specify name in
device tree before you can use it.

> 
> - Johannes
> 
> 
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



More information about the Kernelnewbies mailing list