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>
u32 cr;
writel(0, &pwm->ir);
- cr = PWMCR_PRESCALER(prescale) |
+
+ cr = readl(&pwm->cr) & PWMCR_EN;
+ cr |= PWMCR_PRESCALER(prescale) |
PWMCR_DOZEEN | PWMCR_WAITEN |
PWMCR_DBGEN | PWMCR_CLKSRC_IPG_HIGH;
-
writel(cr, &pwm->cr);
/* set duty cycles */
writel(duty_cycles, &pwm->sar);