linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: peter@peter-b.co.uk (Peter TB Brett)
To: linux-arm-kernel@lists.infradead.org
Subject: Accessing GPIOs from userspace using recent kernels
Date: Thu, 15 May 2014 15:06:28 +0100	[thread overview]
Message-ID: <7bd3dbc0c3217f43eefc8d228995690f@net2air.co> (raw)
In-Reply-To: <CABxcv=mFV3nJf1eqNhTbh1KWwe8Z6Z62JtFn5KZbHnGprk1_bg@mail.gmail.com>

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@peter-b.co.uk>

  reply	other threads:[~2014-05-15 14:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  8:46 Accessing GPIOs from userspace using recent kernels Peter TB Brett
2014-05-14 10:00 ` Javier Martinez Canillas
2014-05-15 14:06   ` Peter TB Brett [this message]
2014-05-15 18:54     ` Javier Martinez Canillas
2014-05-16 10:15       ` Peter TB Brett
2014-05-17 12:16         ` Javier Martinez Canillas
2014-05-23 11:35         ` Linus Walleij
2014-05-23 15:11           ` Tony Lindgren
2014-05-30 19:35             ` Javier Martinez Canillas
2014-05-30 20:25               ` Tony Lindgren
2014-05-31  0:40                 ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7bd3dbc0c3217f43eefc8d228995690f@net2air.co \
    --to=peter@peter-b.co.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).