All of lore.kernel.org
 help / color / mirror / Atom feed
From: Domenico Andreoli <cavokz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	"rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org"
	<rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"bryan.wu-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org"
	<bryan.wu-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
	"linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Linus Walleij
	<linus.walleij-68IGFXMjmZ7QT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2] leds: leds-gpio: adopt pinctrl support
Date: Sun, 9 Sep 2012 01:44:35 +0200	[thread overview]
Message-ID: <20120908234435.GA13519@glitch> (raw)
In-Reply-To: <CACRpkdbz7CQtaj9e-1kcRVszpCSoqKz=19YT68sTMF9SOyWa8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, Sep 07, 2012 at 11:57:59PM +0200, Linus Walleij wrote:
> On Fri, Sep 7, 2012 at 6:00 PM, Domenico Andreoli <cavokz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > On Fri, Sep 07, 2012 at 02:30:59PM +0000, AnilKumar, Chimata wrote:
> 
> >> How can gpio driver knows that leds-gpio driver require
> >> these 4 pins?
> >
> > because leds-gpio requests each gpio (specified in the DT against a specific
> > gpio controller) before assuming it is available?  gpiolib then asks to
> > pinctrl if those pins are available for gpio and possibly reserve them
> > (configuring the mux, if necessary) for the device.
> 
> So this is not an either-or situation but a both-and case.
>
...
> 
> If all you need to to is to multiplex the pins into GPIO mode,
> then the gpio_get() call on this driver *can* call through to
> pinctrl_request_gpio() which will in turn fall through to the
> above pinmux driver calls (.gpio_request_enable, etc).

So if the GPIO driver doesn't coordinate with the pinctrl driver, it's
all left to the GPIO user to configure the pin before using it, right?

I can understand the concerns of Tony, whether a pin must be requested
or not before the gpio then depends on the GPIO driver implementation,
which may or may not call through the pinctrl layer, isn't it?.

> But that's as far as it goes! The GPIO abstraction cannot
> call through to e.g. set some specific biasing on the pins
> (pull up etc). Doing that would require us to reimplement
> every interface that pinctrl already has again in the
> GPIO layer, which is not a good idea.

Yes, clear. Never meant that, I thought that the pinctrl was anyway
available for stuff not modeled by the GPIO layer, as you say below.

> So the pinctrl handle can be used for such config, and it
> can also be used for multiplexing if that is desired - if not
> done by the fall through functions pinctrl_gpio_*().
> 
> You can use a combination of both too, Stephen patched
> pinctrl some time back so that a pin can be muxed for a
> certain function and used as GPIO at the same time, so
> these two are now orthogonal, it's a bit relaxed and gives some
> feeling of loss of control but was necessary for certain
> usecases. (For example we can snoop on a I2C pin using
> its corresponding GPIO registers in the U300...)
>
> There is some flexibility here, I hope it's not too confusing :-/

Thank you for clarifying :)

Regards,
Domenico

WARNING: multiple messages have this Message-ID (diff)
From: cavokz@gmail.com (Domenico Andreoli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] leds: leds-gpio: adopt pinctrl support
Date: Sun, 9 Sep 2012 01:44:35 +0200	[thread overview]
Message-ID: <20120908234435.GA13519@glitch> (raw)
In-Reply-To: <CACRpkdbz7CQtaj9e-1kcRVszpCSoqKz=19YT68sTMF9SOyWa8w@mail.gmail.com>

On Fri, Sep 07, 2012 at 11:57:59PM +0200, Linus Walleij wrote:
> On Fri, Sep 7, 2012 at 6:00 PM, Domenico Andreoli <cavokz@gmail.com> wrote:
> > On Fri, Sep 07, 2012 at 02:30:59PM +0000, AnilKumar, Chimata wrote:
> 
> >> How can gpio driver knows that leds-gpio driver require
> >> these 4 pins?
> >
> > because leds-gpio requests each gpio (specified in the DT against a specific
> > gpio controller) before assuming it is available?  gpiolib then asks to
> > pinctrl if those pins are available for gpio and possibly reserve them
> > (configuring the mux, if necessary) for the device.
> 
> So this is not an either-or situation but a both-and case.
>
...
> 
> If all you need to to is to multiplex the pins into GPIO mode,
> then the gpio_get() call on this driver *can* call through to
> pinctrl_request_gpio() which will in turn fall through to the
> above pinmux driver calls (.gpio_request_enable, etc).

So if the GPIO driver doesn't coordinate with the pinctrl driver, it's
all left to the GPIO user to configure the pin before using it, right?

I can understand the concerns of Tony, whether a pin must be requested
or not before the gpio then depends on the GPIO driver implementation,
which may or may not call through the pinctrl layer, isn't it?.

> But that's as far as it goes! The GPIO abstraction cannot
> call through to e.g. set some specific biasing on the pins
> (pull up etc). Doing that would require us to reimplement
> every interface that pinctrl already has again in the
> GPIO layer, which is not a good idea.

Yes, clear. Never meant that, I thought that the pinctrl was anyway
available for stuff not modeled by the GPIO layer, as you say below.

> So the pinctrl handle can be used for such config, and it
> can also be used for multiplexing if that is desired - if not
> done by the fall through functions pinctrl_gpio_*().
> 
> You can use a combination of both too, Stephen patched
> pinctrl some time back so that a pin can be muxed for a
> certain function and used as GPIO at the same time, so
> these two are now orthogonal, it's a bit relaxed and gives some
> feeling of loss of control but was necessary for certain
> usecases. (For example we can snoop on a I2C pin using
> its corresponding GPIO registers in the U300...)
>
> There is some flexibility here, I hope it's not too confusing :-/

