All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben.hutchings@mind.be>
To: Grygorii Strashko <grygorii.strashko@ti.com>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Kevin Hilman <khilman@kernel.org>
Cc: linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org
Subject: [PATCH] gpio: omap: Enable software fallback for long debounce periods
Date: Wed, 11 Aug 2021 22:27:52 +0200	[thread overview]
Message-ID: <20210811202751.GB18930@cephalopod> (raw)

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

             reply	other threads:[~2021-08-11 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 20:27 Ben Hutchings [this message]
2021-08-12  7:48 ` [PATCH] gpio: omap: Enable software fallback for long debounce periods Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210811202751.GB18930@cephalopod \
    --to=ben.hutchings@mind.be \
    --cc=grygorii.strashko@ti.com \
    --cc=khilman@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ssantosh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.