mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-26 07:17:10 +00:00
pwm: imx: Don't drop the enable bit once set
Changing the duty-cycle should not blindly override (and clear) the enable (EN) bit if it has already been set. For instance, a PWM backlight can be enabled and set to a specific intensity using two operations. The order of these operations should not matter. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Fabio Estevam <festevam@gmail.com>
This commit is contained in:
parent
4aea3110ab
commit
5748aa1e37
1 changed files with 3 additions and 2 deletions
|
@ -20,10 +20,11 @@ int pwm_config_internal(struct pwm_regs *pwm, unsigned long period_cycles,
|
||||||
u32 cr;
|
u32 cr;
|
||||||
|
|
||||||
writel(0, &pwm->ir);
|
writel(0, &pwm->ir);
|
||||||
cr = PWMCR_PRESCALER(prescale) |
|
|
||||||
|
cr = readl(&pwm->cr) & PWMCR_EN;
|
||||||
|
cr |= PWMCR_PRESCALER(prescale) |
|
||||||
PWMCR_DOZEEN | PWMCR_WAITEN |
|
PWMCR_DOZEEN | PWMCR_WAITEN |
|
||||||
PWMCR_DBGEN | PWMCR_CLKSRC_IPG_HIGH;
|
PWMCR_DBGEN | PWMCR_CLKSRC_IPG_HIGH;
|
||||||
|
|
||||||
writel(cr, &pwm->cr);
|
writel(cr, &pwm->cr);
|
||||||
/* set duty cycles */
|
/* set duty cycles */
|
||||||
writel(duty_cycles, &pwm->sar);
|
writel(duty_cycles, &pwm->sar);
|
||||||
|
|
Loading…
Add table
Reference in a new issue