diff options
author | Liu Ying <b17645@freescale.com> | 2010-10-25 17:31:56 +0800 |
---|---|---|
committer | Justin Waters <justin.waters@timesys.com> | 2010-12-13 16:10:37 -0500 |
commit | 401d43a3b10ae0ee8567fe7f957ed3cf021da162 (patch) | |
tree | 3c1c821cec47c15a2918b65bda8c37e3e398f8e3 /arch | |
parent | 1e18ff36177fe3dbbe70420795cbf7be11143599 (diff) |
ENGR00132935-3 MXC PWM:Use gpio when inverted pwm keeps low
This patch uses gpio to set pwm signal to keep low when
the control signal is inverted, i.e., the pwm control
signal may be inverted by a MOSFET chip.
Signed-off-by: Liu Ying <b17645@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/plat-mxc/pwm.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c index 088b57e2f76e..17f36c10c5c3 100644 --- a/arch/arm/plat-mxc/pwm.c +++ b/arch/arm/plat-mxc/pwm.c @@ -58,6 +58,8 @@ struct pwm_device { unsigned int use_count; unsigned int pwm_id; int pwmo_invert; + void (*enable_pwm_pad)(void); + void (*disable_pwm_pad)(void); }; int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) @@ -142,12 +144,19 @@ int pwm_enable(struct pwm_device *pwm) reg = readl(pwm->mmio_base + MX3_PWMCR); reg |= MX3_PWMCR_EN; writel(reg, pwm->mmio_base + MX3_PWMCR); + + if (pwm->enable_pwm_pad) + pwm->enable_pwm_pad(); + return rc; } EXPORT_SYMBOL(pwm_enable); void pwm_disable(struct pwm_device *pwm) { + if (pwm->disable_pwm_pad) + pwm->disable_pwm_pad(); + writel(0, pwm->mmio_base + MX3_PWMCR); if (pwm->clk_enabled) { @@ -227,8 +236,11 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) pwm->use_count = 0; pwm->pwm_id = pdev->id; pwm->pdev = pdev; - if (plat_data != NULL) + if (plat_data != NULL) { pwm->pwmo_invert = plat_data->pwmo_invert; + pwm->enable_pwm_pad = plat_data->enable_pwm_pad; + pwm->disable_pwm_pad = plat_data->disable_pwm_pad; + } r = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (r == NULL) { |