Re: [PATCH] applesmc: Bump max wait and rearrange udelay

From: Parag Warudkar
Date: Mon Sep 17 2012 - 14:54:26 EST




On Mon, 17 Sep 2012, Henrik Rydberg wrote:

> So the question is, does this patch work equally well for you?
>
>
> diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
> index 2827088..8bf9011 100644
> --- a/drivers/hwmon/applesmc.c
> +++ b/drivers/hwmon/applesmc.c
> @@ -56,7 +56,7 @@
> /* wait up to 32 ms for a status change. */
> #define APPLESMC_MIN_WAIT 0x0010
> #define APPLESMC_RETRY_WAIT 0x0100
> -#define APPLESMC_MAX_WAIT 0x8000
> +#define APPLESMC_MAX_WAIT 0x10000
>
> #define APPLESMC_READ_CMD 0x10
> #define APPLESMC_WRITE_CMD 0x11
>

That was something that I tried originally and it still resulted in
failures - albeit lesser in number.

I had to bump it to 0x20000 (effective wait of 65536) with the original
loop termination logic and udelay() in order to get it to reduce to
zero.

Note that with usleep_range - each sleep is potentially more than the
minimum - that's may be why 32ms works with usleep_range but not with
udelay which is precise.

So bottomline, I suspect we will need to bump to 0x20000 if you want to
keep the current loop termination and udelay().

Parag
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/