From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Frank Rowand <frowand.list@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
Rob Herring <robh+dt@kernel.org>,
Peter Ujfalusi <peter.ujfalusi@ti.com>,
Chris Brandt <chris.brandt@renesas.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH/RFC 2/2] gpio: of: Add DT overlay support for GPIO hogs
Date: Tue, 7 Jan 2020 09:02:19 +0100 [thread overview]
Message-ID: <CAMuHMdUJ_jknvY_Fp0Tghif_J3uaT9MhiX5KXXBKJ_=P4hfkUQ@mail.gmail.com> (raw)
In-Reply-To: <49c477ed-0da3-9269-803a-cc35cd1137b8@gmail.com>
Hi Frank,
On Tue, Jan 7, 2020 at 8:26 AM Frank Rowand <frowand.list@gmail.com> wrote:
> On 1/7/20 1:10 AM, Frank Rowand wrote:
> > On 1/6/20 5:34 PM, Frank Rowand wrote:
> >> On 12/30/19 7:38 AM, Geert Uytterhoeven wrote:
> >>> As GPIO hogs are configured at GPIO controller initialization time,
> >>> adding/removing GPIO hogs in DT overlays does not work.
> >>>
> >>> Add support for GPIO hogs described in DT overlays by registering an OF
> >>> reconfiguration notifier, to handle the addition and removal of GPIO hog
> >>> subnodes to/from a GPIO controller device node.
> >>>
> >>> Note that when a GPIO hog device node is being removed, its "gpios"
> >>> properties is no longer available, so we have to keep track of which
> >>> node a hog belongs to, which is done by adding a pointer to the hog's
> >>> device node to struct gpio_desc.
> >>
> >> If I have read the patches and the existing overlay source correctly,
> >> then some observations:
> >>
> >> - A gpio hog node added in an overlay will be properly processed.
> >>
> >> - A gpio hog node already existing in the live devicetree, but with a
> >> non-active status will be properly processed if the status of the
> >> gpio hog node is changed to "ok" in the overlay.
> >>
> >> - If a gpio hog node already exists in the live devicetree with an
> >> active status, then any updated or added properties in that gpio
> >> hog node in the overlay will have no effect.
> >>
> >> There is a scenario where the updated property would have an effect:
> >> apply a second overlay that sets the status to inactive, then apply
> >> a third overlay that sets the status back to active. This is a
> >> rather contrived example and I think it should be documented as
> >> not supported and the result undefined.
> >
> > I went back and double checked the related code. For gpio hog nodes
> > that are in a non-overlay, the status property is checked because
> > of_gpiochip_scan_gpios() uses for_each_available_child_of_node()
> > to search for gpio hog nodes, and for_each_available_child_of_node()
> > checks the status property. But in the case of a gpio hog node
> > added by an overlay, of_gpio_notify() does not check the status
> > property in the gpio hog node. The check for the status property
> > should be added to of_gpio_notify().
>
> One more thing I have not thought through is the case where the
> overlay contains both the gpio node and the gpio hog node. I'll
> walk through that tomorrow.
I haven't veried that, but I assume that works already without my patch,
as GPIO hogs are configured at GPIO controller initialization time.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2020-01-07 8:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-30 13:38 [PATCH/RFC 0/2] gpio: of: Add DT overlay support for GPIO hogs Geert Uytterhoeven
2019-12-30 13:38 ` [PATCH/RFC 1/2] gpio: of: Extract of_gpiochip_add_hog() Geert Uytterhoeven
2019-12-30 13:38 ` [PATCH/RFC 2/2] gpio: of: Add DT overlay support for GPIO hogs Geert Uytterhoeven
2020-01-06 23:34 ` Frank Rowand
2020-01-07 7:10 ` Frank Rowand
2020-01-07 7:25 ` Frank Rowand
2020-01-07 8:02 ` Geert Uytterhoeven [this message]
2020-01-07 8:11 ` Geert Uytterhoeven
2020-01-24 21:57 ` Frank Rowand
2020-01-24 22:02 ` Frank Rowand
2020-01-07 7:59 ` Geert Uytterhoeven
2020-01-03 9:51 ` [PATCH/RFC 0/2] " Bartosz Golaszewski
2020-01-07 7:46 ` Geert Uytterhoeven
2020-01-07 9:03 ` Bartosz Golaszewski
2020-01-07 9:49 ` Geert Uytterhoeven
2020-01-06 23:34 ` Frank Rowand
2020-01-07 7:51 ` Geert Uytterhoeven
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='CAMuHMdUJ_jknvY_Fp0Tghif_J3uaT9MhiX5KXXBKJ_=P4hfkUQ@mail.gmail.com' \
--to=geert@linux-m68k.org \
--cc=bgolaszewski@baylibre.com \
--cc=chris.brandt@renesas.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=geert+renesas@glider.be \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=pantelis.antoniou@konsulko.com \
--cc=peter.ujfalusi@ti.com \
--cc=robh+dt@kernel.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).