Re: [PATCH 1/1] pwm: pca9685: fix gpio-only operation.
From: Mika Westerberg
Date: Mon Apr 10 2017 - 06:33:40 EST
On Sun, Apr 09, 2017 at 12:11:24PM -0400, Sven Van Asbroeck wrote:
> gpio-only driver operation never clears the SLEEP bit, which can
> cause the gpios to become unusable.
>
> Example:
> 1. user requests first pwm -> driver clears SLEEP bit
> 2. user frees last pwm -> driver sets SLEEP bit
> 3. user requests gpio
> 4. user switches gpio on -> output does not turn on
> because SLEEP bit is set
>
> Prevent this behaviour by keeping the SLEEP bit cleared
> for the lifetime of the driver instance.
>
> Fixes: bccec89f0a35 ("Allow any of the 16 PWMs to be used as a GPIO")
> Signed-off-by: Sven Van Asbroeck <TheSven73@xxxxxxxxxxxxxx>
How about implementing a real runtime PM in the driver? Then when the
device is idle regardless of whether it is GPIO or PWM, the SLEEP bit is
set and cleared accordingly.