Skip to content

Commit acfd92f

Browse files
Sylvain Lemieuxthierryreding
authored andcommitted
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 08ee77b, 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>
1 parent ef1f09e commit acfd92f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/pwm/pwm-lpc32xx.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct lpc32xx_pwm_chip {
2525
};
2626

2727
#define PWM_ENABLE BIT(31)
28+
#define PWM_PIN_LEVEL BIT(30)
2829

2930
#define to_lpc32xx_pwm_chip(_chip) \
3031
container_of(_chip, struct lpc32xx_pwm_chip, chip)
@@ -103,6 +104,7 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
103104
struct lpc32xx_pwm_chip *lpc32xx;
104105
struct resource *res;
105106
int ret;
107+
u32 val;
106108

107109
lpc32xx = devm_kzalloc(&pdev->dev, sizeof(*lpc32xx), GFP_KERNEL);
108110
if (!lpc32xx)
@@ -128,6 +130,11 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
128130
return ret;
129131
}
130132

133+
/* When PWM is disable, configure the output to the default value */
134+
val = readl(lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2));
135+
val &= ~PWM_PIN_LEVEL;
136+
writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2));
137+
131138
platform_set_drvdata(pdev, lpc32xx);
132139

133140
return 0;

0 commit comments

Comments
 (0)