From: khilman@deeprootsystems.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 26/27] OMAP3: PM debug: allow runtime toggle of PM features
Date: Wed, 14 Oct 2009 14:58:09 -0700 [thread overview]
Message-ID: <1255557490-16787-27-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1255557490-16787-26-git-send-email-khilman@deeprootsystems.com>
Allow enable/disable of low-power states during idle. To
enable low-power idle:
echo 1 > /debug/pm_debug/sleep_while_idle
to disable:
echo 0 > /debug/pm_debug/sleep_while_idle
Also allow enable/disable of OFF-mode. To enable:
echo 1 > /debug/pm_debug/enable_off_mode
to disable:
echo 0 > /debug/pm_debug/enable_off_mode
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
arch/arm/mach-omap2/pm-debug.c | 27 +++++++++++++++++++++++++++
arch/arm/mach-omap2/pm.h | 4 ++++
arch/arm/mach-omap2/pm34xx.c | 22 ++++++++++++++++++++++
arch/arm/mach-omap2/serial.c | 2 --
4 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index deed1dd..4e05d29 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -527,6 +527,29 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
return 0;
}
+static int option_get(void *data, u64 *val)
+{
+ u32 *option = data;
+
+ *val = *option;
+
+ return 0;
+}
+
+static int option_set(void *data, u64 val)
+{
+ u32 *option = data;
+
+ *option = val;
+
+ if (option == &enable_off_mode)
+ omap3_pm_off_mode_enable(val);
+
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(pm_dbg_option_fops, option_get, option_set, "%llu\n");
+
static int __init pm_dbg_init(void)
{
int i;
@@ -569,6 +592,10 @@ static int __init pm_dbg_init(void)
}
+ (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUGO, d,
+ &enable_off_mode, &pm_dbg_option_fops);
+ (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUGO, d,
+ &sleep_while_idle, &pm_dbg_option_fops);
pm_dbg_init_done = 1;
return 0;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index f1d0214..e47508c 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -13,7 +13,11 @@
#include <mach/powerdomain.h>
+extern u32 enable_off_mode;
+extern u32 sleep_while_idle;
+
extern void *omap3_secure_ram_storage;
+extern void omap3_pm_off_mode_enable(int);
extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 80934c3..99996fc 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -25,6 +25,7 @@
#include <linux/list.h>
#include <linux/err.h>
#include <linux/gpio.h>
+#include <linux/clk.h>
#include <mach/sram.h>
#include <mach/prcm.h>
@@ -58,6 +59,9 @@
#define OMAP343X_TABLE_VALUE_OFFSET 0x30
#define OMAP343X_CONTROL_REG_VALUE_OFFSET 0x32
+u32 enable_off_mode;
+u32 sleep_while_idle;
+
struct power_state {
struct powerdomain *pwrdm;
u32 next_state;
@@ -457,6 +461,8 @@ static int omap3_fclks_active(void)
static int omap3_can_sleep(void)
{
+ if (!sleep_while_idle)
+ return 0;
if (!omap_uart_can_sleep())
return 0;
if (omap3_fclks_active())
@@ -900,6 +906,22 @@ static void __init prcm_setup_regs(void)
omap3_d2d_idle();
}
+void omap3_pm_off_mode_enable(int enable)
+{
+ struct power_state *pwrst;
+ u32 state;
+
+ if (enable)
+ state = PWRDM_POWER_OFF;
+ else
+ state = PWRDM_POWER_RET;
+
+ list_for_each_entry(pwrst, &pwrst_list, node) {
+ pwrst->next_state = state;
+ set_pwrdm_state(pwrst->pwrdm, state);
+ }
+}
+
int omap3_pm_get_suspend_state(struct powerdomain *pwrdm)
{
struct power_state *pwrst;
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index b1ebef4..5fe7684 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -169,8 +169,6 @@ static inline void __init omap_uart_reset(struct omap_uart_state *uart)
#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
-static int enable_off_mode; /* to be removed by full off-mode patches */
-
static void omap_uart_save_context(struct omap_uart_state *uart)
{
u16 lcr = 0;
--
1.6.4.3
next prev parent reply other threads:[~2009-10-14 21:58 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-14 21:57 [PATCH 00/27] OMAP3: PM: base off-mode support Kevin Hilman
2009-10-14 21:57 ` [PATCH 01/27] OMAP3: PM: GPMC context save/restore Kevin Hilman
2009-10-14 21:57 ` [PATCH 02/27] OMAP3: PM: GPIO " Kevin Hilman
2009-10-14 21:57 ` [PATCH 03/27] OMAP3: PM: INTC " Kevin Hilman
2009-10-14 21:57 ` [PATCH 04/27] OMAP3: PM: PRCM " Kevin Hilman
2009-10-14 21:57 ` [PATCH 05/27] OMAP3: PM: Populate scratchpad contents Kevin Hilman
2009-10-14 21:57 ` [PATCH 06/27] OMAP3: PM: SCM context save/restore Kevin Hilman
2009-10-14 21:57 ` [PATCH 07/27] OMAP3: PM: SRAM restore function Kevin Hilman
2009-10-14 21:57 ` [PATCH 08/27] OMAP3: PM: handle PER/NEON/CORE in idle Kevin Hilman
2009-10-14 21:57 ` [PATCH 09/27] OMAP3: PM: Restore MMU table entry Kevin Hilman
2009-10-14 21:57 ` [PATCH 10/27] OMAP3: PM: MPU off-mode support Kevin Hilman
2009-10-14 21:57 ` [PATCH 11/27] OMAP3: PM: CORE domain " Kevin Hilman
2009-10-14 21:57 ` [PATCH 12/27] OMAP: PM: DMA context save/restore for " Kevin Hilman
2009-10-14 21:57 ` [PATCH 13/27] OMAP3 PM: off-mode support for HS/EMU devices Kevin Hilman
2009-10-14 21:57 ` [PATCH 14/27] OMAP3: PM: save secure RAM only during init Kevin Hilman
2009-10-14 21:57 ` [PATCH 15/27] OMAP3: PM: Enable SDRAM auto-refresh during sleep Kevin Hilman
2009-10-14 21:57 ` [PATCH 16/27] OMAP3: PM: Save and restore also CM_CLKSEL1_PLL_IVA2 Kevin Hilman
2009-10-14 21:58 ` [PATCH 17/27] OMAP3: PM: Fix secure SRAM context save/restore Kevin Hilman
2009-10-14 21:58 ` [PATCH 18/27] ARM: OMAP: Add missing SMS_SYSCONFIG save/restore Kevin Hilman
2009-10-14 21:58 ` [PATCH 19/27] OMAP3: PM: Fix PLL_MOD CLKEN offset in scratchpad Kevin Hilman
2009-10-14 21:58 ` [PATCH 20/27] OMAP: PM: Clear DMA channel state after a wakeup Kevin Hilman
2009-10-14 21:58 ` [PATCH 21/27] OMAP: Store reboot mode in scratchpad on OMAP34xx Kevin Hilman
2009-10-14 21:58 ` [PATCH 22/27] OMAP3: PM: SDRC auto-refresh workaround for off-mode Kevin Hilman
2009-10-14 21:58 ` [PATCH 23/27] OMAP3: PM: Fix INTC context save/restore Kevin Hilman
2009-10-14 21:58 ` [PATCH 24/27] PM: Disable usb host HW save and restore Kevin Hilman
2009-10-14 21:58 ` [PATCH 25/27] OMAP3: PM: Wait for SDRC ready iso a blind delay Kevin Hilman
2009-10-14 21:58 ` Kevin Hilman [this message]
2009-10-14 21:58 ` [PATCH 27/27] PM debug: allow configurable wakeup from suspend on OMAP GPtimer Kevin Hilman
2009-10-14 22:18 ` [PATCH 08/27] OMAP3: PM: handle PER/NEON/CORE in idle Tony Lindgren
2009-10-14 22:17 ` [PATCH 07/27] OMAP3: PM: SRAM restore function Tony Lindgren
2009-10-14 22:15 ` [PATCH 03/27] OMAP3: PM: INTC context save/restore Tony Lindgren
2009-10-14 22:13 ` [PATCH 02/27] OMAP3: PM: GPIO " Tony Lindgren
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=1255557490-16787-27-git-send-email-khilman@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).