diff options
author | Uwe Kleine-König <uwe@kleine-koenig.org> | 2019-09-02 10:39:41 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2019-09-20 19:48:54 -0400 |
commit | ba73deb16ff5b2d70b1ffc025c84c1126aad7fea (patch) | |
tree | c83298f1ed7d34d54466414a357a983d978b2412 | |
parent | 9e3ca01f7e58ef4662c18adcb766ee3422ace0fb (diff) |
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>
-rw-r--r-- | drivers/pwm/pwm-rockchip.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c index 51b96cb7dd25..8eb2db59741d 100644 --- a/drivers/pwm/pwm-rockchip.c +++ b/drivers/pwm/pwm-rockchip.c | |||
@@ -90,10 +90,10 @@ static void rockchip_pwm_get_state(struct pwm_chip *chip, | |||
90 | state->enabled = ((val & enable_conf) == enable_conf) ? | 90 | state->enabled = ((val & enable_conf) == enable_conf) ? |
91 | true : false; | 91 | true : false; |
92 | 92 | ||
93 | if (pc->data->supports_polarity) { | 93 | if (pc->data->supports_polarity && !(val & PWM_DUTY_POSITIVE)) |
94 | if (!(val & PWM_DUTY_POSITIVE)) | 94 | state->polarity = PWM_POLARITY_INVERSED; |
95 | state->polarity = PWM_POLARITY_INVERSED; | 95 | else |
96 | } | 96 | state->polarity = PWM_POLARITY_NORMAL; |
97 | 97 | ||
98 | clk_disable(pc->pclk); | 98 | clk_disable(pc->pclk); |
99 | } | 99 | } |