[PATCH v6 6/8] gpio: regmap: Add set_config callback
From: Yu-Chun Lin
Date: Tue Jul 21 2026 - 03:00:04 EST
Add a new set_config callback to struct gpio_regmap_config to allow drivers
to implement hardware-specific configuration such as debounce settings,
or other platform-specific GPIO properties.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Signed-off-by: Yu-Chun Lin <eleanor.lin@xxxxxxxxxxx>
---
Changes in v6:
- None.
---
drivers/gpio/gpio-regmap.c | 1 +
include/linux/gpio/regmap.h | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index aecc35f610dd..b856326ff01c 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -454,6 +454,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
gpio->reg_mask_xlate = gpio_regmap_simple_xlate;
gpio->value_xlate = config->value_xlate;
+ chip->set_config = config->set_config;
ret = gpiochip_add_data(chip, gpio);
if (ret < 0)
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);
+
void *drvdata;
};
--
2.43.0