mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shawn Guo <shengchao.guo@oss.qualcomm.com>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Yu Zhang <yu.zhang@oss.qualcomm.com>,
	linux-gpio@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Linus Walleij <linusw@kernel.org>
Subject: Re: [PATCH 1/2] gpio: shared-proxy: track direction instead of reading it back
Date: Fri, 18 Sep 2026 22:43:58 +0800	[thread overview]
Message-ID: <aq1OLkLiIL58V8aK@QCOM-aGQu4IUr3Y> (raw)
In-Reply-To: <CAMRc=McgPQe0x3bWYArqoyprh1ZF9owf3Etop1hqMt67nBXgnA@mail.gmail.com>

On Wed, Sep 16, 2026 at 04:00:01AM -0500, Bartosz Golaszewski wrote:
> On Tue, 15 Sep 2026 03:44:46 +0200, Shawn Guo
> <shengchao.guo@oss.qualcomm.com> said:
> > On boards where more than one consumer shares a Qualcomm SPMI PMIC GPIO,
> > all but the first consumer fail to configure the line as output:
> >
> >   reg-fixed-voltage regulator-wcn-core-vm-1p35: setup of GPIO (default) failed: -1
> >   reg-fixed-voltage regulator-wcn-core-vm-1p35: error -EPERM: can't get GPIO
> >
> > The first consumer takes the usecnt == 1 branch and really does set the
> > underlying line to output.  Later consumers instead read the direction
> > back with gpiod_get_direction() and refuse with -EPERM if it reports
> > input.  pmic_gpio_get_direction() derives the direction from the pad's
> > input buffer (pad->input_enabled), which pmic_gpio_direction_output()
> > never clears, so a pad whose input buffer is enabled at power-up reports
> > input forever and the proxy rejects every consumer after the first.
> >
> > The readback is not needed: the proxy is the only entity configuring the
> > line, so it already knows which direction it asked for.  Record that in
> > struct gpio_shared_desc and compare against the recorded value.  Keep a
> > readback in the get_direction() callback for the case where no proxy has
> > configured the line yet, and reset the recorded direction once the last
> > user goes away so that the next requester establishes it again.
> >
> > Assisted-by: LLM
> > Fixes: e992d54c6f97 ("gpio: shared-proxy: implement the shared GPIO proxy driver")
> > Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
> > ---
> 
> I think sashiko is correct about the GPIOD_ASIS use-case.

I didn't receive any comments from sashiko. Could you point me to it?

Shawn

> I think this is why
> I used an unconditional read-back in the first place actually.

  reply	other threads:[~2026-09-18 14:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  1:44 [PATCH 0/2] Fix sharing a PMIC GPIO between multiple consumers Shawn Guo
2026-09-15  1:44 ` [PATCH 1/2] gpio: shared-proxy: track direction instead of reading it back Shawn Guo
2026-09-16  8:48   ` Bartosz Golaszewski
2026-09-16  9:00   ` Bartosz Golaszewski
2026-09-18 14:43     ` Shawn Guo [this message]
2026-09-15  1:44 ` [PATCH 2/2] pinctrl: qcom: spmi-gpio: make direction changes exclusive Shawn Guo
2026-09-15 13:11   ` Neil Armstrong
2026-09-18  1:11     ` Shawn Guo
2026-09-18  8:05       ` Bartosz Golaszewski
2026-09-16  8:49 ` [PATCH 0/2] Fix sharing a PMIC GPIO between multiple consumers 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=aq1OLkLiIL58V8aK@QCOM-aGQu4IUr3Y \
    --to=shengchao.guo@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yu.zhang@oss.qualcomm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®