Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Michael Walle <mwalle@kernel.org>
Cc: Yu-Chun Lin <eleanor.lin@realtek.com>,
	Michael.Hennerich@analog.com, afaerber@suse.com, andy@kernel.org,
	brgl@kernel.org, conor+dt@kernel.org, cy.huang@realtek.com,
	devicetree@vger.kernel.org, dlechner@baylibre.com,
	james.tai@realtek.com, jic23@kernel.org, krzk+dt@kernel.org,
	lars@metafoo.de, linus.walleij@linaro.org, linusw@kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-realtek-soc@lists.infradead.org,
	mathieu.dubois-briand@bootlin.com, nuno.sa@analog.com,
	robh@kernel.org, stanley_chang@realtek.com, tychang@realtek.com,
	wbg@kernel.org
Subject: Re: [PATCH v3 3/7] gpio: regmap: Add gpio_regmap_operation and write-enable support
Date: Thu, 16 Jul 2026 20:56:38 +0300	[thread overview]
Message-ID: <alkbVkB5KNNR7ffN@ashevche-desk.local> (raw)
In-Reply-To: <DJZXVOGZ3ZTH.20P8NY7DON0X7@kernel.org>

On Thu, Jul 16, 2026 at 12:55:37PM +0200, Michael Walle wrote:
> On Thu Jul 16, 2026 at 11:40 AM CEST, Andy Shevchenko wrote:
> > On Thu, Jul 16, 2026 at 11:08:55AM +0200, Michael Walle wrote:
> >> On Thu Jul 16, 2026 at 10:27 AM CEST, Andy Shevchenko wrote:
> >> > On Thu, Jul 16, 2026 at 02:26:14PM +0800, Yu-Chun Lin wrote:

...

> >> > From the above list I tend to the approach 2, but this might require to have
> >> > GPIO regmap level of locking. I'm a bit lost in the context, though. I assume
> >> > we need a fresh start, id est issue a v6 with approach 2 or 3 in place and
> >> > summarize the choices in the cover letter, so we can understand what has been
> >> > considered.
> >> 
> >> I don't really like approach 3. You'd need to check if the regs of
> >> both xlate calls are the same. With the sample code above, you
> >> silently drop the first xlate'd reg.
> >
> > If I rank the proposals, the worst is #1, the best is #2.
> >
> >> And honestly, it really seems like a one-off. What controllers, are
> >> there that need a write enable bit. The real problem seems to be
> >> the assumption that we operate on just one bit. IOW we either set
> >> mask or don't set mask in gpio_regmap_set().
> >
> > Yes, we should KISS.
> 
> But IMHO #2 and #3 are not KISS. Approach 2 is just a way of adding
> some kind of pre op to a gpio set. Just tying it to a write enable
> feature. That kinda bothers me. It might also be useful for other
> things, too. So don't tie it to just write enable. And who is doing
> a write disable if it's not self clearing for example. Probably Some
> kind of post op :)
> 
> Approach 3 is a way to change the value of the written value - in
> a restricted way, as is is just doing a OR with both values.
> 
> Also approach 2 might not even work if the hardware requires the
> write enable bit set in the *same* write as the gpio set bit. Thus,
> we might need both anyway in the future.
> 
> >> For a more generic solution, we should be able to control the
> >> written value. We could add another .value_xlate().
> >
> > Maybe not now?
> 
> But if not now, then when? I wouldn't add the write enable feature
> and later a more generic solution which also covers the write enable
> feature.

Taking into account how it's done in HW, I think the whole approach can
be folded to just a boolean flag  (or a simply bit shift) in the config.
Wouldn't it work?

> > As per IPs, Synopsys IPs (not exactly GPIO) likes to
> > have that kind of "protection". So, from HW perspective it's kinda
> > pattern, and it might be possible to see more IPs (including GPIO)
> > that follow it in some cases.