Thank you for clarifying :)

Regards,
Domenico

  parent reply	other threads:[~2012-09-08 23:44 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-01  8:16 [PATCH v2] leds: leds-gpio: adopt pinctrl support AnilKumar Ch
2012-09-01  8:16 ` AnilKumar Ch
2012-09-05  3:06 ` Bryan Wu
2012-09-05  3:06   ` Bryan Wu
     [not found]   ` <CAK5ve-Jqc1xpXa0VM7=+MN1cvm=8ysg9W9WRiG66yq7GRfh+Gw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-05  3:13     ` Marek Vasut
2012-09-05  3:13       ` Marek Vasut
2012-09-05 23:34       ` Tony Lindgren
2012-09-05 23:34         ` Tony Lindgren
2012-09-06  2:05         ` Marek Vasut
2012-09-06  2:05           ` Marek Vasut
2012-09-06 17:45           ` Tony Lindgren
2012-09-06 17:45             ` Tony Lindgren
2012-09-07  0:09             ` Marek Vasut
2012-09-07  0:09               ` Marek Vasut
2012-09-07  7:59               ` AnilKumar, Chimata
2012-09-07  7:59                 ` AnilKumar, Chimata
2012-09-07  8:22                 ` Marek Vasut
2012-09-07  8:22                   ` Marek Vasut
2012-09-07 16:00                 ` Bryan Wu
2012-09-07 16:00                   ` Bryan Wu
2012-09-07 21:39             ` Linus Walleij
2012-09-07 21:39               ` Linus Walleij
     [not found]               ` <CACRpkdYgcYAFy7bBn3XNcrkSoCpeA8yNaa9LZNd4w33Zp3Jjnw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-07 21:46                 ` Tony Lindgren
2012-09-07 21:46                   ` Tony Lindgren
     [not found] ` <1346487390-11399-1-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-09-07  8:48   ` Domenico Andreoli
2012-09-07  8:48     ` Domenico Andreoli
2012-09-07  9:10     ` AnilKumar, Chimata
2012-09-07  9:10       ` AnilKumar, Chimata
2012-09-07 11:02       ` Domenico Andreoli
2012-09-07 11:02         ` Domenico Andreoli
2012-09-07 14:30         ` AnilKumar, Chimata
2012-09-07 14:30           ` AnilKumar, Chimata
     [not found]           ` <331ABD5ECB02734CA317220B2BBEABC13EA29BF3-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-09-07 16:00             ` Domenico Andreoli
2012-09-07 16:00               ` Domenico Andreoli
2012-09-07 16:35               ` Tony Lindgren
2012-09-07 16:35                 ` Tony Lindgren
2012-09-07 21:59                 ` Linus Walleij
2012-09-07 21:59                   ` Linus Walleij
2012-09-07 21:57               ` Linus Walleij
2012-09-07 21:57                 ` Linus Walleij
     [not found]                 ` <CACRpkdbz7CQtaj9e-1kcRVszpCSoqKz=19YT68sTMF9SOyWa8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-08 23:44                   ` Domenico Andreoli [this message]
2012-09-08 23:44                     ` Domenico Andreoli
2012-09-10 15:23                     ` Linus Walleij
2012-09-10 15:23                       ` Linus Walleij
2012-09-10 17:41                       ` Stephen Warren
2012-09-10 17:41                         ` Stephen Warren
2012-09-10 19:34                         ` Linus Walleij
2012-09-10 19:34                           ` Linus Walleij
2012-09-10 19:44                           ` Stephen Warren
2012-09-10 19:44                             ` Stephen Warren
2012-09-07 21:36 ` Linus Walleij
2012-09-07 21:36   ` Linus Walleij
2012-09-10 19:40 ` Linus Walleij
2012-09-10 19:40   ` Linus Walleij
     [not found]   ` <CACRpkdbSY-aH_Vf3Q4h-ufz35m6=vVXCEecGGS-WOsG7vmPZ0g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-01  7:03     ` AnilKumar, Chimata
2012-10-01  7:03       ` AnilKumar, Chimata
2012-10-01  8:24       ` Linus Walleij
2012-10-01  8:24         ` Linus Walleij
2012-10-01 15:44         ` Tony Lindgren
2012-10-01 15:44           ` Tony Lindgren
2012-10-01 19:59           ` Linus Walleij
2012-10-01 19:59             ` Linus Walleij
     [not found]             ` <CACRpkdaib2M1_UwSbyUG8qwZC2h7xaT5VU7WMj=y+h4S4LianQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-03 10:52               ` AnilKumar, Chimata
2012-10-03 10:52                 ` AnilKumar, Chimata
     [not found]                 ` <331ABD5ECB02734CA317220B2BBEABC13EA3F22E-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-10-03 12:36                   ` Linus Walleij
2012-10-03 12:36                     ` Linus Walleij
2012-10-30 14:12                     ` AnilKumar, Chimata
2012-10-30 14:12                       ` AnilKumar, Chimata
2012-11-04 17:37                       ` Linus Walleij
2012-11-04 17:37                         ` Linus Walleij
2012-11-05  6:44                         ` AnilKumar, Chimata
2012-11-05  6:44                           ` AnilKumar, Chimata
2012-11-05 16:27                         ` Tony Lindgren
2012-11-05 16:27                           ` Tony Lindgren
2012-10-03 15:53                 ` Tony Lindgren
2012-10-03 15:53                   ` Tony Lindgren

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=20120908234435.GA13519@glitch \
    --to=cavokz-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=bryan.wu-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linus.walleij-68IGFXMjmZ7QT0dZR+AlfA@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-leds-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rpurdie-Fm38FmjxZ/leoWH0uzbU5w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.