Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pwm: lpc32xx: Set PWM_PIN_LEVEL bit to default value

The PWM_PIN_LEVEL bit is leave unset by the kernel PWM driver.

Prior to commit 08ee77b5a5de27ad63c92262ebcb4efe0da93b58,
the PWM_PIN_LEVEL bit was always clear when the PWM was disable
and a 0 logic level was apply to the output.

According to the LPC32x0 User Manual [1],
the default value for bit 30 (PWM_PIN_LEVEL) is 0.

This change initialize the pin level to 0 (default value) and
update the register value accordingly.

[1] http://www.nxp.com/documents/user_manual/UM10326.pdf

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Sylvain Lemieux and committed by
Thierry Reding
acfd92fd ef1f09ec

+7
+7
drivers/pwm/pwm-lpc32xx.c
··· 25 25 }; 26 26 27 27 #define PWM_ENABLE BIT(31) 28 + #define PWM_PIN_LEVEL BIT(30) 28 29 29 30 #define to_lpc32xx_pwm_chip(_chip) \ 30 31 container_of(_chip, struct lpc32xx_pwm_chip, chip) ··· 104 103 struct lpc32xx_pwm_chip *lpc32xx; 105 104 struct resource *res; 106 105 int ret; 106 + u32 val; 107 107 108 108 lpc32xx = devm_kzalloc(&pdev->dev, sizeof(*lpc32xx), GFP_KERNEL); 109 109 if (!lpc32xx) ··· 129 127 dev_err(&pdev->dev, "failed to add PWM chip, error %d\n", ret); 130 128 return ret; 131 129 } 130 + 131 + /* When PWM is disable, configure the output to the default value */ 132 + val = readl(lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); 133 + val &= ~PWM_PIN_LEVEL; 134 + writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); 132 135 133 136 platform_set_drvdata(pdev, lpc32xx); 134 137