All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: Tony Lindgren <tony@atomide.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <narmstrong@baylibre.com>,
	Sekhar Nori <nsekhar@ti.com>, Tero Kristo <t-kristo@ti.com>,
	Lokesh Vutla <lokeshvutla@ti.com>
Subject: [PATCH 1/2] clocksource: timer-ti-dm: Do not restore context on every timer enable
Date: Mon, 24 Feb 2020 10:37:52 +0530	[thread overview]
Message-ID: <20200224050753.17784-2-lokeshvutla@ti.com> (raw)
In-Reply-To: <20200224050753.17784-1-lokeshvutla@ti.com>

omap_dm_timer_enable() restores the entire context(including counter)
based on 2 conditions:
- If get_context_loss_count is populated and context is lost.
- If get_context_loss_count is not populated update unconditionally.

Case2 has a side effect of updating the counter register even though
context is not lost. When timer is configured in pwm mode, this is
causing undesired behaviour in the pwm period. So restore context only
if get_context_loss_count is populated and context is actually lost.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/clocksource/timer-ti-dm.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index 269a994d6a99..40742715ed21 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -229,15 +229,12 @@ static void omap_dm_timer_enable(struct omap_dm_timer *timer)
 
 	pm_runtime_get_sync(&timer->pdev->dev);
 
-	if (!(timer->capability & OMAP_TIMER_ALWON)) {
-		if (timer->get_context_loss_count) {
-			c = timer->get_context_loss_count(&timer->pdev->dev);
-			if (c != timer->ctx_loss_count) {
-				omap_timer_restore_context(timer);
-				timer->ctx_loss_count = c;
-			}
-		} else {
+	if (!(timer->capability & OMAP_TIMER_ALWON) &&
+	    timer->get_context_loss_count) {
+		c = timer->get_context_loss_count(&timer->pdev->dev);
+		if (c != timer->ctx_loss_count) {
 			omap_timer_restore_context(timer);
+			timer->ctx_loss_count = c;
 		}
 	}
 }
-- 
2.23.0


  reply	other threads:[~2020-02-24  5:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24  5:07 [PATCH 0/2] clocksource: timer-ti-dm: Misc fixes for omap dm timer Lokesh Vutla
2020-02-24  5:07 ` Lokesh Vutla [this message]
2020-02-26 17:09   ` [PATCH 1/2] clocksource: timer-ti-dm: Do not restore context on every timer enable Tony Lindgren
2020-02-24  5:07 ` [PATCH 2/2] clocksource: timer-ti-dm: Do not update counter on updating the period Lokesh Vutla
2020-02-26 17:29   ` Tony Lindgren
2020-03-19  8:47   ` [tip: timers/core] clocksource/drivers/timer-ti-dm: " tip-bot2 for Lokesh Vutla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200224050753.17784-2-lokeshvutla@ti.com \
    --to=lokeshvutla@ti.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=nsekhar@ti.com \
    --cc=t-kristo@ti.com \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.