diff options
| author | Yu-Chun Lin <eleanor.lin@realtek.com> | 2026-07-26 20:51:58 +0800 |
|---|---|---|
| committer | Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> | 2026-07-30 11:05:07 +0200 |
| commit | ab91ecbc322424916efea4c4e6220e2046a80e8a (patch) | |
| tree | c775aa0c5f4ccdd354d08e7aca326e0febe65ce1 /drivers/gpio | |
| parent | 5f28e3dbd23199c778f5339c0d4488820435f6d5 (diff) | |
gpio: regmap: Add set_config callback
Add a new set_config callback to allow drivers to implement
hardware-specific configuration such as debounce settings, or other
platform-specific GPIO properties.
Reviewed-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
Link: https://patch.msgid.link/20260726125209.140307-8-eleanor.lin@realtek.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Diffstat (limited to 'drivers/gpio')
| -rw-r--r-- | drivers/gpio/gpio-regmap.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c index cff7db8036f7..19e33e361cc4 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; }; @@ -306,6 +309,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); @@ -444,6 +456,11 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config gpio->value_xlate = config->value_xlate; + if (config->set_config) { + gpio->set_config = config->set_config; + chip->set_config = gpio_regmap_set_config; + } + ret = gpiochip_add_data(chip, gpio); if (ret < 0) goto err_free_bitmap_output; |
