The linux kernel and GPIO pins

Thread Starter

Robert Murch

Joined Nov 2, 2015
43
I am currently attempting to figure out which number I need to be feeding gpiolib in order to toggle a pin from the user-space so if someone can help explain it would be helpful. For instance, here is a comment from a co-worker about a different system and a different GPIO:

"...circuit is a subset of this), J2-63 GPIO4_11 (SPKR_MUTE) (gpio107 in the kernel) drives a buffer that drives..."

The code in the user space calls this pin 107 in order to toggle it. So my question is, where does this number 107 come from? I realize this question is kind of vague and I apologize for that. I would just ask my coworker but he is out of town. I did a grep search in the kernel for gpio107 and nothing comes up. I just don't understand how a pin goes from being called J2-63 GPIO4_11 too 107.
 

nsaspook

Joined Aug 27, 2009
13,315
Hey awesome thanks to both of you, great help!
The GPIO sub-system is a convoluted mess because there are several 'official' Legacy methods to handle them. I normally use the direct GPIO controller memory read/write instructions in kernel drivers that don't need direct OS user consumer level manipulations as it's much faster to bit toggle but that method is device specific.
 
Top