Skip to content

Commit

Permalink
pwm: bcm-kona: Don't set polarity in probe
Browse files Browse the repository at this point in the history
Omit setting the polarity to normal during probe and instead use the new
pwmchip_add_with_polarity() function to register a PWM chip with inverse
polarity by default for all channels to reflect the hardware default.

Signed-off-by: Arun Ramamurthy <arunrama@broadcom.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Scott Branden <sbranden@broadcom.com>
Signed-off-by: Tim Kryger <tim.kryger@gmail.com>
Signed-off-by: Jonathan Richardson <jonathar@broadcom.com>
[thierry.reding@gmail.com: use pwmchip_add_with_polarity()]
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Arun Ramamurthy authored and Thierry Reding committed Jun 12, 2015
1 parent b6a00fa commit e23db65
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/pwm/pwm-bcm-kona.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,15 @@ static int kona_pwmc_probe(struct platform_device *pdev)
return ret;
}

/* Set smooth mode, push/pull, and normal polarity for all channels */
for (chan = 0; chan < kp->chip.npwm; chan++) {
value |= (1 << PWM_CONTROL_SMOOTH_SHIFT(chan));
/* Set push/pull for all channels */
for (chan = 0; chan < kp->chip.npwm; chan++)
value |= (1 << PWM_CONTROL_TYPE_SHIFT(chan));
value |= (1 << PWM_CONTROL_POLARITY_SHIFT(chan));
}

writel(value, kp->base + PWM_CONTROL_OFFSET);

clk_disable_unprepare(kp->clk);

ret = pwmchip_add(&kp->chip);
ret = pwmchip_add_with_polarity(&kp->chip, PWM_POLARITY_INVERSED);
if (ret < 0)
dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);

Expand Down

0 comments on commit e23db65

Please sign in to comment.