Accessing GPIOs from userspace using recent kernels

Peter TB Brett peter at peter-b.co.uk
Thu May 15 07:06:28 PDT 2014


Hi Javier,

Thank you for your helpful suggestions.

On 2014-05-14 11:00, Javier Martinez Canillas wrote:
> [snip]
> 
>> If there is no longer a userspace API for these settings, is there any 
>> way
>> that I can simply amend the device tree in order to change a couple of 
>> mux
>> settings?
>> 
> 
> Not that I'm aware of, I've added Linus Walleij (the pinctrl subsystem
> maintainer) on cc who will have an authoritative answer on this
> subject.

Having some sort of debugfs API for runtime modification of pinmux 
settings from userspace would be very helpful for hardware/firmware 
prototyping purposes.

> [snip]
> 
> You are only defining a set of pinmux configuration pins that will be
> registered but that does not mean that the configuration will take
> effect. Need to associate that configuration with a specific device
> node so the state will be applicable. The good practice is to
> associate with the device that needs that particular configuration or
> if there is no such device then you can just add the properties in the
> pinmux device node.
> 
> In your case would be something like should work:
> 
> &omap4_pmx_core
> {
>         pinctrl-names = "default";
>         pinctrl-0 = <
>                 &foo_pins
>         >;
> 
>         foo_pins: pinmux_foo_pins {
>                pinctrl-single,pins = <
>                0x5e (PIN_INPUT | MUX_MODE3)  /* gpmc_ad15.gpio_39 */ /* 
> IRQ */
>                0x12e (PIN_INPUT | MUX_MODE3) /* i2c4_scl.gpio_132 */ /* 
> RST */
>                >
>         };
> };

Note that this doesn't work; the omap4_pmx_core node already has a 
pinctrl-0 attribute with a whole bunch of entries (e.g. I2C pins and 
pins used for other peripherals) and there doesn't appear to be a way to 
append to the array rather than replacing it.

> But as I said it would be better if you associate the pins with the
> GPIO controller that contains those pins instead of the pinmux device.

Following this advice, I used:

&gpio1
{
   pinctrl-names = "default";
   pinctrl-0 = < &foo_pins >;
};

However, with these settings, nothing referring to pinmux_foo_pins 
appears in pinctrl-devices, pinctrl-maps, pinctrl-handles, or 
pinmux-pins, so I'm fairly sure these aren't the settings I'm looking 
for.

Is there any documentation for the debugfs interface to pinctrl?

                                                       Peter


-- 
Dr Peter Brett <peter at peter-b.co.uk>




More information about the linux-arm-kernel mailing list