All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benoit Parrot <bparrot@ti.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Alexandre Courbot <gnurou@gmail.com>,
	Pantelis Antoniou <panto@antoniou-consulting.com>,
	Jiri Prchal <jiri.prchal@aksignal.cz>,
	Linus Walleij <linus.walleij@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [Patch v2 1/2] gpio: add GPIO hogging mechanism
Date: Mon, 1 Dec 2014 18:27:59 -0600	[thread overview]
Message-ID: <20141202002758.GC24551@ti.com> (raw)
In-Reply-To: <20141201163639.GI25249@lukather>

Maxime Ripard <maxime.ripard@free-electrons.com> wrote on Mon [2014-Dec-01 17:36:39 +0100]:
> Hi,
> 
> On Fri, Nov 28, 2014 at 04:30:01PM +0900, Alexandre Courbot wrote:
> > > +/**
> > > + * do_gpio_hog - Given node is a GPIO hog configuration, handle it
> > > + * @np:                device node to get GPIO from
> > > + *
> > > + * This is only used by of_gpiochip_add to request/set GPIO initial
> > > + * configuration.
> > > + */
> > > +static int do_gpio_hog(struct device_node *np)
> > > +{
> > > +       struct gpio_desc *desc = NULL;
> > > +       int err;
> > > +       const char *name;
> > > +       enum gpio_lookup_flags lflags;
> > > +       enum gpiod_flags dflags;
> > > +
> > > +       desc = of_get_gpio_hog(np, &name, &lflags, &dflags);
> > > +       if (!desc)
> > > +               return -ENOTSUPP;
> > > +       else if (IS_ERR(desc))
> > > +               return PTR_ERR(desc);
> > > +
> > > +       err = gpiod_request(desc, name);
> > 
> > Using this function means that a GPIO chip module cannot be unloaded
> > if it uses GPIO hogs. Is it the intended behavior? If not, please use
> > gpiochip_request_own_desc() instead, and make sure to call
> > gpiochip_free_own_desc() for each hog when the driver is unloaded.
> 
> The only thing I'd like to have would be that the request here would
> be non-exclusive, so that a later driver would still be allowed later
> on to request that GPIO later on and manage it itself (ideally using
> the usual gpiod_request function).

I'll let Linus chime in on this.
But the premise for the hogging mechanism is to have a mechanism to set GPIOs
which do not need to be requested by any other entity.
If a driver needs access to a specific GPIO then it should use the existing
gpiolib API to request it and set it up.

> 
> Maxime
> 
> -- 
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

Regards,
Benoit

  reply	other threads:[~2014-12-02  0:28 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 23:54 [Patch v2 0/2] gpio: add GPIO hogging mechanism Benoit Parrot
2014-11-20 23:54 ` Benoit Parrot
2014-11-20 23:54 ` [Patch v2 1/2] " Benoit Parrot
2014-11-20 23:54   ` Benoit Parrot
2014-11-28  7:30   ` Alexandre Courbot
2014-12-01 16:36     ` Maxime Ripard
2014-12-02  0:27       ` Benoit Parrot [this message]
2014-12-02 14:13       ` Alexandre Courbot
2014-12-02 14:29         ` Linus Walleij
2014-12-02 16:12           ` Maxime Ripard
2014-12-04 14:15             ` Alexandre Courbot
     [not found]               ` <CAAVeFu+Gms6ptyK6j1Zy_wWg+9URs+9zBu=pOiwiEERO=8NjNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-04 14:27                 ` Pantelis Antoniou
2014-12-04 14:27                   ` Pantelis Antoniou
2014-12-04 14:41                   ` Alexandre Courbot
2014-12-04 14:47                     ` Pantelis Antoniou
2014-12-04 14:47                       ` Pantelis Antoniou
     [not found]                       ` <C9DBE2F0-A725-4D05-BEC6-F083F3F83B9F-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2014-12-04 14:58                         ` Alexandre Courbot
2014-12-04 14:58                           ` Alexandre Courbot
2014-12-04 15:02                           ` Pantelis Antoniou
2014-12-04 15:02                             ` Pantelis Antoniou
2014-12-04 15:10                             ` Alexandre Courbot
2014-12-04 15:22                               ` Pantelis Antoniou
2014-12-04 15:22                                 ` Pantelis Antoniou
     [not found]                                 ` <8717617A-56AE-495C-B873-0B2E3EA83060-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2014-12-06 12:04                                   ` Alexandre Courbot
2014-12-06 12:04                                     ` Alexandre Courbot
2014-12-04 14:27               ` Maxime Ripard
2014-12-04 14:49                 ` Alexandre Courbot
2014-12-05 10:24                   ` Maxime Ripard
2014-12-06 12:08                     ` Alexandre Courbot
2014-12-08 19:18                       ` Maxime Ripard
2014-12-04 14:52               ` Maxime Ripard
2014-12-04 15:00                 ` Alexandre Courbot
2015-01-12  9:40             ` Linus Walleij
2015-01-12 12:45               ` Mark Brown
2014-12-02  0:22     ` Benoit Parrot
     [not found]       ` <20141202002244.GB24551-l0cyMroinI0@public.gmane.org>
2014-12-02 14:10         ` Alexandre Courbot
2014-12-02 14:10           ` Alexandre Courbot
     [not found]           ` <CAAVeFuJWPvdmO_KPXP2LrkAy4SQDZ+f7pvE6U8r7gPH+jE3Lrw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-02 14:28             ` Linus Walleij
2014-12-02 14:28               ` Linus Walleij
2014-12-02 14:25         ` Linus Walleij
2014-12-02 14:25           ` Linus Walleij
2014-11-20 23:54 ` [Patch v2 2/2] gpio: Document " Benoit Parrot
2014-11-20 23:54   ` Benoit Parrot
     [not found]   ` <1416527684-19017-3-git-send-email-bparrot-l0cyMroinI0@public.gmane.org>
2014-11-28  7:31     ` Alexandre Courbot
2014-11-28  7:31       ` Alexandre Courbot
2014-12-01 22:57       ` Benoit Parrot
2014-12-02 14:04         ` Alexandre Courbot

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=20141202002758.GC24551@ti.com \
    --to=bparrot@ti.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=jiri.prchal@aksignal.cz \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=panto@antoniou-consulting.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 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.