Skip to content

Commit

Permalink
pwm: pwm-tiecap: Disable APWM mode after configure
Browse files Browse the repository at this point in the history
APWM mode is enabled while configuring PWM device. This was done to
handle shadow & immediate mode update of period and compare registers.
However, leaving it enabled after configuring will cause APWM output on
PWM pin even before enabling PWM device.
Fix the same by disabling APWM mode after configuring if PWM device is
not running.

Signed-off-by: Philip, Avinash <avinashphilip@ti.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
  • Loading branch information
Philip, Avinash authored and Thierry Reding committed Sep 10, 2012
1 parent b817bf5 commit c06fad9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/pwm/pwm-tiecap.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ static int ecap_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
writel(period_cycles, pc->mmio_base + CAP3);
}

if (!test_bit(PWMF_ENABLED, &pwm->flags)) {
reg_val = readw(pc->mmio_base + ECCTL2);
/* Disable APWM mode to put APWM output Low */
reg_val &= ~ECCTL2_APWM_MODE;
writew(reg_val, pc->mmio_base + ECCTL2);
}

pm_runtime_put_sync(pc->chip.dev);
return 0;
}
Expand Down

0 comments on commit c06fad9

Please sign in to comment.