diff mbox series

mmc: slot-gpio: Fix debounce time to use miliseconds again

Message ID 20180928122040.2221-1-m.szyprowski@samsung.com (mailing list archive)
State Not Applicable
Headers show
Series mmc: slot-gpio: Fix debounce time to use miliseconds again | expand

Commit Message

Marek Szyprowski Sept. 28, 2018, 12:20 p.m. UTC
The debounce value passed to mmc_gpiod_request_cd() function is in
microseconds, but msecs_to_jiffies() requires the value to be in
miliseconds to properly calculate the delay, so adjust the value stored
in cd_debounce_delay_ms context entry.

Fixes: 1d71926bbd59 ("mmc: core: Fix debounce time to use microseconds")
Fixes: bfd694d5e21c ("mmc: core: Add tunable delay before detecting card
after card is inserted")
Cc: stable@vger.kernel.org # v4.18+
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
This patch fixes eMMC card detection on Exynos5410-based Odroid XU board,
broken since Linux next-20180928.
---
 drivers/mmc/core/slot-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Sept. 28, 2018, 1:03 p.m. UTC | #1
On Fri, Sep 28, 2018 at 2:21 PM Marek Szyprowski
<m.szyprowski@samsung.com> wrote:

> The debounce value passed to mmc_gpiod_request_cd() function is in
> microseconds, but msecs_to_jiffies() requires the value to be in
> miliseconds to properly calculate the delay, so adjust the value stored
> in cd_debounce_delay_ms context entry.
>
> Fixes: 1d71926bbd59 ("mmc: core: Fix debounce time to use microseconds")
> Fixes: bfd694d5e21c ("mmc: core: Add tunable delay before detecting card
> after card is inserted")
> Cc: stable@vger.kernel.org # v4.18+
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

This seems correct, after some reading and scratching my head:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Ulf Hansson Sept. 28, 2018, 3:45 p.m. UTC | #2
On 28 September 2018 at 14:20, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> The debounce value passed to mmc_gpiod_request_cd() function is in
> microseconds, but msecs_to_jiffies() requires the value to be in
> miliseconds to properly calculate the delay, so adjust the value stored
> in cd_debounce_delay_ms context entry.
>
> Fixes: 1d71926bbd59 ("mmc: core: Fix debounce time to use microseconds")
> Fixes: bfd694d5e21c ("mmc: core: Add tunable delay before detecting card
> after card is inserted")
> Cc: stable@vger.kernel.org # v4.18+
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

Applied for fixes!

Kind regards
Uffe

> ---
> This patch fixes eMMC card detection on Exynos5410-based Odroid XU board,
> broken since Linux next-20180928.
> ---
>  drivers/mmc/core/slot-gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
> index 2a833686784b..86803a3a04dc 100644
> --- a/drivers/mmc/core/slot-gpio.c
> +++ b/drivers/mmc/core/slot-gpio.c
> @@ -271,7 +271,7 @@ int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
>         if (debounce) {
>                 ret = gpiod_set_debounce(desc, debounce);
>                 if (ret < 0)
> -                       ctx->cd_debounce_delay_ms = debounce;
> +                       ctx->cd_debounce_delay_ms = debounce / 1000;
>         }
>
>         if (gpio_invert)
> --
> 2.17.1
>
Tony Lindgren Sept. 28, 2018, 4:30 p.m. UTC | #3
* Ulf Hansson <ulf.hansson@linaro.org> [180928 15:50]:
> On 28 September 2018 at 14:20, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
> > The debounce value passed to mmc_gpiod_request_cd() function is in
> > microseconds, but msecs_to_jiffies() requires the value to be in
> > miliseconds to properly calculate the delay, so adjust the value stored
> > in cd_debounce_delay_ms context entry.
> >
> > Fixes: 1d71926bbd59 ("mmc: core: Fix debounce time to use microseconds")
> > Fixes: bfd694d5e21c ("mmc: core: Add tunable delay before detecting card
> > after card is inserted")
> > Cc: stable@vger.kernel.org # v4.18+
> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> 
> Applied for fixes!

Heh thanks for fixing it, looks like I totally missed that part :)

Tony
diff mbox series

Patch

diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
index 2a833686784b..86803a3a04dc 100644
--- a/drivers/mmc/core/slot-gpio.c
+++ b/drivers/mmc/core/slot-gpio.c
@@ -271,7 +271,7 @@  int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
 	if (debounce) {
 		ret = gpiod_set_debounce(desc, debounce);
 		if (ret < 0)
-			ctx->cd_debounce_delay_ms = debounce;
+			ctx->cd_debounce_delay_ms = debounce / 1000;
 	}
 
 	if (gpio_invert)