[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McPvFzb7CSFSKOsQZD9ZPwtf+bCw+Ui=m6OoX0GxH9DtQ@mail.gmail.com>
Date: Wed, 30 Jul 2025 16:45:21 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, Alexey Klimov <alexey.klimov@...aro.org>,
Lorenzo Bianconi <lorenzo@...nel.org>, Sean Wang <sean.wang@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Paul Cercueil <paul@...pouillou.net>, Kees Cook <kees@...nel.org>,
Andy Shevchenko <andy@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>, Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...nel.org>, Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
Dong Aisheng <aisheng.dong@....com>, Fabio Estevam <festevam@...il.com>,
Shawn Guo <shawnguo@...nel.org>, Jacky Bai <ping.bai@....com>,
Pengutronix Kernel Team <kernel@...gutronix.de>, NXP S32 Linux Team <s32@....com>,
Sascha Hauer <s.hauer@...gutronix.de>, Tony Lindgren <tony@...mide.com>,
Haojian Zhuang <haojian.zhuang@...aro.org>, Geert Uytterhoeven <geert+renesas@...der.be>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-mips@...r.kernel.org,
linux-hardening@...r.kernel.org, linux-mm@...ck.org, imx@...ts.linux.dev,
linux-omap@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v3 12/15] pinctrl: allow to mark pin functions as
requestable GPIOs
On Wed, Jul 30, 2025 at 3:30 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Wed, Jul 30, 2025 at 2:53 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> > On Wed, Jul 30, 2025 at 2:50 PM Andy Shevchenko
> > <andy.shevchenko@...il.com> wrote:
> > > On Wed, Jul 30, 2025 at 11:54 AM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> > > > On Thu, Jul 24, 2025 at 2:22 PM Andy Shevchenko
> > > > <andy.shevchenko@...il.com> wrote:
> > > > >
> > > > > > struct pinfunction {
> > > > > > const char *name;
> > > > > > const char * const *groups;
> > > > > > size_t ngroups;
> > > > > > + unsigned long flags;
> > > > >
> > > > > Not sure we need this. If the function is GPIO, pin control already
> > > > > knows about this. The pin muxing has gpio request / release callbacks
> > > > > that change the state. Why do we need an additional flag(s)?
> > > >
> > > > I'm not following, how does the pin controller know that the function
> > > > is GPIO exactly, other than by the bit set in this field?
> > >
> > > AFAICS the gpio_owner != NULL means that. No need to have a duplicate
> > > of this information.
> >
> > No, that's not at all what this series does... gpio_owner is the
> > consumer label of a pin used by the GPIOLIB framework. The flag I'm
> > introducing it telling the pinctrl core - before GPIOLIB is ever
> > involved - that *this pin can be requested as a GPIO by GPIOLIB*.
>
> The certain pin control driver may even not know about this. But even
> though the proposed change is an overkill. If it indeed needs to be
> done, the solution of valid_mask approach sounds to me much better. It
> will be a single bitmask per pin control to tell this.
>
> > It's
> > the other way around - without knowing this, for strict pinmuxers,
> > GPIOLIB would never be able to request this pin if it was muxed to a
> > function (even if the function is called "GPIO").
>
> I need to read the series again, but I truly believe we don't need
> this new field in the struct pinfunction.
>
Without a code example, I can't tell what you're imagining but let me
give some more context: the flags field could only exist in the
qualcomm drivers but the problem will be the same on all existing
platforms so IMO it's better to centralize it right away. And if we're
already centralizing it, let's make it future proof by making it
possible to define more such flags if we need it. Since the GPIO
category is a function property, it only makes sense to put it in the
structure defining the function.
Bartosz
Powered by blists - more mailing lists