Re: [PATCH v4 1/1] pwm: pca9685: fix gpio-only operation.

From: Thierry Reding
Date: Thu Apr 13 2017 - 11:34:33 EST


On Thu, Apr 13, 2017 at 08:58:11AM -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 letting the runtime_pm framework
> control the SLEEP bit. This will put the chip to SLEEP if
> no pwms/gpios are exported/in use.
>
> Fixes: bccec89f0a35 ("Allow any of the 16 PWMs to be used as a GPIO")
> Reported-by: Sven Van Asbroeck <TheSven73@xxxxxxxxxxxxxx>
> Signed-off-by: Sven Van Asbroeck <TheSven73@xxxxxxxxxxxxxx>
> Suggested-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> Reviewed-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> ---
> drivers/pwm/pwm-pca9685.c | 112 ++++++++++++++++++++++++++++++++--------------
> 1 file changed, 79 insertions(+), 33 deletions(-)

Applied with s/gpio/GPIO/ and s/pwm/PWM/.

Thanks,
Thierry

Attachment: signature.asc
Description: PGP signature