]> git.karo-electronics.de Git - karo-tx-linux.git/commit
pwm: pca9685: Fix GPIO-only operation
authorSven Van Asbroeck <thesven73@gmail.com>
Thu, 13 Apr 2017 12:58:11 +0000 (08:58 -0400)
committerThierry Reding <thierry.reding@gmail.com>
Thu, 13 Apr 2017 15:35:01 +0000 (17:35 +0200)
commitc40c461e1944b9cfb520e04184ec1e5c80fb210b
tree3cb325c560e78a27eefe1c4562dbb08ace57c804
parent6db249db5ed9c09e396ed77811853cbd63415f0a
pwm: pca9685: Fix GPIO-only operation

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
or in use.

Fixes: bccec89f0a35 ("Allow any of the 16 PWMs to be used as a GPIO")
Reported-by: Sven Van Asbroeck <TheSven73@googlemail.com>
Signed-off-by: Sven Van Asbroeck <TheSven73@googlemail.com>
Suggested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-pca9685.c