linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@denx.de>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Pavel Machek <pavel@denx.de>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] gpio: max77620: Fixup debounce delays
Date: Fri, 8 Nov 2019 21:54:07 +0100	[thread overview]
Message-ID: <20191108205407.GE23750@amd> (raw)
In-Reply-To: <20191108160747.3274377-1-thierry.reding@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1934 bytes --]

On Fri 2019-11-08 17:07:46, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> When converting milliseconds to microseconds in commit fffa6af94894
> ("gpio: max77620: Use correct unit for debounce times") some ~1 ms gaps
> were introduced between the various ranges supported by the controller.
> Fix this by changing the start of each range to the value immediately
> following the end of the previous range. This way a debounce time of,
> say 8250 us will translate into 16 ms instead of returning an -EINVAL
> error.
> 
> Typically the debounce delay is only ever set through device tree and
> specified in milliseconds, so we can never really hit this issue because
> debounce times are always a multiple of 1000 us.
> 
> The only notable exception for this is drivers/mmc/host/mmc-spi.c where
> the CD GPIO is requested, which passes a 1 us debounce time. According
> to a comment preceeding that code this should actually be 1 ms (i.e.
> 1000 us).
> 
> Reported-by: Pavel Machek <pavel@denx.de>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Thanks for doing this!

Acked-by: Pavel Machek <pavel@denx.de>

And I guess this should be cc: stable, as the commit this fixes was
making its way there.

Best regards,
								Pavel


> @@ -198,13 +198,13 @@ static int max77620_gpio_set_debounce(struct max77620_gpio *mgpio,
>  	case 0:
>  		val = MAX77620_CNFG_GPIO_DBNC_None;
>  		break;
> -	case 1000 ... 8000:
> +	case 1 ... 8000:
>  		val = MAX77620_CNFG_GPIO_DBNC_8ms;
>  		break;
> -	case 9000 ... 16000:
> +	case 8001 ... 16000:
>  		val = MAX77620_CNFG_GPIO_DBNC_16ms;
>  		break;
> -	case 17000 ... 32000:
> +	case 16001 ... 32000:
>  		val = MAX77620_CNFG_GPIO_DBNC_32ms;
>  		break;
>  	default:

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  parent reply	other threads:[~2019-11-08 20:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 16:07 [PATCH 1/2] gpio: max77620: Fixup debounce delays Thierry Reding
2019-11-08 16:07 ` [PATCH 2/2] gpio: bd70528: Use correct unit for debounce times Thierry Reding
2019-11-12 10:20   ` Bartosz Golaszewski
2019-11-08 20:54 ` Pavel Machek [this message]
2019-11-12 10:16   ` [PATCH 1/2] gpio: max77620: Fixup debounce delays Bartosz Golaszewski

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=20191108205407.GE23750@amd \
    --to=pavel@denx.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).