All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: omap: Enable software fallback for long debounce periods
@ 2021-08-11 20:27 Ben Hutchings
  2021-08-12  7:48 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2021-08-11 20:27 UTC (permalink / raw)
  To: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman; +Cc: linux-gpio, linux-omap

omap2_set_gpio_debounce() currently returns -EINVAL if the debounce
period is too long to be handled in hardware.  gpiolib provides a
software fallback, but it is used only if the driver returns
-ENOTSUPP.

* Enable the software fallback by using the expected error code
* Downgrade the log message about this from info to debug, since
  the error is now handled

Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
---
 drivers/gpio/gpio-omap.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index ca23f72165ca..93812480dd0a 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -190,7 +190,7 @@ static int omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned offset,
 	if (enable) {
 		debounce = DIV_ROUND_UP(debounce, 31) - 1;
 		if ((debounce & OMAP4_GPIO_DEBOUNCINGTIME_MASK) != debounce)
-			return -EINVAL;
+			return -ENOTSUPP;
 	}
 
 	l = BIT(offset);
@@ -887,9 +887,9 @@ static int omap_gpio_debounce(struct gpio_chip *chip, unsigned offset,
 	raw_spin_unlock_irqrestore(&bank->lock, flags);
 
 	if (ret)
-		dev_info(chip->parent,
-			 "Could not set line %u debounce to %u microseconds (%d)",
-			 offset, debounce, ret);
+		dev_dbg(chip->parent,
+			"Could not set line %u debounce to %u microseconds (%d)",
+			offset, debounce, ret);
 
 	return ret;
 }
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpio: omap: Enable software fallback for long debounce periods
  2021-08-11 20:27 [PATCH] gpio: omap: Enable software fallback for long debounce periods Ben Hutchings
@ 2021-08-12  7:48 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2021-08-12  7:48 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, linux-gpio,
	linux-omap

* Ben Hutchings <ben.hutchings@mind.be> [210811 20:28]:
> omap2_set_gpio_debounce() currently returns -EINVAL if the debounce
> period is too long to be handled in hardware.  gpiolib provides a
> software fallback, but it is used only if the driver returns
> -ENOTSUPP.
> 
> * Enable the software fallback by using the expected error code
> * Downgrade the log message about this from info to debug, since
>   the error is now handled

Looks good to me:

Reviewed-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-12  7:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 20:27 [PATCH] gpio: omap: Enable software fallback for long debounce periods Ben Hutchings
2021-08-12  7:48 ` Tony Lindgren

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.