-- 
With Best Regards,
Andy Shevchenko




  reply	other threads:[~2026-07-16 17:56 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  3:33 [PATCH v3 0/7] gpio: realtek: Add support for Realtek DHC RTD1625 Yu-Chun Lin
2026-05-12  3:33 ` [PATCH v3 1/7] gpio: Replace "default y" with "default ARCH_REALTEK" in Kconfig Yu-Chun Lin
2026-05-12  3:33 ` [PATCH v3 2/7] gpio: regmap: add gpio_regmap_get_gpiochip() accessor Yu-Chun Lin
2026-05-12 11:20   ` Andy Shevchenko
2026-05-25 12:04     ` Yu-Chun Lin [林祐君]
2026-06-03  0:34       ` Andy Shevchenko
2026-06-08 14:10         ` Bartosz Golaszewski
2026-06-08 14:41           ` Michael Walle
2026-06-17  8:36             ` Yu-Chun Lin [林祐君]
2026-06-17  8:44               ` Michael Walle
2026-06-17  9:54                 ` Yu-Chun Lin [林祐君]
2026-06-17 11:19                   ` Michael Walle
2026-06-19 21:08             ` Linus Walleij
2026-06-22 10:35               ` Andy Shevchenko
2026-06-30 13:21                 ` Linus Walleij
2026-07-01  8:44               ` Michael Walle
2026-07-01 10:01                 ` Andy Shevchenko
2026-07-01 10:55                   ` Andy Shevchenko
2026-07-01 11:38                     ` Andy Shevchenko
2026-07-01 11:42                       ` Michael Walle
2026-07-01 12:03                         ` Andy Shevchenko
2026-07-01 11:38                     ` Michael Walle
2026-07-01 12:08                       ` Andy Shevchenko
2026-05-12  3:33 ` [PATCH v3 3/7] gpio: regmap: Add gpio_regmap_operation and write-enable support Yu-Chun Lin
2026-05-12 11:26   ` Andy Shevchenko
2026-05-12 14:37   ` Jonathan Cameron
2026-07-09 17:21     ` Yu-Chun Lin [林祐君]
2026-07-16  6:26       ` Yu-Chun Lin
2026-07-16  7:15         ` Michael Walle
2026-07-16  8:27         ` Andy Shevchenko
2026-07-16  9:08           ` Michael Walle
2026-07-16  9:40             ` Andy Shevchenko
2026-07-16 10:47               ` Yu-Chun Lin [林祐君]
2026-07-16 11:03                 ` Michael Walle
2026-07-16 11:21                   ` Yu-Chun Lin [林祐君]
2026-07-16 11:42                     ` Michael Walle
2026-07-16 12:08                       ` Yu-Chun Lin [林祐君]
2026-07-16 10:55               ` Michael Walle
2026-07-16 17:56                 ` Andy Shevchenko [this message]
2026-05-13  7:40   ` Linus Walleij
2026-05-12  3:33 ` [PATCH v3 4/7] gpio: regmap: Add set_config callback Yu-Chun Lin
2026-05-12 18:12   ` Andy Shevchenko
2026-05-12  3:33 ` [PATCH v3 5/7] dt-bindings: gpio: realtek: Add realtek,rtd1625-gpio Yu-Chun Lin
2026-05-12  3:33 ` [PATCH v3 6/7] gpio: realtek: Add driver for Realtek DHC RTD1625 SoC Yu-Chun Lin
2026-05-12 18:50   ` Andy Shevchenko
2026-05-12  3:33 ` [PATCH v3 7/7] arm64: dts: realtek: Add GPIO support for RTD1625 Yu-Chun Lin

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=alkbVkB5KNNR7ffN@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=afaerber@suse.com \
    --cc=andy@kernel.org \
    --cc=brgl@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cy.huang@realtek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=eleanor.lin@realtek.com \
    --cc=james.tai@realtek.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-realtek-soc@lists.infradead.org \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=stanley_chang@realtek.com \
    --cc=tychang@realtek.com \
    --cc=wbg@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