mmc: mmc_spi: Use proper debounce time for CD GPIO
authorThierry Reding <treding@nvidia.com>
Fri, 8 Nov 2019 16:09:00 +0000 (17:09 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 14 Nov 2019 15:28:56 +0000 (16:28 +0100)
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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/mmc_spi.c

index 66e354d51ee902b40bdd9de588094cc5d0675fcd..74c6cfbf91720da87a6ef745dc19f32871174f25 100644 (file)
@@ -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) {