Linux-mmc Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] mmc: mmc_spi: Use proper debounce time for CD GPIO
@ 2019-11-08 16:09 Thierry Reding
  2019-11-08 20:53 ` Pavel Machek
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thierry Reding @ 2019-11-08 16:09 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: Linus Walleij, Pavel Machek, linux-mmc, linux-kernel

From: Thierry Reding <treding@nvidia.com>

According to the comment, board files used to specify 1 ms for the
debounce time. gpiod_set_debounce() needs the debounce time to be
specified in units of microseconds, so make sure to multiply the value
by 1000.

Note that, according to the git log, the board files actually did
specify 1 us for bounce times, but that seems really low. Device tree
bindings for this type of GPIO typically specify the debounce times in
milliseconds, so setting this default value to 1 ms seems like it would
be somewhat safer.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/mmc/host/mmc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 66e354d51ee9..74c6cfbf9172 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1421,7 +1421,7 @@ static int mmc_spi_probe(struct spi_device *spi)
 	 * Index 0 is card detect
 	 * Old boardfiles were specifying 1 ms as debounce
 	 */
-	status = mmc_gpiod_request_cd(mmc, NULL, 0, false, 1, NULL);
+	status = mmc_gpiod_request_cd(mmc, NULL, 0, false, 1000, NULL);
 	if (status == -EPROBE_DEFER)
 		goto fail_add_host;
 	if (!status) {
-- 
2.23.0

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

* Re: [PATCH] mmc: mmc_spi: Use proper debounce time for CD GPIO
  2019-11-08 16:09 [PATCH] mmc: mmc_spi: Use proper debounce time for CD GPIO Thierry Reding
@ 2019-11-08 20:53 ` Pavel Machek
  2019-11-13 14:28 ` Linus Walleij
  2019-11-14 12:53 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2019-11-08 20:53 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Ulf Hansson, Linus Walleij, Pavel Machek, linux-mmc, linux-kernel

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

On Fri 2019-11-08 17:09:00, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> According to the comment, board files used to specify 1 ms for the
> debounce time. gpiod_set_debounce() needs the debounce time to be
> specified in units of microseconds, so make sure to multiply the value
> by 1000.
> 
> Note that, according to the git log, the board files actually did
> specify 1 us for bounce times, but that seems really low. Device tree
> bindings for this type of GPIO typically specify the debounce times in
> milliseconds, so setting this default value to 1 ms seems like it would
> be somewhat safer.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>

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

-- 
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 --]

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

* Re: [PATCH] mmc: mmc_spi: Use proper debounce time for CD GPIO
  2019-11-08 16:09 [PATCH] mmc: mmc_spi: Use proper debounce time for CD GPIO Thierry Reding
  2019-11-08 20:53 ` Pavel Machek
@ 2019-11-13 14:28 ` Linus Walleij
  2019-11-14 12:53 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2019-11-13 14:28 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Ulf Hansson, Pavel Machek, linux-mmc, linux-kernel

On Fri, Nov 8, 2019 at 5:09 PM Thierry Reding <thierry.reding@gmail.com> wrote:

> From: Thierry Reding <treding@nvidia.com>
>
> According to the comment, board files used to specify 1 ms for the
> debounce time. gpiod_set_debounce() needs the debounce time to be
> specified in units of microseconds, so make sure to multiply the value
> by 1000.
>
> Note that, according to the git log, the board files actually did
> specify 1 us for bounce times, but that seems really low. Device tree
> bindings for this type of GPIO typically specify the debounce times in
> milliseconds, so setting this default value to 1 ms seems like it would
> be somewhat safer.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Makes perfect sense.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH] mmc: mmc_spi: Use proper debounce time for CD GPIO
  2019-11-08 16:09 [PATCH] mmc: mmc_spi: Use proper debounce time for CD GPIO Thierry Reding
  2019-11-08 20:53 ` Pavel Machek
  2019-11-13 14:28 ` Linus Walleij
@ 2019-11-14 12:53 ` Ulf Hansson
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2019-11-14 12:53 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Linus Walleij, Pavel Machek, linux-mmc, Linux Kernel Mailing List

On Fri, 8 Nov 2019 at 17:09, Thierry Reding <thierry.reding@gmail.com> wrote:
>
> From: Thierry Reding <treding@nvidia.com>
>
> According to the comment, board files used to specify 1 ms for the
> debounce time. gpiod_set_debounce() needs the debounce time to be
> specified in units of microseconds, so make sure to multiply the value
> by 1000.
>
> Note that, according to the git log, the board files actually did
> specify 1 us for bounce times, but that seems really low. Device tree
> bindings for this type of GPIO typically specify the debounce times in
> milliseconds, so setting this default value to 1 ms seems like it would
> be somewhat safer.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Applied for next, thanks!

Kind regards
Uffe



> ---
>  drivers/mmc/host/mmc_spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
> index 66e354d51ee9..74c6cfbf9172 100644
> --- a/drivers/mmc/host/mmc_spi.c
> +++ b/drivers/mmc/host/mmc_spi.c
> @@ -1421,7 +1421,7 @@ static int mmc_spi_probe(struct spi_device *spi)
>          * Index 0 is card detect
>          * Old boardfiles were specifying 1 ms as debounce
>          */
> -       status = mmc_gpiod_request_cd(mmc, NULL, 0, false, 1, NULL);
> +       status = mmc_gpiod_request_cd(mmc, NULL, 0, false, 1000, NULL);
>         if (status == -EPROBE_DEFER)
>                 goto fail_add_host;
>         if (!status) {
> --
> 2.23.0
>

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08 16:09 [PATCH] mmc: mmc_spi: Use proper debounce time for CD GPIO Thierry Reding
2019-11-08 20:53 ` Pavel Machek
2019-11-13 14:28 ` Linus Walleij
2019-11-14 12:53 ` Ulf Hansson

Linux-mmc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mmc/0 linux-mmc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mmc linux-mmc/ https://lore.kernel.org/linux-mmc \
		linux-mmc@vger.kernel.org
	public-inbox-index linux-mmc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mmc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git