From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Michael Walle <mwalle@kernel.org>
Cc: "Janani Sunil" <janani.sunil@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Olivier Moysan" <olivier.moysan@foss.st.com>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Linus Walleij" <linusw@kernel.org>,
"Bartosz Golaszewski" <brgl@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
linux@analog.com, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org,
jananisunil.dev@gmail.com,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Subject: Re: [PATCH v2 5/7] gpio: regmap: Add runtime PM and read_output_reg_set support
Date: Wed, 12 Aug 2026 10:06:24 +0300 [thread overview]
Message-ID: <anwbcDG6BEciTILK@ashevche-desk.local> (raw)
In-Reply-To: <DKMRF7SNHX5L.263MVTD0EZHD3@kernel.org>
On Wed, Aug 12, 2026 at 08:43:20AM +0200, Michael Walle wrote:
> On Thu Aug 6, 2026 at 5:41 PM CEST, Janani Sunil wrote:
> > The new pm_dev field in gpio_regmap_config allows a driver to supply a
> > device for runtime PM. All operations call pm_runtime_resume_and_get()
> > before accessing the regmap and pm_runtime_put_autosuspend() on return.
> >
> > The new read_output_reg_set flag when set, gpio_regmap_get() checks the
> > pin direction first and reads from reg_set_base instead of reg_dat_base
> > for output pins. Requires both reg_dat_base and reg_set_base to be
> > configured.
>
> As already mentioned. please split it into two patches. Also, could
> you add some context where/why this is used/useful?
>
> So, if the direction is output, then you just read back the set
> value (instead of the actual line state). Is that correct? Why can't
> you read the input buffer in that case? Input buffer deactivated?
> (NB. you can never get the real line state in that case, which is
> sometimes useful for debugging.)
I understand the concern, but this is debugging of HW via SW, which I think is
sometimes not possible (not all HW supports it) nor good for production in case
some glitch happens and one reads back not what was written and hence come to
async state with the actual flow. Yes, SW might use GPIO output buffer as 1-bit
variable (it's another story to discuss if it's reliable / good design, but it
is possible and I have heard of a such usage IRL).
TL;DR: I am on the side to return the output state when direction is output.
Also note, some cases might specifically disable input buffers in GPIO (for
example to save a few dozens of µA per pin).
> Anyway, you should be able to achieve the same with the
> reg_mask_xlate(), no? Check if the pin is in output mode, then
> change the ®.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-12 7:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 15:41 [PATCH v2 0/7] iio: adc: Add AD7768/AD7768-4 ADC driver support Janani Sunil
2026-08-06 15:41 ` [PATCH v2 1/7] dt-bindings: iio: adc: Add AD7768 Janani Sunil
2026-08-12 3:04 ` Rob Herring
2026-08-06 15:41 ` [PATCH v2 2/7] iio: backend: Add support for CRC Janani Sunil
2026-08-06 15:41 ` [PATCH v2 3/7] iio: adc: adi-axi-adc: " Janani Sunil
2026-08-06 15:41 ` [PATCH v2 4/7] iio: adc: Add AD7768 IIO Driver support Janani Sunil
2026-08-07 0:28 ` Andy Shevchenko
2026-08-06 15:41 ` [PATCH v2 5/7] gpio: regmap: Add runtime PM and read_output_reg_set support Janani Sunil
2026-08-06 21:31 ` Linus Walleij
2026-08-07 0:02 ` Andy Shevchenko
2026-08-12 6:43 ` Michael Walle
2026-08-12 7:06 ` Andy Shevchenko [this message]
2026-08-06 15:41 ` [PATCH v2 6/7] gpio: ad7768: Add AD7768 GPIO auxiliary driver Janani Sunil
2026-08-06 15:41 ` [PATCH v2 7/7] Documentation: iio: Add AD7768 Documentation Janani Sunil
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=anwbcDG6BEciTILK@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=brgl@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=janani.sunil@analog.com \
--cc=jananisunil.dev@gmail.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=mwalle@kernel.org \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=u.kleine-koenig@baylibre.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.