On Thu, Nov 12, 2020 at 12:19:57AM +0200, Andy Shevchenko wrote: > In some cases we would like to have debounce setter which doesn't fail > when a feature is not supported by a controller. > > Cc: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx> > --- > drivers/gpio/gpiolib.c | 7 +++++++ > drivers/gpio/gpiolib.h | 1 + > 2 files changed, 8 insertions(+) > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c > index c4f73597a54d..0d691ec512a4 100644 > --- a/drivers/gpio/gpiolib.c > +++ b/drivers/gpio/gpiolib.c > @@ -2161,6 +2161,13 @@ static int gpio_set_bias(struct gpio_desc *desc) > return gpio_set_config_with_argument_optional(desc, bias, arg); > } > > +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce) > +{ > + return gpio_set_config_with_argument_optional(desc, > + PIN_CONFIG_INPUT_DEBOUNCE, > + debounce); > +} Sorry for commenting this late but I realized we have gpiod_set_debounce() already. At least this new function should follow the naming (gpiod as it takes descriptior): int gpiod_set_debounce_optional(struct gpio_desc *desc, unsigned int debounce);