Linux IIO development
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Yu-Chun Lin [林祐君]" <eleanor.lin@realtek.com>,
	"linusw@kernel.org" <linusw@kernel.org>,
	"andriy.shevchenko@intel.com" <andriy.shevchenko@intel.com>,
	"brgl@kernel.org" <brgl@kernel.org>,
	"TY_Chang[張子逸]" <tychang@realtek.com>,
	"wbg@kernel.org" <wbg@kernel.org>,
	"mathieu.dubois-briand@bootlin.com"
	<mathieu.dubois-briand@bootlin.com>,
	"nuno.sa@analog.com" <nuno.sa@analog.com>,
	"Michael.Hennerich@analog.com" <Michael.Hennerich@analog.com>,
	"jic23@kernel.org" <jic23@kernel.org>,
	"andy@kernel.org" <andy@kernel.org>,
	"u.kleine-koenig@baylibre.com" <u.kleine-koenig@baylibre.com>,
	"dakr@kernel.org" <dakr@kernel.org>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"o-takashi@sakamocchi.jp" <o-takashi@sakamocchi.jp>
Cc: "dlechner@baylibre.com" <dlechner@baylibre.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux@analog.com" <linux@analog.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"CY_Huang[黃鉦晏]" <cy.huang@realtek.com>,
	"James Tai [戴志峰]" <james.tai@realtek.com>
Subject: Re: [PATCH v6 6/8] gpio: regmap: Add set_config callback
Date: Tue, 21 Jul 2026 13:18:02 +0200	[thread overview]
Message-ID: <DK47HK67DGGW.37OGI53JJAVUL@kernel.org> (raw)
In-Reply-To: <520080c564ef4a039b67d2a820e7a646@realtek.com>

[-- Attachment #1: Type: text/plain, Size: 2341 bytes --]

On Tue Jul 21, 2026 at 12:46 PM CEST, Yu-Chun Lin [林祐君] wrote:
> Hi Michael,
>
>>On Tue Jul 21, 2026 at 8:58 AM CEST, Yu-Chun Lin wrote:
>
> (...)
>
>>> diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h 
>>> index 45a30f50043f..23460995c1d1 100644
>>> --- a/include/linux/gpio/regmap.h
>>> +++ b/include/linux/gpio/regmap.h
>>> @@ -89,6 +89,9 @@ enum gpio_regmap_operation {
>>>   *			mask before writing. This allows driver-specific logic
>>>   *			to append additional bits (like write-enable masks)
>>>   *			dynamically based on the current operation.
>>> + * @set_config:		(Optional) Callback for setting GPIO configuration such
>>> + *			as debounce, drive strength, or other hardware specific
>>> + *			settings.
>>>   * @drvdata:		(Optional) Pointer to driver specific data which is
>>>   *			not used by gpio-remap but is provided "as is" to the
>>>   *			driver callback(s).
>>> @@ -150,6 +153,8 @@ struct gpio_regmap_config {
>>>  			   unsigned int base, unsigned int offset, unsigned int reg,
>>>  			   unsigned int *mask, unsigned int *val);
>>>  
>>> +	int (*set_config)(struct gpio_chip *gc, unsigned int offset, 
>>> +unsigned long config);
>>> +
>>
>> Do we need an additional struct gpio_regmap pointer as a first argument? How
>> does the driver fetch the attached opaque data pointer? I see that your driver is doing
>>
>> struct rtd1625_gpio *data = gpiochip_get_data(chip)
>>
>> But it is the gpio-regmap core which will attach it's own data pointer to gpio_chip, no?
>>
>> -michael
>
> You are right. I mistakenly used gpiochip_get_data() here.
>
> My current plan to fix this is:
> The set_config callback in 'struct gpio_regmap_config' and 'struct gpio_regmap'
> should take 'struct gpio_regmap *' as the first argument (replacing
> 'struct gpio_chip *'), and the driver should use 'gpio_regmap_get_drvdata()'
> to retrieve its own data pointer.

You also probably need the struct gpio_chip, to maybe call into the
gpio core, no?

If so, what about

int (*set_config)(struct gpio_regmap *gpio, struct gpio_chip *gc,
                  unsigned int offset, unsigned long config)

> I'll add a wrapper in gpio-regmap.c that bridges gpio_chip to gpio_regmap and
> handles the fallback to gpiochip_generic_config().

Yes.

-michael

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]

  reply	other threads:[~2026-07-21 11:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  6:57 [PATCH v6 0/8] gpio: realtek: Add support for Realtek DHC RTD1625 Yu-Chun Lin
2026-07-21  6:57 ` [PATCH v6 1/8] Revert "gpio: realtek: Add driver for Realtek DHC RTD1625 SoC" Yu-Chun Lin
2026-07-21 10:39   ` Andy Shevchenko
2026-07-21  6:57 ` [PATCH v6 2/8] gpio: regmap: Provide default IRQ resource request and release callbacks Yu-Chun Lin
2026-07-21  7:05   ` Michael Walle
2026-07-21  6:57 ` [PATCH v6 3/8] gpio: regmap: Apply default resource callbacks for regmap IRQ chip Yu-Chun Lin
2026-07-21  7:07   ` Michael Walle
2026-07-21  6:57 ` [PATCH v6 4/8] gpio: regmap: Order kernel-doc descriptions with the actual appearance Yu-Chun Lin
2026-07-21  7:07   ` Michael Walle
2026-07-21 10:43   ` Andy Shevchenko
2026-07-21  6:57 ` [PATCH v6 5/8] gpio: regmap: Add gpio_regmap_operation and value_xlate support Yu-Chun Lin
2026-07-21  7:15   ` Michael Walle
2026-07-21 10:34     ` Yu-Chun Lin [林祐君]
2026-07-21 10:46   ` Andy Shevchenko
2026-07-21  6:58 ` [PATCH v6 6/8] gpio: regmap: Add set_config callback Yu-Chun Lin
2026-07-21  7:23   ` Michael Walle
2026-07-21 10:46     ` Yu-Chun Lin [林祐君]
2026-07-21 11:18       ` Michael Walle [this message]
2026-07-21 12:10         ` Yu-Chun Lin [林祐君]
2026-07-21  6:58 ` [PATCH v6 7/8] gpio: regmap: Add IRQ enable/disable helpers Yu-Chun Lin
2026-07-21  7:24   ` Michael Walle
2026-07-21 10:54   ` Andy Shevchenko
2026-07-21  6:58 ` [PATCH v6 8/8] gpio: realtek: Add driver for Realtek DHC RTD1625 SoC Yu-Chun Lin
2026-07-21 11:12   ` Andy Shevchenko
2026-07-21 12:09     ` 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=DK47HK67DGGW.37OGI53JJAVUL@kernel.org \
    --to=mwalle@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=brgl@kernel.org \
    --cc=cy.huang@realtek.com \
    --cc=dakr@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=eleanor.lin@realtek.com \
    --cc=james.tai@realtek.com \
    --cc=jic23@kernel.org \
    --cc=linusw@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=mathieu.dubois-briand@bootlin.com \
    --cc=nuno.sa@analog.com \
    --cc=o-takashi@sakamocchi.jp \
    --cc=tychang@realtek.com \
    --cc=u.kleine-koenig@baylibre.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