From: Ludovic Desroches <ludovic.desroches@microchip.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>
Subject: Re: [RFC PATCH 2/2] gpio: provide a consumer when requesting a gpio
Date: Fri, 26 Jan 2018 08:32:13 +0100 [thread overview]
Message-ID: <20180126073213.GW3055@rfolt0960.corp.atmel.com> (raw)
In-Reply-To: <CAHp75VeuX8kGumtiu6iBhJ+AL+Ug3dm5Pb_tQ8YYYU9SH+QSZA@mail.gmail.com>
On Wed, Jan 24, 2018 at 05:42:15PM +0200, Andy Shevchenko wrote:
> On Wed, Jan 24, 2018 at 3:07 PM, Ludovic Desroches
> <ludovic.desroches@microchip.com> wrote:
> > On Thu, Jan 18, 2018 at 04:22:28PM +0100, Ludovic Desroches wrote:
> >> On Thu, Jan 18, 2018 at 11:30:00AM +0100, Linus Walleij wrote:
> >> > On Mon, Jan 15, 2018 at 5:24 PM, Ludovic Desroches
> >> > <ludovic.desroches@microchip.com> wrote:
>
> >> > I think we need to think over what is a good way to share ownership
> >> > of a pin.
> >> >
> >> > Russell pointed me to a similar problem incidentally and I briefly looked
> >> > into it: there are cases when several devices may need to hold the
> >> > same pin.
> >> >
> >> > Can't we just look up the associated gpio_chip from the GPIO range,
> >> > and in case the pin is connected between the pin controller and
> >> > the GPIO chip, then we allow the gpiochip to also take a
> >> > reference?
>
> How do you find my proposal about introducing ownership level (not
> requested yet; exclusive; shared)?
>
Yes but I don't see how I can fix my issue with these levels. In my
case, I need an exclusive ownership at device level not at pin level. In
reality, it is at pin level but I am in this situation because my pin
controler was introduced as non strict and also because I need to set
the configuration of the pin which is going to be used as a GPIO.
If the ownership is exclusive, pinmuxing coming from pinctrl-default
will be accepted but the GPIO request will fail even if it comes from the
same device.
If the ownership is shared then, pinmuxing coming from pinctrl-default
will be accepted but a GPIO request from another device will be accepted
too.
Both situations are incorrect in my case.
Let me know if I have not well understood your proposal. My concern is
to get out of this situation without breaking current DTs.
Regards
Ludovic
> >> It's the probably the way to go, it was Maxime's proposal and Andy seems
> >> to agree this solution.
>
> Confirm with caveat that this is a fix for subset of cases.
>
> > If pin_request() is called with gpio_range not NULL, it means that the
> > requests comes from a GPIO chip and the pin controller handles this pin.
> > In this case, I would say the pin is connected between the pin
> > controller and the GPIO chip. Is my assumption right?
> >
> > I am not sure it will fit all the cases:
>
> I think it doesn't cover cases when you have UART + UART + GPIO (I
> posted early a use case example).
>
> But at least it doesn't move things in a wrong direction.
>
> > - case 1: device A requests the pin (pinctrl-default state) and mux it
> > as a GPIO. Later,it requests the pin as a GPIO (gpiolib). This 'weird'
> > situation happens because some strict pin controllers were not declared
> > as strict and/or pinconf is needed.
> >
> > - case 2: device A requests the pin (pinctrl-default state). Device B
> > requests the pin as a GPIO (gpiolib).
> >
> > In case 1, pin_request must not return an error. In case 2, pin_request
> > must return an error even if the pin is connected between the pin
> > controller and the GPIO chip.
>
> For these cases looks OK to me.
>
> >> > I.e. in that case you just allow gpio_owner to proceed and take the
> >> > pin just like with a non-strict controller.
>
> --
> With Best Regards,
> Andy Shevchenko
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-26 7:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 16:24 [RESEND RFC PATCH 0/2] fixing the gpio ownership Ludovic Desroches
2018-01-15 16:24 ` [RFC PATCH 1/2] pinctrl: add consumer variant for gpio request Ludovic Desroches
2018-01-15 16:24 ` [RFC PATCH 2/2] gpio: provide a consumer when requesting a gpio Ludovic Desroches
2018-01-18 10:30 ` Linus Walleij
2018-01-18 15:22 ` Ludovic Desroches
2018-01-24 13:07 ` Ludovic Desroches
2018-01-24 15:42 ` Andy Shevchenko
2018-01-26 7:32 ` Ludovic Desroches [this message]
2018-01-26 17:13 ` Andy Shevchenko
2018-01-29 13:43 ` Ludovic Desroches
2018-01-18 10:16 ` [RESEND RFC PATCH 0/2] fixing the gpio ownership Linus Walleij
2018-01-18 15:12 ` Ludovic Desroches
2018-01-19 21:02 ` Linus Walleij
-- strict thread matches above, loose matches on Subject: below --
2018-01-15 16:22 [RFC " Ludovic Desroches
2018-01-15 16:22 ` [RFC PATCH 2/2] gpio: provide a consumer when requesting a gpio Ludovic Desroches
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=20180126073213.GW3055@rfolt0960.corp.atmel.com \
--to=ludovic.desroches@microchip.com \
--cc=andy.shevchenko@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
/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).