linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: linux-omap@vger.kernel.org
Cc: p-titiano@ti.com
Subject: [PATCH/RFC 4/4] OMAP2: PM debug: move wakeup timer into clockevent code
Date: Thu, 26 May 2011 16:02:51 -0700	[thread overview]
Message-ID: <1306450971-27732-5-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1306450971-27732-1-git-send-email-khilman@ti.com>

Move suspend wakeup timer from suspend path to be triggered based
on clockevent suspend path.

When gptimers are eventually converted to be a driver, the wakeup
timer feature can be made to be a driver-specific feature using the
driver's suspend method.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/pm-debug.c            |   19 ----------------
 arch/arm/mach-omap2/pm.h                  |    3 --
 arch/arm/mach-omap2/pm34xx.c              |    4 ---
 arch/arm/mach-omap2/timer-gp.c            |   33 ++++++++++++++++++++++++++--
 arch/arm/plat-omap/include/plat/dmtimer.h |    1 -
 5 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 7c72f29..72dee22 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -39,25 +39,6 @@
 #include "pm.h"
 
 u32 enable_off_mode;
-u32 wakeup_timer_seconds;
-u32 wakeup_timer_milliseconds;
-
-void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds)
-{
-	u32 tick_rate, cycles;
-
-	if (!seconds && !milliseconds)
-		return;
-
-	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
-	cycles = tick_rate * seconds + tick_rate * milliseconds / 1000;
-	omap_dm_timer_stop(gptimer_wakeup);
-	omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles);
-
-	pr_info("PM: Resume timer in %u.%03u secs"
-		" (%d ticks at %d ticks/sec.)\n",
-		seconds, milliseconds, cycles, tick_rate);
-}
 
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index dd1c2e4..803bf1c 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -57,13 +57,10 @@ extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
 
 extern u32 wakeup_timer_seconds;
 extern u32 wakeup_timer_milliseconds;
-extern struct omap_dm_timer *gptimer_wakeup;
 
 #ifdef CONFIG_PM_DEBUG
-extern void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds);
 extern u32 enable_off_mode;
 #else
-#define omap2_pm_wakeup_on_timer(seconds, milliseconds)	do {} while (0);
 #define enable_off_mode 0
 #endif
 
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 991ade6..a9d9bb1c8 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -532,10 +532,6 @@ static int omap3_pm_suspend(void)
 	struct power_state *pwrst;
 	int state, ret = 0;
 
-	if (wakeup_timer_seconds || wakeup_timer_milliseconds)
-		omap2_pm_wakeup_on_timer(wakeup_timer_seconds,
-					 wakeup_timer_milliseconds);
-
 	/* Read current next_pwrsts */
 	list_for_each_entry(pwrst, &pwrst_list, node)
 		pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm);
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 3b9cf85..4de51a1 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -44,7 +44,7 @@
 #include <plat/omap_hwmod.h>
 
 #include "timer-gp.h"
-
+#include "pm.h"
 
 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
 #define MAX_GPTIMER_ID		12
@@ -53,7 +53,30 @@ static struct omap_dm_timer *gptimer;
 static struct clock_event_device clockevent_gpt;
 static u8 __initdata gptimer_id = 1;
 static u8 __initdata inited;
-struct omap_dm_timer *gptimer_wakeup;
+static struct omap_dm_timer *gptimer_wakeup;
+
+u32 wakeup_timer_seconds;
+u32 wakeup_timer_milliseconds;
+
+static void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds)
+{
+	u32 tick_rate, cycles;
+
+	if (!gptimer_wakeup)
+		return;
+
+	if (!seconds && !milliseconds)
+		return;
+
+	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
+	cycles = tick_rate * seconds + tick_rate * milliseconds / 1000;
+	omap_dm_timer_stop(gptimer_wakeup);
+	omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles);
+
+	pr_info("PM: Resume timer in %u.%03u secs"
+		" (%d ticks at %d ticks/sec.)\n",
+		seconds, milliseconds, cycles, tick_rate);
+}
 
 static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
 {
@@ -95,8 +118,12 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
 		break;
 	case CLOCK_EVT_MODE_ONESHOT:
 		break;
-	case CLOCK_EVT_MODE_UNUSED:
 	case CLOCK_EVT_MODE_SHUTDOWN:
+		if (wakeup_timer_seconds || wakeup_timer_milliseconds)
+			omap2_pm_wakeup_on_timer(wakeup_timer_seconds,
+						 wakeup_timer_milliseconds);
+		break;
+	case CLOCK_EVT_MODE_UNUSED:
 	case CLOCK_EVT_MODE_RESUME:
 		break;
 	}
diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
index d6c70d2..db230b3 100644
--- a/arch/arm/plat-omap/include/plat/dmtimer.h
+++ b/arch/arm/plat-omap/include/plat/dmtimer.h
@@ -56,7 +56,6 @@
  */
 #define OMAP_TIMER_IP_VERSION_1                        0x1
 struct omap_dm_timer;
-extern struct omap_dm_timer *gptimer_wakeup;
 extern struct sys_timer omap_timer;
 struct clk;
 
-- 
1.7.4


  parent reply	other threads:[~2011-05-26 22:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26 23:02 [PATCH/RFC 0/4] OMAP: PM debug: remove register dump, misc cleanups Kevin Hilman
2011-05-26 23:02 ` [PATCH/RFC 1/4] OMAP3: PM debug: remove sleep_while_idle feature Kevin Hilman
2011-05-27  7:37   ` Jean Pihet
2011-05-27 15:26     ` Kevin Hilman
2011-05-27 16:01       ` Jean Pihet
2011-05-30  7:15   ` Santosh Shilimkar
2011-05-30  7:59     ` Jean Pihet
2011-05-26 23:02 ` [PATCH/RFC 2/4] OMAP2: PM debug: remove register dumping Kevin Hilman
2011-05-30  7:17   ` Santosh Shilimkar
2011-06-01  1:34     ` Kevin Hilman
2011-05-30  8:05   ` Jean Pihet
2011-05-31  8:24     ` Titiano, Patrick
2011-06-01  1:40       ` Kevin Hilman
2011-06-01 14:28         ` Titiano, Patrick
2011-05-26 23:02 ` [PATCH/RFC 3/4] OMAP3: " Kevin Hilman
2011-05-30  7:18   ` Santosh Shilimkar
2011-05-30  8:06     ` Jean Pihet
2011-05-26 23:02 ` Kevin Hilman [this message]
2011-05-27  5:18   ` [PATCH/RFC 4/4] OMAP2: PM debug: move wakeup timer into clockevent code Santosh Shilimkar
2011-05-30  7:21     ` Santosh Shilimkar
2011-05-30  8:08       ` Jean Pihet
2011-05-30  8:10         ` Santosh Shilimkar
2011-05-27  7:34 ` [PATCH/RFC 0/4] OMAP: PM debug: remove register dump, misc cleanups Jean Pihet
2011-05-27 15:00   ` Kevin Hilman
2011-06-13 12:28 ` Santosh Shilimkar
2011-06-16  0:33   ` Kevin Hilman

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=1306450971-27732-5-git-send-email-khilman@ti.com \
    --to=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=p-titiano@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).