From patchwork Mon Mar 22 08:10:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ari Kauppi X-Patchwork-Id: 87374 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2M8BdrS008893 for ; Mon, 22 Mar 2010 08:11:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753646Ab0CVILh (ORCPT ); Mon, 22 Mar 2010 04:11:37 -0400 Received: from smtp.nokia.com ([192.100.105.134]:29417 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165Ab0CVILf (ORCPT ); Mon, 22 Mar 2010 04:11:35 -0400 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o2M8BIBn007197; Mon, 22 Mar 2010 03:11:32 -0500 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 22 Mar 2010 10:10:56 +0200 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 22 Mar 2010 10:10:56 +0200 Received: from localhost.localdomain (ouped118234.nmp.nokia.com [172.23.118.234]) by mgw-sa01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o2M8As8t026514; Mon, 22 Mar 2010 10:10:54 +0200 From: Ari Kauppi To: khilman@deeprootsystems.com Cc: linux-omap@vger.kernel.org, tero.kristo@nokia.com Subject: [PATCH] OMAP3: PM: Modify suspend wakeup timer to use milliseconds instead of seconds Date: Mon, 22 Mar 2010 10:10:54 +0200 Message-Id: <1269245454-24254-1-git-send-email-Ext-Ari.Kauppi@nokia.com> X-Mailer: git-send-email 1.6.4.2 X-OriginalArrivalTime: 22 Mar 2010 08:10:56.0717 (UTC) FILETIME=[330C4FD0:01CAC997] X-Nokia-AV: Clean 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.3 (demeter.kernel.org [140.211.167.41]); Mon, 22 Mar 2010 08:11:39 +0000 (UTC) diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 8aafd71..0cf2a03 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -37,6 +37,7 @@ #include "prm-regbits-34xx.h" int omap2_pm_debug; +static u32 wakeup_timer_seconds; #define DUMP_PRM_MOD_REG(mod, reg) \ regs[reg_count].name = #mod "." #reg; \ @@ -552,6 +553,12 @@ static int option_set(void *data, u64 val) if (option == &enable_off_mode) omap3_pm_off_mode_enable(val); + + if (option == &wakeup_timer_seconds) + wakeup_timer_milliseconds = val * 1000; + if (option == &wakeup_timer_milliseconds) + wakeup_timer_seconds = roundup((u32)val, 1000) / 1000; + return 0; } @@ -605,6 +612,10 @@ static int __init pm_dbg_init(void) &sleep_while_idle, &pm_dbg_option_fops); (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d, &wakeup_timer_seconds, &pm_dbg_option_fops); + (void) debugfs_create_file("wakeup_timer_milliseconds", + S_IRUGO | S_IWUGO, d, + &wakeup_timer_milliseconds, + &pm_dbg_option_fops); /* Only enable for >= ES2.1 . Going to 0V on anything under * ES2.1 will eventually cause a crash */ diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index b761be5..423395a 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -68,7 +68,7 @@ static inline void omap3_pm_init_vc(struct prm_setup_vc *setup_vc) extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); 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 diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 3868c76..cd55968 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -73,7 +73,7 @@ static inline bool is_suspending(void) u32 enable_off_mode; u32 sleep_while_idle; -u32 wakeup_timer_seconds; +u32 wakeup_timer_milliseconds; u32 voltage_off_while_idle; struct power_state { @@ -640,20 +640,20 @@ out: } #ifdef CONFIG_SUSPEND -static void omap2_pm_wakeup_on_timer(u32 seconds) +static void omap2_pm_wakeup_on_timer(u32 milliseconds) { u32 tick_rate, cycles; - if (!seconds) + if (!milliseconds) return; tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); - cycles = tick_rate * seconds; + cycles = 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 %d secs (%d ticks at %d ticks/sec.)\n", - seconds, cycles, tick_rate); + pr_info("PM: Resume timer in %u ms (%u ticks at %u ticks/sec.)\n", + milliseconds, cycles, tick_rate); } static int omap3_pm_prepare(void) @@ -667,8 +667,8 @@ static int omap3_pm_suspend(void) struct power_state *pwrst; int state, ret = 0; - if (wakeup_timer_seconds) - omap2_pm_wakeup_on_timer(wakeup_timer_seconds); + if (wakeup_timer_milliseconds) + omap2_pm_wakeup_on_timer(wakeup_timer_milliseconds); /* Read current next_pwrsts */ list_for_each_entry(pwrst, &pwrst_list, node)