mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pwm: pwm-tiecap: Disable APWM mode after configure
@ 2012-08-23  6:59 Philip, Avinash
  2012-09-06  6:51 ` Philip, Avinash
  0 siblings, 1 reply; 2+ messages in thread
From: Philip, Avinash @ 2012-08-23  6:59 UTC (permalink / raw)
  To: thierry.reding; +Cc: linux-kernel, nsekhar, gururaja.hebbar, Philip, Avinash

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>
---
:100644 100644 0b66d0f... 4b66889... M	drivers/pwm/pwm-tiecap.c
 drivers/pwm/pwm-tiecap.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/pwm/pwm-tiecap.c b/drivers/pwm/pwm-tiecap.c
index 0b66d0f..4b66889 100644
--- a/drivers/pwm/pwm-tiecap.c
+++ b/drivers/pwm/pwm-tiecap.c
@@ -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;
 }
-- 
1.7.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-06  6:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-23  6:59 [PATCH] pwm: pwm-tiecap: Disable APWM mode after configure Philip, Avinash
2012-09-06  6:51 ` Philip, Avinash

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®