Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396320

[PATCH 5/7] ARM: OMAP: dmtimer: Do not call PM runtime functions when not needed.

From Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 5/7] ARM: OMAP: dmtimer: Do not call PM runtime functions when not needed.
Date 2016-05-07 17:30 +0200
Message-ID <rwcl4-3SB-13@gated-at.bofh.it> (permalink)
References <rwcl4-3SB-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


once omap_dm_timer_start() is called, which calls omap_dm_timer_enable()
and thus pm_runtime_get_sync(), it doesn't make sense to call PM runtime
functions again before omap_dm_timer_stop is called(). Otherwise PM runtime
functions called in omap_dm_timer_enable/disable lead to long and unneeded
delays.

Fix that by implementing an "enabled" counter, so the PM runtime functions
get called only when really needed.

Without that patch Nokia N900 IR TX driver (ir-rx51) does not function.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
---
 arch/arm/plat-omap/dmtimer.c              | 9 ++++++++-
 arch/arm/plat-omap/include/plat/dmtimer.h | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 7a327bd..f35a78c 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -365,6 +365,9 @@ void omap_dm_timer_enable(struct omap_dm_timer *timer)
 {
 	int c;
 
+	if (timer->enabled++)
+		return;
+
 	pm_runtime_get_sync(&timer->pdev->dev);
 
 	if (!(timer->capability & OMAP_TIMER_ALWON)) {
@@ -383,7 +386,11 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_enable);
 
 void omap_dm_timer_disable(struct omap_dm_timer *timer)
 {
-	pm_runtime_put_sync(&timer->pdev->dev);
+	if (timer->enabled == 1)
+		pm_runtime_put_sync(&timer->pdev->dev);
+
+	if (timer->enabled)
+		timer->enabled--;
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_disable);
 
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index dd79f30..fc984e1 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -114,6 +114,7 @@ struct omap_dm_timer {
 	unsigned long rate;
 	unsigned reserved:1;
 	unsigned posted:1;
+	u32 enabled;
 	struct timer_regs context;
 	int (*get_context_loss_count)(struct device *);
 	int ctx_loss_count;
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] ir-rx51 driver fixes Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-07 17:30 +0200
  [PATCH 3/7] [media] ir-rx51: use PWM framework instead of OMAP dmtimer Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-07 17:30 +0200
  [PATCH 4/7] [media] ir-rx51: add DT support to driver Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-07 17:30 +0200
    Re: [PATCH 4/7] [media] ir-rx51: add DT support to driver Rob Herring <robh@kernel.org> - 2016-05-09 22:10 +0200
      Re: [PATCH 4/7] [media] ir-rx51: add DT support to driver Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-09 23:00 +0200
        Re: [PATCH 4/7] [media] ir-rx51: add DT support to driver Rob Herring <robh@kernel.org> - 2016-05-09 23:10 +0200
          Re: [PATCH 4/7] [media] ir-rx51: add DT support to driver Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-10 00:10 +0200
          Re: [PATCH 4/7] [media] ir-rx51: add DT support to driver Sebastian Reichel <sre@kernel.org> - 2016-05-10 04:20 +0200
            Re: [PATCH 4/7] [media] ir-rx51: add DT support to driver Rob Herring <robh@kernel.org> - 2016-05-11 16:20 +0200
  [PATCH 6/7] [media] ir-rx51: use hrtimer instead of dmtimer Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-07 17:30 +0200
  [PATCH 5/7] ARM: OMAP: dmtimer: Do not call PM runtime functions when not needed. Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-07 17:30 +0200
    Re: [PATCH 5/7] ARM: OMAP: dmtimer: Do not call PM runtime functions  when not needed. Tony Lindgren <tony@atomide.com> - 2016-05-09 21:40 +0200
      Re: [PATCH 5/7] ARM: OMAP: dmtimer: Do not call PM runtime functions  when not needed. Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-09 23:00 +0200
  [PATCH 2/7] pwm: omap-dmtimer: Allow for setting dmtimer clock source Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-07 17:30 +0200
    Re: [PATCH 2/7] pwm: omap-dmtimer: Allow for setting dmtimer clock  source Rob Herring <robh@kernel.org> - 2016-05-09 22:10 +0200
  [PATCH 1/7] ir-rx51: Fix build after multiarch changes broke it Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-07 17:30 +0200
  [PATCH 7/7] ARM: dts: n900: enable lirc-rx51 driver Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-05-07 17:30 +0200

csiph-web