Skip to content

Commit b235f8a

Browse files
sverdlinthierryreding
authored andcommitted
pwm: ep93xx: Prepare clock before using it
Use clk_prepare_enable()/clk_disable_unprepare() in preparation for switch to Common Clock Framework. Signed-off-by: Alexander Sverdlin <[email protected]> Reviewed-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 72cce47 commit b235f8a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/pwm/pwm-ep93xx.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
6868
if (state->polarity != pwm->state.polarity) {
6969
if (enabled) {
7070
writew(0x0, ep93xx_pwm->base + EP93XX_PWMx_ENABLE);
71-
clk_disable(ep93xx_pwm->clk);
71+
clk_disable_unprepare(ep93xx_pwm->clk);
7272
enabled = false;
7373
}
7474

7575
/*
7676
* The clock needs to be enabled to access the PWM registers.
7777
* Polarity can only be changed when the PWM is disabled.
7878
*/
79-
ret = clk_enable(ep93xx_pwm->clk);
79+
ret = clk_prepare_enable(ep93xx_pwm->clk);
8080
if (ret)
8181
return ret;
8282

@@ -85,13 +85,13 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
8585
else
8686
writew(0x0, ep93xx_pwm->base + EP93XX_PWMx_INVERT);
8787

88-
clk_disable(ep93xx_pwm->clk);
88+
clk_disable_unprepare(ep93xx_pwm->clk);
8989
}
9090

9191
if (!state->enabled) {
9292
if (enabled) {
9393
writew(0x0, ep93xx_pwm->base + EP93XX_PWMx_ENABLE);
94-
clk_disable(ep93xx_pwm->clk);
94+
clk_disable_unprepare(ep93xx_pwm->clk);
9595
}
9696

9797
return 0;
@@ -111,7 +111,7 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
111111
* Configuration can be changed at any time.
112112
*/
113113
if (!pwm_is_enabled(pwm)) {
114-
ret = clk_enable(ep93xx_pwm->clk);
114+
ret = clk_prepare_enable(ep93xx_pwm->clk);
115115
if (ret)
116116
return ret;
117117
}
@@ -142,14 +142,14 @@ static int ep93xx_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
142142
}
143143

144144
if (!pwm_is_enabled(pwm))
145-
clk_disable(ep93xx_pwm->clk);
145+
clk_disable_unprepare(ep93xx_pwm->clk);
146146

147147
if (ret)
148148
return ret;
149149
}
150150

151151
if (!enabled) {
152-
ret = clk_enable(ep93xx_pwm->clk);
152+
ret = clk_prepare_enable(ep93xx_pwm->clk);
153153
if (ret)
154154
return ret;
155155

0 commit comments

Comments
 (0)