Skip to content

Commit 867beb6

Browse files
lokeshvutlathierryreding
authored andcommitted
pwm: omap-dmtimer: Fix PWM enabling sequence
To configure DM timer in PWM mode the following needs to be set in OMAP_TIMER_CTRL_REG using set_pwm callback: - Set toggle mode on PORTIMERPWM output pin - Set trigger on overflow and match on PORTIMERPWM output pin. - Set auto reload This is a one time configuration and needs to be set before the start of the DM timer. But the current driver tries to set the same configuration for every period/duty cycle update, which is not needed. So move the PWM setup before enabling timer and do not update it in pwm_omap_dmtimer_config(). Tested-by: Tony Lindgren <[email protected]> Signed-off-by: Lokesh Vutla <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 348fb6f commit 867beb6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/pwm/pwm-omap-dmtimer.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ static int pwm_omap_dmtimer_enable(struct pwm_chip *chip,
8181
struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
8282

8383
mutex_lock(&omap->mutex);
84+
omap->pdata->set_pwm(omap->dm_timer,
85+
pwm_get_polarity(pwm) == PWM_POLARITY_INVERSED,
86+
true, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE,
87+
true);
88+
8489
pwm_omap_dmtimer_start(omap);
8590
mutex_unlock(&omap->mutex);
8691

@@ -197,11 +202,6 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
197202
dev_dbg(chip->dev, "load value: %#08x (%d), match value: %#08x (%d)\n",
198203
load_value, load_value, match_value, match_value);
199204

200-
omap->pdata->set_pwm(omap->dm_timer,
201-
pwm_get_polarity(pwm) == PWM_POLARITY_INVERSED,
202-
true, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE,
203-
true);
204-
205205
/* If config was called while timer was running it must be reenabled. */
206206
if (timer_active)
207207
pwm_omap_dmtimer_start(omap);

0 commit comments

Comments
 (0)