[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200228095651.32464-4-lokeshvutla@ti.com>
Date: Fri, 28 Feb 2020 15:26:48 +0530
From: Lokesh Vutla <lokeshvutla@...com>
To: Thierry Reding <thierry.reding@...il.com>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
CC: Tony Lindgren <tony@...mide.com>,
Linux OMAP Mailing List <linux-omap@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-pwm@...r.kernel.org>,
Sekhar Nori <nsekhar@...com>, Vignesh R <vigneshr@...com>,
Lokesh Vutla <lokeshvutla@...com>
Subject: [PATCH v2 3/6] pwm: omap-dmtimer: Fix pwm enabling sequence
To configure DM timer in pwm mode the following needs to be set in
OMAP_TIMER_CTRL_REG using set_pwm callback:
- Set toggle mode on PORTIMERPWM output pin
- Set trigger on overflow and match on PORTIMERPWM output pin.
- Set auto reload
This is a one time configuration and needs to be set before the start of
the dm timer. But the current driver tries to set the same configuration
for every period/duty cycle update, which is not needed. So move the pwm
setup before enabling timer and do not update it in pwm_omap_dmtimer_config.
Signed-off-by: Lokesh Vutla <lokeshvutla@...com>
---
drivers/pwm/pwm-omap-dmtimer.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
index a24a630ccdb9..bc338619232d 100644
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -77,6 +77,11 @@ static int pwm_omap_dmtimer_enable(struct pwm_chip *chip,
struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip);
mutex_lock(&omap->mutex);
+ omap->pdata->set_pwm(omap->dm_timer,
+ pwm_get_polarity(pwm) == PWM_POLARITY_INVERSED,
+ true, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE,
+ true);
+
pwm_omap_dmtimer_start(omap);
mutex_unlock(&omap->mutex);
@@ -193,11 +198,6 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
dev_dbg(chip->dev, "load value: %#08x (%d), match value: %#08x (%d)\n",
load_value, load_value, match_value, match_value);
- omap->pdata->set_pwm(omap->dm_timer,
- pwm_get_polarity(pwm) == PWM_POLARITY_INVERSED,
- true, OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE,
- true);
-
/* If config was called while timer was running it must be reenabled. */
if (timer_active)
pwm_omap_dmtimer_start(omap);
--
2.23.0
Powered by blists - more mailing lists