summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Luebbe <jlu@pengutronix.de>2016-12-08 18:04:41 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-01-10 08:27:23 +0100
commit782f63f7928e68ade8c1b6d8dd4407688f864841 (patch)
tree5802ba72175c7fa53745c518218c5114ae23134a
parent34babf2121a3626db21d654d061f62df8d6f35f4 (diff)
downloadbarebox-782f63f7928e68ade8c1b6d8dd4407688f864841.tar.gz
PWM: update enable status when using the internal API
Without these, 'devinfo pwmX' will show enabled=0 even though the PWM was enabled (for example by a pwm-backlight). Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/pwm/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 3605201..ee65619 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -281,6 +281,8 @@ unsigned int pwm_get_duty_cycle(struct pwm_device *pwm)
*/
int pwm_enable(struct pwm_device *pwm)
{
+ pwm->p_enable = 1;
+
if (!test_and_set_bit(FLAG_ENABLED, &pwm->flags))
return pwm->chip->ops->enable(pwm->chip);
@@ -293,6 +295,8 @@ EXPORT_SYMBOL_GPL(pwm_enable);
*/
void pwm_disable(struct pwm_device *pwm)
{
+ pwm->p_enable = 0;
+
if (test_and_clear_bit(FLAG_ENABLED, &pwm->flags))
pwm->chip->ops->disable(pwm->chip);
}