Skip to contentSkip to conversation

mmc: mmc_spi: Use proper debounce time for CD GPIO

PATCH In review Thierry Reding 4 participants 4 messages Nov 8, 2019 – Nov 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: mmc_spi: Use proper debounce time for CD GPIO

From: Thierry Reding <[email protected]>

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.

---
 drivers/mmc/host/mmc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mmc_spi.c +1 -1
index 66e354d51ee9..74c6cfbf9172 100644
@@ -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) {
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Thierry Reding

From: Thierry Reding <[email protected]>

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.

Quoted 7 lines

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.

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Reviewed-by on v1 1/1
#2 lore raw
In reply to Thierry Reding
Quoted 7 lines · Thierry Reding

From: Thierry Reding <[email protected]>

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.

Quoted 7 lines

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.

Makes perfect sense.

Yours,
Linus Walleij

#3 lore raw
In reply to Thierry Reding
Quoted 8 lines · Thierry Reding

From: Thierry Reding <[email protected]>

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.

Quoted 7 lines

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.

Applied for next, thanks!

Kind regards
Uffe

Quoted 20 lines
---
 drivers/mmc/host/mmc_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mmc_spi.c +1 -2
index 66e354d51ee9..74c6cfbf9172 100644
@@ -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