1
0
Fork 0

pwm: rockchip: Set polarity unconditionally in .get_state()

Don't rely on *state being zero initialized and PWM_POLARITY_NORMAL
being zero. So always assign .polarity.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
alistair/sunxi64-5.4-dsi
Uwe Kleine-König 2019-09-02 16:39:41 +02:00 committed by Thierry Reding
parent 9e3ca01f7e
commit ba73deb16f
1 changed files with 4 additions and 4 deletions

View File

@ -90,10 +90,10 @@ static void rockchip_pwm_get_state(struct pwm_chip *chip,
state->enabled = ((val & enable_conf) == enable_conf) ?
true : false;
if (pc->data->supports_polarity) {
if (!(val & PWM_DUTY_POSITIVE))
state->polarity = PWM_POLARITY_INVERSED;
}
if (pc->data->supports_polarity && !(val & PWM_DUTY_POSITIVE))
state->polarity = PWM_POLARITY_INVERSED;
else
state->polarity = PWM_POLARITY_NORMAL;
clk_disable(pc->pclk);
}