All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Yu-Chun Lin" <eleanor.lin@realtek.com>, <linusw@kernel.org>,
	<andriy.shevchenko@intel.com>, <brgl@kernel.org>,
	<tychang@realtek.com>, <wbg@kernel.org>,
	<mathieu.dubois-briand@bootlin.com>, <nuno.sa@analog.com>,
	<Michael.Hennerich@analog.com>, <jic23@kernel.org>,
	<andy@kernel.org>, <u.kleine-koenig@baylibre.com>,
	<dakr@kernel.org>, <bhelgaas@google.com>,
	<o-takashi@sakamocchi.jp>
Cc: <dlechner@baylibre.com>, <linux-kernel@vger.kernel.org>,
	<linux-gpio@vger.kernel.org>, <linux@analog.com>,
	<linux-iio@vger.kernel.org>, <cy.huang@realtek.com>,
	<james.tai@realtek.com>
Subject: Re: [PATCH v7 7/9] gpio: regmap: Add set_config callback
Date: Thu, 23 Jul 2026 09:01:15 +0200	[thread overview]
Message-ID: <DK5RA1LUEMJ1.2UP4SW9DDADHK@kernel.org> (raw)
In-Reply-To: <20260723034237.2501507-8-eleanor.lin@realtek.com>

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

On Thu Jul 23, 2026 at 5:42 AM CEST, Yu-Chun Lin wrote:
> Add a new set_config callback to allow drivers to implement
> hardware-specific configuration such as debounce settings, or other
> platform-specific GPIO properties.
>
> Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
> ---
> Changes in v7:
> - Drop the reviewed by tag from Andy due to the signature changes.
> - Add 'struct gpio_regmap' as the first parameter to the set_config callback.
> - Add wrapper to bridge gpio_chip to gpio_regmap.
> ---
>  drivers/gpio/gpio-regmap.c  | 16 ++++++++++++++++
>  include/linux/gpio/regmap.h |  6 ++++++
>  2 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> index 8f58b272b870..98cfdd890069 100644
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
> @@ -51,6 +51,9 @@ struct gpio_regmap {
>  			   unsigned int reg, unsigned int *mask,
>  			   unsigned int *val);
>  
> +	int (*set_config)(struct gpio_regmap *gpio, struct gpio_chip *chip,
> +			  unsigned int offset, unsigned long config);
> +
>  	void *driver_data;
>  };
>  
> @@ -317,6 +320,15 @@ static int gpio_regmap_direction_output(struct gpio_chip *chip,
>  	return gpio_regmap_set_direction(chip, offset, true);
>  }
>  
> +static int gpio_regmap_set_config(struct gpio_chip *chip,
> +				  unsigned int offset,
> +				  unsigned long cfg)
> +{
> +	struct gpio_regmap *gpio = gpiochip_get_data(chip);
> +
> +	return gpio->set_config(gpio, chip, offset, cfg);
> +}
> +
>  int gpio_regmap_reqres_irq(struct gpio_regmap *gpio, unsigned int offset)
>  {
>  	return gpiochip_reqres_irq(&gpio->gpio_chip, offset);
> @@ -386,6 +398,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
>  	gpio->reg_clr_base = config->reg_clr_base;
>  	gpio->reg_dir_in_base = config->reg_dir_in_base;
>  	gpio->reg_dir_out_base = config->reg_dir_out_base;
> +	gpio->set_config = config->set_config;
>  
>  	chip = &gpio->gpio_chip;
>  	chip->parent = config->parent;
> @@ -455,6 +468,9 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
>  
>  	gpio->value_xlate = config->value_xlate;
>  
> +	if (config->set_config)
> +		chip->set_config = gpio_regmap_set_config;
> +

Please keep both settings together. i.e.

if (config->set_config) {
	gpio->set_config = config->set_config;
	chip->set_config = gpio_regmap_set_config;
}

With that fixed:
Reviewed-by: Michael Walle <mwalle@kernel.org>

-michael

>  	ret = gpiochip_add_data(chip, gpio);
>  	if (ret < 0)
>  		goto err_free_bitmap_output;
> diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
> index b77d6371cd9c..4bf4319ec12e 100644
> --- a/include/linux/gpio/regmap.h
> +++ b/include/linux/gpio/regmap.h
> @@ -93,6 +93,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).
> @@ -154,6 +157,9 @@ struct gpio_regmap_config {
>  			   unsigned int base, unsigned int offset, unsigned int reg,
>  			   unsigned int *mask, unsigned int *val);
>  
> +	int (*set_config)(struct gpio_regmap *gpio, struct gpio_chip *chip,
> +			  unsigned int offset, unsigned long config);
> +
>  	void *drvdata;
>  };
>  


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

  reply	other threads:[~2026-07-23  7:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  3:42 [PATCH v7 0/9] gpio: realtek: Add support for Realtek DHC RTD1625 Yu-Chun Lin
2026-07-23  3:42 ` [PATCH v7 1/9] Revert "gpio: realtek: Add driver for Realtek DHC RTD1625 SoC" Yu-Chun Lin
2026-07-23  3:42 ` [PATCH v7 2/9] gpio: regmap: Provide default IRQ resource request and release callbacks Yu-Chun Lin
2026-07-23  3:42 ` [PATCH v7 3/9] gpio: regmap: Apply default resource callbacks for regmap IRQ chip Yu-Chun Lin
2026-07-23  3:42 ` [PATCH v7 4/9] gpio: regmap: Order kernel-doc descriptions with the actual appearance Yu-Chun Lin
2026-07-23  3:42 ` [PATCH v7 5/9] gpio: regmap: Add gpio_regmap_operation to extend reg_mask_xlate callback Yu-Chun Lin
2026-07-23  6:51   ` Michael Walle
2026-07-23 11:14     ` Yu-Chun Lin [林祐君]
2026-07-23 11:20       ` Michael Walle
2026-07-23  3:42 ` [PATCH v7 6/9] gpio: regmap: Add value_xlate callback Yu-Chun Lin
2026-07-23  6:54   ` Michael Walle
2026-07-23  3:42 ` [PATCH v7 7/9] gpio: regmap: Add set_config callback Yu-Chun Lin
2026-07-23  7:01   ` Michael Walle [this message]
2026-07-23  3:42 ` [PATCH v7 8/9] gpio: regmap: Add IRQ enable/disable helpers Yu-Chun Lin
2026-07-23  3:42 ` [PATCH v7 9/9] gpio: realtek: Add driver for Realtek DHC RTD1625 SoC 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=DK5RA1LUEMJ1.2UP4SW9DDADHK@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 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.