linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bjorn Andersson <andersson@kernel.org>,
	 Konrad Dybcio <konradybcio@kernel.org>,
	Alexey Klimov <alexey.klimov@linaro.org>,
	 Lorenzo Bianconi <lorenzo@kernel.org>,
	Sean Wang <sean.wang@kernel.org>,
	 Matthias Brugger <matthias.bgg@gmail.com>,
	 AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	 Paul Cercueil <paul@crapouillou.net>,
	Kees Cook <kees@kernel.org>,  Andy Shevchenko <andy@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 David Hildenbrand <david@redhat.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	 "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	 Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	 Dong Aisheng <aisheng.dong@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	 Shawn Guo <shawnguo@kernel.org>, Jacky Bai <ping.bai@nxp.com>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	NXP S32 Linux Team <s32@nxp.com>,
	 Sascha Hauer <s.hauer@pengutronix.de>,
	Tony Lindgren <tony@atomide.com>,
	 Haojian Zhuang <haojian.zhuang@linaro.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	 linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-msm@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-mips@vger.kernel.org,  linux-hardening@vger.kernel.org,
	linux-mm@kvack.org, imx@lists.linux.dev,
	 linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v3 12/15] pinctrl: allow to mark pin functions as requestable GPIOs
Date: Wed, 30 Jul 2025 16:45:21 +0200	[thread overview]
Message-ID: <CAMRc=McPvFzb7CSFSKOsQZD9ZPwtf+bCw+Ui=m6OoX0GxH9DtQ@mail.gmail.com> (raw)
In-Reply-To: <CAHp75Vd_5HVwzuiV17XKkzpEvzd8dzPDRRx5w-VqZnjuCz6m6A@mail.gmail.com>

On Wed, Jul 30, 2025 at 3:30 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Wed, Jul 30, 2025 at 2:53 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > On Wed, Jul 30, 2025 at 2:50 PM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > > On Wed, Jul 30, 2025 at 11:54 AM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > > > On Thu, Jul 24, 2025 at 2:22 PM Andy Shevchenko
> > > > <andy.shevchenko@gmail.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


  reply	other threads:[~2025-07-30 14:45 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24  9:24 [PATCH v3 00/15] pinctrl: introduce the concept of a GPIO pin function category Bartosz Golaszewski
2025-07-24  9:24 ` [PATCH v3 01/15] lib: provide kmemdup_const() Bartosz Golaszewski
2025-07-24 11:04   ` Andy Shevchenko
2025-07-24 11:09   ` Lorenzo Stoakes
2025-07-24 11:12     ` Andy Shevchenko
2025-07-24 11:15       ` Lorenzo Stoakes
2025-07-24 11:52         ` Andy Shevchenko
2025-07-24 11:57           ` David Hildenbrand
2025-07-24  9:24 ` [PATCH v3 02/15] pinctrl: ingenic: use struct pinfunction instead of struct function_desc Bartosz Golaszewski
2025-07-30 15:35   ` Paul Cercueil
2025-07-24  9:24 ` [PATCH v3 03/15] pinctrl: airoha: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-07-24  9:24 ` [PATCH v3 04/15] pinctrl: mediatek: mt7988: use PINCTRL_PIN_FUNCTION() Bartosz Golaszewski
2025-07-24  9:24 ` [PATCH v3 05/15] pinctrl: mediatek: moore: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-07-24  9:24 ` [PATCH v3 06/15] pinctrl: imx: don't access the pin function radix tree directly Bartosz Golaszewski
2025-07-24  9:24 ` [PATCH v3 07/15] pinctrl: keembay: release allocated memory in detach path Bartosz Golaszewski
2025-07-24 11:06   ` Andy Shevchenko
2025-07-24  9:24 ` [PATCH v3 08/15] pinctrl: keembay: use a dedicated structure for the pinfunction description Bartosz Golaszewski
2025-07-24 11:11   ` Andy Shevchenko
2025-07-29  9:23     ` Bartosz Golaszewski
2025-07-24  9:24 ` [PATCH v3 09/15] pinctrl: constify pinmux_generic_get_function() Bartosz Golaszewski
2025-07-24 11:14   ` Andy Shevchenko
2025-07-30 14:53   ` Geert Uytterhoeven
2025-07-24  9:24 ` [PATCH v3 10/15] pinctrl: make struct pinfunction a pointer in struct function_desc Bartosz Golaszewski
2025-07-26 11:30   ` kernel test robot
2025-07-26 19:28     ` Andy Shevchenko
2025-07-29  9:27       ` Bartosz Golaszewski
2025-07-29 10:31         ` Andy Shevchenko
2025-07-29 11:06           ` Bartosz Golaszewski
2025-07-29 12:00             ` Andy Shevchenko
2025-07-24  9:24 ` [PATCH v3 11/15] pinctrl: qcom: use generic pin function helpers Bartosz Golaszewski
2025-07-24 10:57   ` Konrad Dybcio
2025-07-24  9:24 ` [PATCH v3 12/15] pinctrl: allow to mark pin functions as requestable GPIOs Bartosz Golaszewski
2025-07-24 12:21   ` Andy Shevchenko
2025-07-30  9:54     ` Bartosz Golaszewski
2025-07-30 12:49       ` Andy Shevchenko
2025-07-30 12:52         ` Andy Shevchenko
2025-07-30 12:53         ` Bartosz Golaszewski
2025-07-30 13:30           ` Andy Shevchenko
2025-07-30 14:45             ` Bartosz Golaszewski [this message]
2025-07-24  9:24 ` [PATCH v3 13/15] pinctrl: qcom: add infrastructure for marking pin functions as GPIOs Bartosz Golaszewski
2025-07-24  9:24 ` [PATCH v3 14/15] pinctrl: qcom: mark the `gpio` and `egpio` pins function as non-strict functions Bartosz Golaszewski
2025-07-24  9:24 ` [PATCH v3 15/15] pinctrl: qcom: make the pinmuxing strict Bartosz Golaszewski

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='CAMRc=McPvFzb7CSFSKOsQZD9ZPwtf+bCw+Ui=m6OoX0GxH9DtQ@mail.gmail.com' \
    --to=brgl@bgdev.pl \
    --cc=Liam.Howlett@oracle.com \
    --cc=aisheng.dong@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexey.klimov@linaro.org \
    --cc=andersson@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=david@redhat.com \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=haojian.zhuang@linaro.org \
    --cc=imx@lists.linux.dev \
    --cc=kees@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=konradybcio@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mhocko@suse.com \
    --cc=paul@crapouillou.net \
    --cc=ping.bai@nxp.com \
    --cc=rppt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s32@nxp.com \
    --cc=sean.wang@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=surenb@google.com \
    --cc=tony@atomide.com \
    --cc=vbabka@suse.cz \
    /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