Message ID | 20201111222008.39993-8-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers | show |
Series | gpiolib: acpi: pin configuration fixes | expand |
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@linux.intel.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > --- > 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);
On Thu, Nov 12, 2020 at 10:17 AM Mika Westerberg <mika.westerberg@linux.intel.com> wrote: > On Thu, Nov 12, 2020 at 12:19:57AM +0200, Andy Shevchenko wrote: ... > > +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int 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); Unfortunately it will be inconsistent with the naming schema. I explained the choice of name in the cover letter. I will elaborate a bit there.
On Thu, Nov 12, 2020 at 12:19:37PM +0200, Andy Shevchenko wrote: > On Thu, Nov 12, 2020 at 10:17 AM Mika Westerberg > <mika.westerberg@linux.intel.com> wrote: > > On Thu, Nov 12, 2020 at 12:19:57AM +0200, Andy Shevchenko wrote: > > ... > > > > +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int 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); > > Unfortunately it will be inconsistent with the naming schema. I > explained the choice of name in the cover letter. I will elaborate a > bit there. OK, It seems that I was not CC'd cover letter of the last two versions, or it got dropped somewhere.
Hi, On 11/12/20 12:06 PM, Mika Westerberg wrote: > On Thu, Nov 12, 2020 at 12:19:37PM +0200, Andy Shevchenko wrote: >> On Thu, Nov 12, 2020 at 10:17 AM Mika Westerberg >> <mika.westerberg@linux.intel.com> wrote: >>> On Thu, Nov 12, 2020 at 12:19:57AM +0200, Andy Shevchenko wrote: >> >> ... >> >>>> +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int 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); >> >> Unfortunately it will be inconsistent with the naming schema. I >> explained the choice of name in the cover letter. I will elaborate a >> bit there. > > OK, It seems that I was not CC'd cover letter of the last two versions, > or it got dropped somewhere. Yes I did not get the cover-letter either, I was actually wondering if there was one... Regards, Hans
On Thu, Nov 12, 2020 at 1:12 PM Hans de Goede <hdegoede@redhat.com> wrote: > On 11/12/20 12:06 PM, Mika Westerberg wrote: > > On Thu, Nov 12, 2020 at 12:19:37PM +0200, Andy Shevchenko wrote: > >> On Thu, Nov 12, 2020 at 10:17 AM Mika Westerberg > >> <mika.westerberg@linux.intel.com> wrote: > >>> On Thu, Nov 12, 2020 at 12:19:57AM +0200, Andy Shevchenko wrote: > >> > >> ... > >> > >>>> +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int 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); > >> > >> Unfortunately it will be inconsistent with the naming schema. I > >> explained the choice of name in the cover letter. I will elaborate a > >> bit there. > > > > OK, It seems that I was not CC'd cover letter of the last two versions, > > or it got dropped somewhere. > > Yes I did not get the cover-letter either, I was actually wondering if there > was one... Oops, I dropped --cc because of your Rb tags (and I have added Cc when there is no tag), but I forgot to add Cc to the cover letter. Here we are [1]. [1]: https://lore.kernel.org/linux-gpio/20201111222008.39993-1-andriy.shevchenko@linux.intel.com/
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); +} + /** * gpiod_direction_input - set the GPIO direction to input * @desc: GPIO to set to input diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 16bc5731673c..9b1a1c782704 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -136,6 +136,7 @@ int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, unsigned long lflags, enum gpiod_flags dflags); +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce); int gpiod_hog(struct gpio_desc *desc, const char *name, unsigned long lflags, enum gpiod_flags dflags);