From patchwork Thu May 26 23:02:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 822222 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4QMuqLX014479 for ; Thu, 26 May 2011 22:56:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758664Ab1EZW4v (ORCPT ); Thu, 26 May 2011 18:56:51 -0400 Received: from na3sys009aog117.obsmtp.com ([74.125.149.242]:47717 "EHLO na3sys009aog117.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757352Ab1EZW4u (ORCPT ); Thu, 26 May 2011 18:56:50 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]) (using TLSv1) by na3sys009aob117.postini.com ([74.125.148.12]) with SMTP ID DSNKTd7asZzYLH9/yLZ4bdqhSa/FoRR3gxin@postini.com; Thu, 26 May 2011 15:56:50 PDT Received: by mail-pv0-f174.google.com with SMTP id 12so512546pvg.19 for ; Thu, 26 May 2011 15:56:49 -0700 (PDT) Received: by 10.68.31.166 with SMTP id b6mr569228pbi.198.1306450609539; Thu, 26 May 2011 15:56:49 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net [24.19.7.36]) by mx.google.com with ESMTPS id t4sm1813105pbm.47.2011.05.26.15.56.48 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2011 15:56:49 -0700 (PDT) From: Kevin Hilman 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 Message-Id: <1306450971-27732-5-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1306450971-27732-1-git-send-email-khilman@ti.com> References: <1306450971-27732-1-git-send-email-khilman@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 26 May 2011 22:56:52 +0000 (UTC) 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 --- 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 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 #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;