]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
pwm: sun4i: Remove erroneous else branch
authorThierry Reding <thierry.reding@gmail.com>
Wed, 16 Dec 2020 17:33:55 +0000 (18:33 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Thu, 17 Dec 2020 13:23:49 +0000 (14:23 +0100)
Commit d3817a647059 ("pwm: sun4i: Remove redundant needs_delay") changed
the logic of an else branch so that the PWM_EN and PWM_CLK_GATING bits
are now cleared if the PWM is to be disabled, whereas previously the
condition was always false, and hence the branch never got executed.

This code is reported causing backlight issues on boards based on the
Allwinner A20 SoC. Fix this by removing the else branch, which restores
the behaviour prior to the offending commit.

Note that the PWM_EN and PWM_CLK_GATING bits still get cleared later in
sun4i_pwm_apply() if the PWM is to be disabled.

Fixes: d3817a647059 ("pwm: sun4i: Remove redundant needs_delay")
Reported-by: Taras Galchenko <tpgalchenko@gmail.com>
Suggested-by: Taras Galchenko <tpgalchenko@gmail.com>
Tested-by: Taras Galchenko <tpgalchenko@gmail.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-sun4i.c

index cc1eb0818648eb5c251dd013e43580e16cc8127b..ce5c4fc8da6f04287296a1b633132cceaac9906e 100644 (file)
@@ -294,12 +294,8 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 
        ctrl |= BIT_CH(PWM_CLK_GATING, pwm->hwpwm);
 
-       if (state->enabled) {
+       if (state->enabled)
                ctrl |= BIT_CH(PWM_EN, pwm->hwpwm);
-       } else {
-               ctrl &= ~BIT_CH(PWM_EN, pwm->hwpwm);
-               ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm);
-       }
 
        sun4i_pwm_writel(sun4i_pwm, ctrl, PWM_CTRL_REG);