Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Manivannan Sadhasivam <mani@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Kees Cook <kees@kernel.org>, Mika Westerberg <westeri@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andy Shevchenko <andy@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH RFC 0/9] gpio: improve support for shared GPIOs
Date: Tue, 21 Oct 2025 18:56:13 +0300	[thread overview]
Message-ID: <aPetHXE0zuWANRNd@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=Me+4H6G+-Qj_Gz2cv2MgRHOmrjMyNwJr+ardDR1ndYHvQ@mail.gmail.com>

On Tue, Oct 21, 2025 at 02:06:30PM +0200, Bartosz Golaszewski wrote:
> On Tue, Oct 21, 2025 at 3:53 AM Manivannan Sadhasivam <mani@kernel.org> wrote:

...

> > > That only happens if the driver uses the reset API. If you go with the
> > > GPIOLIB then none of this matters. I definitely don't want to change
> > > the existing DT sources either but I want to find out if the code in
> > > this series is suitable (with some modifications) for supporting the
> > > PERST# line or if the logic behind it is more complex and possibly
> > > requires separate, more fine-grained handling.
> >
> > All PCI controllers relied on '{reset/perst}-gpios' property for handling the
> > PERST# signal. Now if we change it to a reset line, then the drivers have to
> > first detect it as a reset line and use the reset APIs, if not fallback to gpiod
> > APIs (for DT backwards compatibility), which will add unncessary churn IMO.

Can't the reset check be added into a common place once for all the PCI controllers?
Also one can make a helper that does all necessary checks and if required falls back
to the GPIO.

int pcie_controller_get_perst(... dev, const chat *con_id /* fallback */);

(name is from top of my mind without following any patterns).


> Ok so some platforms define perst-gpios while others use reset-gpios,
> I see now. Yeah, it's better to go with explicit GPIOs then.
> 
> > But if there is no way the GPIO subsystem is going to support shared GPIOs, then
> > we have to live with it.
> 
> Well, there is going to be. We already de-facto have it but it doesn't
> work very well and is fragile (I'm talking about the non-exclusive
> flag). I very much intend to bring this upstream.
> 
> My question wrt PCI PERST# was whether this is useful for it because
> IIRC all endpoints sharing the signal will assert it (or rather their
> pwrctl drivers will) and then only deassert it once all endpoints are
> powered up. This would translate to the pwrctl driver doing the
> following for each endpoint:
> 
> perst = gpiod_get(dev, "perst");
> gpiod_set_value_cansleep(perst, 1);
> 
> Do the power up.
> 
> gpiod_set_value_cansleep(perst, 0);
> 
> And with the implementation this series proposes it would mean that
> the perst signal will go high after the first endpoint pwrctl driver
> sets it to high and only go down once the last driver sets it to low.
> The only thing I'm not sure about is the synchronization between the
> endpoints - how do we wait for all of them to be powered-up before
> calling the last gpiod_set_value()?

The refcount inside GPIO descriptor? Then gpiod_set_value() will do the magic.

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2025-10-21 15:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 14:51 [PATCH RFC 0/9] gpio: improve support for shared GPIOs Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 1/9] gpio: wcd934x: mark the GPIO controller as sleeping Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 2/9] string: provide strends() Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 3/9] gpiolib: define GPIOD_FLAG_SHARED Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 4/9] gpiolib: implement low-level, shared GPIO support Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 5/9] gpio: shared-proxy: implement the shared GPIO proxy driver Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 6/9] gpiolib: support shared GPIOs in core subsystem code Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 7/9] arm64: select HAVE_SHARED_GPIOS for ARCH_QCOM Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 8/9] ASoC: wsa881x: drop GPIOD_FLAGS_BIT_NONEXCLUSIVE flag from GPIO lookup Bartosz Golaszewski
2025-09-24 14:51 ` [PATCH RFC 9/9] ASoC: wsa883x: " Bartosz Golaszewski
2025-09-24 18:25 ` [PATCH RFC 0/9] gpio: improve support for shared GPIOs Dmitry Torokhov
2025-09-24 18:58   ` Bartosz Golaszewski
2025-10-06 15:43   ` Manivannan Sadhasivam
2025-10-06 16:10     ` Bartosz Golaszewski
2025-10-06 21:52       ` Srinivas Kandagatla
2025-10-06 22:09       ` Manivannan Sadhasivam
2025-10-07 12:29         ` Bartosz Golaszewski
2025-10-21  1:53           ` Manivannan Sadhasivam
2025-10-21 12:06             ` Bartosz Golaszewski
2025-10-21 12:19               ` Manivannan Sadhasivam
2025-10-21 12:22                 ` Bartosz Golaszewski
2025-10-21 12:53                   ` Manivannan Sadhasivam
2025-10-21 14:02                     ` Bartosz Golaszewski
2025-10-21 15:56               ` Andy Shevchenko [this message]
2025-10-01  8:49 ` Linus Walleij
2025-10-01 10:53   ` Linus Walleij
2025-10-01 13:04     ` Bartosz Golaszewski
2025-10-04 13:31 ` Srinivas Kandagatla
2025-10-06 11:55   ` Bartosz Golaszewski
2025-10-06 21:55     ` Srinivas Kandagatla
2025-10-07 13:13       ` Bartosz Golaszewski
2025-10-07 13:18         ` Mark Brown
2025-10-07 13:21           ` Bartosz Golaszewski
2025-10-06 12:19   ` Mark Brown
2025-10-07 12:32     ` Srinivas Kandagatla
2025-10-09 10:12 ` (subset) " Bartosz Golaszewski
2025-10-17 17:26 ` Bartosz Golaszewski
2025-10-17 17:32   ` Mark Brown
2025-10-20  9:41     ` Bartosz Golaszewski
2025-10-21 14:08       ` Mark Brown
2025-10-21 14:42         ` Bartosz Golaszewski
2025-10-21 15:02           ` Mark Brown

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=aPetHXE0zuWANRNd@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --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-sound@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=srini@kernel.org \
    --cc=tiwai@suse.com \
    --cc=westeri@kernel.org \
    --cc=will@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