Skip to contentSkip to conversation

OMAP3: Dynamic enable/disable of OFF support

PATCH In review Rajendra Nayak 3 participants 6 messages Sep 26, 2008 – Oct 1, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 15/16 OMAP3: Dynamic enable/disable of OFF support

This patch adds a runtime sysfs knob (/sys/power/enable_off_mode) to enable/disbale CORE OFF support for OMAP3.

---
 arch/arm/mach-omap2/pm.c     |   21 +++++++++++++++++----
 arch/arm/mach-omap2/pm.h     |    2 ++
 arch/arm/mach-omap2/pm34xx.c |   26 ++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/pm34xx.c +26 -0
Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===================================================================
@@ -395,6 +395,32 @@ static int omap3_can_sleep(void)
 	return 1;
 }
 
+int set_next_pwrst(struct powerdomain *pwrdm)
+{
+	struct power_state *pwrst;
+	int ret = 0;
+	u32 state;
+
+	if (!pwrdm->pwrsts)
+		return 0;
+
+	if (enable_off_mode)
+		state = PWRDM_POWER_OFF;
+	else
+		state = PWRDM_POWER_RET;
+
+	ret = pwrdm_set_next_pwrst(pwrdm, state);
+	if (ret) {
+		printk(KERN_ERR "Unable to set state of powerdomain: %s\n",
+		       pwrdm->name);
+		goto err;
+	}
+	list_for_each_entry(pwrst, &pwrst_list, node)
+		pwrst->next_state = state;
+err:
+	return ret;
+}
+
 /* This sets pwrdm state (other than mpu & core. Currently only ON &
  * RET are supported. Function is assuming that clkdm doesn't have
  * hw_sup mode enabled. */
arch/arm/mach-omap2/pm.c +17 -4
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c
===================================================================
@@ -35,6 +35,7 @@
 
 unsigned short enable_dyn_sleep;
 unsigned short clocks_off_while_idle;
+unsigned short enable_off_mode;
 atomic_t sleep_block = ATOMIC_INIT(0);
 
 static ssize_t idle_show(struct kobject *, struct kobj_attribute *, char *);
@@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while
 static struct kobj_attribute clocks_off_while_idle_attr =
 	__ATTR(clocks_off_while_idle, 0644, idle_show, idle_store);
 
+static struct kobj_attribute enable_off_mode_attr =
+	__ATTR(enable_off_mode, 0644, idle_show, idle_store);
+
 static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
 			 char *buf)
 {
@@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject 
 		return sprintf(buf, "%hu\n", enable_dyn_sleep);
 	else if (attr == &clocks_off_while_idle_attr)
 		return sprintf(buf, "%hu\n", clocks_off_while_idle);
+	else if (attr == &enable_off_mode_attr)
+		return sprintf(buf, "%hu\n", enable_off_mode);
 	else
 		return -EINVAL;
 }
@@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject
 		return -EINVAL;
 	}
 
-	if (attr == &sleep_while_idle_attr)
+	if (attr == &sleep_while_idle_attr) {
 		enable_dyn_sleep = value;
-	else if (attr == &clocks_off_while_idle_attr)
+	} else if (attr == &clocks_off_while_idle_attr) {
 		clocks_off_while_idle = value;
-	else
+	} else if (attr == &enable_off_mode_attr) {
+		enable_off_mode = value;
+		pwrdm_for_each(set_next_pwrst);
+	} else {
 		return -EINVAL;
-
+	}
 	return n;
 }
 
@@ -114,6 +123,10 @@ static int __init omap_pm_init(void)
 				  &clocks_off_while_idle_attr.attr);
 	if (error)
 		printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
+	error = sysfs_create_file(power_kobj,
+				  &enable_off_mode_attr.attr);
+	if (error)
+		printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
 
 	return error;
 }
arch/arm/mach-omap2/pm.h +2 -0
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.h
===================================================================
@@ -18,10 +18,12 @@ extern int omap3_pm_init(void);
 
 extern unsigned short enable_dyn_sleep;
 extern unsigned short clocks_off_while_idle;
+extern unsigned short enable_off_mode;
 extern atomic_t sleep_block;
 
 extern void omap2_block_sleep(void);
 extern void omap2_allow_sleep(void);
+extern int set_next_pwrst(struct powerdomain *pwrdm);
 
 #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
 #define OMAP343X_TABLE_VALUE_OFFSET   0x30
#1 lore raw

Sorry I replied on a wrong patch mail earlier.. I meant the below wrt this patch.

I just managed to see that this patch seems to break suspend functionality. If after bootup I enable OFF mode the subsequent suspend tries to put a few power domains to OFF which are currently in RET, and since there is no code in place today to handle RET to OFF transitions, they don't transition to OFF and remain in RET.

Supporting run time enable/disable of OFF functionality is kind of becoming complicated. Do we really see a need to have a run-time option to enable/disable OFF mode or can we have a compile time option for this?

Quoted 154 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rajendra Nayak
Sent: Friday, September 26, 2008 5:50 PM
To: [email protected]
Cc: 'Kevin Hilman'
Subject: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support

This patch adds a runtime sysfs knob (/sys/power/enable_off_mode) to enable/disbale CORE OFF support for OMAP3.

---
 arch/arm/mach-omap2/pm.c     |   21 +++++++++++++++++----
 arch/arm/mach-omap2/pm.h     |    2 ++
 arch/arm/mach-omap2/pm34xx.c |   26 ++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 4 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c

2008-09-26 16:39:30.000000000 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c	
2008-09-26 16:39:34.000000000 +0530
arch/arm/mach-omap2/pm34xx.c +26 -0
@@ -395,6 +395,32 @@ static int omap3_can_sleep(void)
 	return 1;
 }
 
+int set_next_pwrst(struct powerdomain *pwrdm)
+{
+	struct power_state *pwrst;
+	int ret = 0;
+	u32 state;
+
+	if (!pwrdm->pwrsts)
+		return 0;
+
+	if (enable_off_mode)
+		state = PWRDM_POWER_OFF;
+	else
+		state = PWRDM_POWER_RET;
+
+	ret = pwrdm_set_next_pwrst(pwrdm, state);
+	if (ret) {
+		printk(KERN_ERR "Unable to set state of 
 powerdomain: %s\n",
+		       pwrdm->name);
+		goto err;
+	}
+	list_for_each_entry(pwrst, &pwrst_list, node)
+		pwrst->next_state = state;
+err:
+	return ret;
+}
+
 /* This sets pwrdm state (other than mpu & core. Currently only ON &
  * RET are supported. Function is assuming that clkdm doesn't have

* hw_sup mode enabled. */
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.c

2008-09-26 16:39:30.000000000 +0530

+++ linux-omap-2.6/arch/arm/mach-omap2/pm.c 2008-09-26
16:39:34.000000000 +0530

arch/arm/mach-omap2/pm.c +1 -0
@@ -35,6 +35,7 @@
 
 unsigned short enable_dyn_sleep;
 unsigned short clocks_off_while_idle;
+unsigned short enable_off_mode;
 atomic_t sleep_block = ATOMIC_INIT(0);
 
 static ssize_t idle_show(struct kobject *, struct 

kobj_attribute *, char *);

arch/arm/mach-omap2/pm.c +3 -0
@@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while
 static struct kobj_attribute clocks_off_while_idle_attr =
 	__ATTR(clocks_off_while_idle, 0644, idle_show, idle_store);
 
+static struct kobj_attribute enable_off_mode_attr =
+	__ATTR(enable_off_mode, 0644, idle_show, idle_store);
+
 static ssize_t idle_show(struct kobject *kobj, struct 
 kobj_attribute *attr,
 			 char *buf)

{

arch/arm/mach-omap2/pm.c +13 -4
@@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject 
 		return sprintf(buf, "%hu\n", enable_dyn_sleep);
 	else if (attr == &clocks_off_while_idle_attr)
 		return sprintf(buf, "%hu\n", clocks_off_while_idle);
+	else if (attr == &enable_off_mode_attr)
+		return sprintf(buf, "%hu\n", enable_off_mode);
 	else
 		return -EINVAL;
 }
@@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject
 		return -EINVAL;
 	}
 
-	if (attr == &sleep_while_idle_attr)
+	if (attr == &sleep_while_idle_attr) {
 		enable_dyn_sleep = value;
-	else if (attr == &clocks_off_while_idle_attr)
+	} else if (attr == &clocks_off_while_idle_attr) {
 		clocks_off_while_idle = value;
-	else
+	} else if (attr == &enable_off_mode_attr) {
+		enable_off_mode = value;
+		pwrdm_for_each(set_next_pwrst);
+	} else {
 		return -EINVAL;
-
+	}
 	return n;
 }
 
@@ -114,6 +123,10 @@ static int __init omap_pm_init(void)
 				  &clocks_off_while_idle_attr.attr);
 	if (error)
 		printk(KERN_ERR "sysfs_create_file failed: 
 %d\n", error);
+	error = sysfs_create_file(power_kobj,
+				  &enable_off_mode_attr.attr);
+	if (error)
+		printk(KERN_ERR "sysfs_create_file failed: 
 %d\n", error);
 

return error;
}
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.h

2008-09-26 16:39:30.000000000 +0530

+++ linux-omap-2.6/arch/arm/mach-omap2/pm.h 2008-09-26
16:39:34.000000000 +0530

arch/arm/mach-omap2/pm.h +2 -1
@@ -18,10 +18,12 @@ extern int omap3_pm_init(void);
 
 extern unsigned short enable_dyn_sleep;
 extern unsigned short clocks_off_while_idle;
+extern unsigned short enable_off_mode;
 extern atomic_t sleep_block;
 
 extern void omap2_block_sleep(void);
 extern void omap2_allow_sleep(void);
+extern int set_next_pwrst(struct powerdomain *pwrdm);
 
 #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
 #define OMAP343X_TABLE_VALUE_OFFSET   0x30
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 5 lines · Rajendra Nayak

I just managed to see that this patch seems to break suspend functionality. If after bootup I enable OFF mode the subsequent suspend tries to put a few power domains to OFF which are currently in RET, and since there is no code in place today to handle RET to OFF transitions, they don't transition to OFF and remain in RET.

See commit a974addcfa23181667fe32e5032820917bf4a2b2 from Tero Kristo. This patch was meant to address these kinds of transitions, but it seems it's not working exactly right. I'm debugging now.

Quoted 4 lines

Supporting run time enable/disable of OFF functionality is kind of becoming complicated. Do we really see a need to have a run-time option to enable/disable OFF mode or can we have a compile time option for this?

Run-time option is required.

Kevin

Quoted 154 lines
Quoted 154 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rajendra Nayak
Sent: Friday, September 26, 2008 5:50 PM
To: [email protected]
Cc: 'Kevin Hilman'
Subject: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support

This patch adds a runtime sysfs knob (/sys/power/enable_off_mode) to enable/disbale CORE OFF support for OMAP3.

---
 arch/arm/mach-omap2/pm.c     |   21 +++++++++++++++++----
 arch/arm/mach-omap2/pm.h     |    2 ++
 arch/arm/mach-omap2/pm34xx.c |   26 ++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 4 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c

2008-09-26 16:39:30.000000000 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c	
2008-09-26 16:39:34.000000000 +0530
arch/arm/mach-omap2/pm34xx.c +26 -0
@@ -395,6 +395,32 @@ static int omap3_can_sleep(void)
 	return 1;
 }
 
+int set_next_pwrst(struct powerdomain *pwrdm)
+{
+	struct power_state *pwrst;
+	int ret = 0;
+	u32 state;
+
+	if (!pwrdm->pwrsts)
+		return 0;
+
+	if (enable_off_mode)
+		state = PWRDM_POWER_OFF;
+	else
+		state = PWRDM_POWER_RET;
+
+	ret = pwrdm_set_next_pwrst(pwrdm, state);
+	if (ret) {
+		printk(KERN_ERR "Unable to set state of 
 powerdomain: %s\n",
+		       pwrdm->name);
+		goto err;
+	}
+	list_for_each_entry(pwrst, &pwrst_list, node)
+		pwrst->next_state = state;
+err:
+	return ret;
+}
+
 /* This sets pwrdm state (other than mpu & core. Currently only ON &
  * RET are supported. Function is assuming that clkdm doesn't have

* hw_sup mode enabled. */
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.c

2008-09-26 16:39:30.000000000 +0530

+++ linux-omap-2.6/arch/arm/mach-omap2/pm.c 2008-09-26
16:39:34.000000000 +0530

arch/arm/mach-omap2/pm.c +1 -0
@@ -35,6 +35,7 @@
 
 unsigned short enable_dyn_sleep;
 unsigned short clocks_off_while_idle;
+unsigned short enable_off_mode;
 atomic_t sleep_block = ATOMIC_INIT(0);
 
 static ssize_t idle_show(struct kobject *, struct 

kobj_attribute *, char *);

arch/arm/mach-omap2/pm.c +3 -0
@@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while
 static struct kobj_attribute clocks_off_while_idle_attr =
 	__ATTR(clocks_off_while_idle, 0644, idle_show, idle_store);
 
+static struct kobj_attribute enable_off_mode_attr =
+	__ATTR(enable_off_mode, 0644, idle_show, idle_store);
+
 static ssize_t idle_show(struct kobject *kobj, struct 
 kobj_attribute *attr,
 			 char *buf)

{

arch/arm/mach-omap2/pm.c +13 -4
@@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject 
 		return sprintf(buf, "%hu\n", enable_dyn_sleep);
 	else if (attr == &clocks_off_while_idle_attr)
 		return sprintf(buf, "%hu\n", clocks_off_while_idle);
+	else if (attr == &enable_off_mode_attr)
+		return sprintf(buf, "%hu\n", enable_off_mode);
 	else
 		return -EINVAL;
 }
@@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject
 		return -EINVAL;
 	}
 
-	if (attr == &sleep_while_idle_attr)
+	if (attr == &sleep_while_idle_attr) {
 		enable_dyn_sleep = value;
-	else if (attr == &clocks_off_while_idle_attr)
+	} else if (attr == &clocks_off_while_idle_attr) {
 		clocks_off_while_idle = value;
-	else
+	} else if (attr == &enable_off_mode_attr) {
+		enable_off_mode = value;
+		pwrdm_for_each(set_next_pwrst);
+	} else {
 		return -EINVAL;
-
+	}
 	return n;
 }
 
@@ -114,6 +123,10 @@ static int __init omap_pm_init(void)
 				  &clocks_off_while_idle_attr.attr);
 	if (error)
 		printk(KERN_ERR "sysfs_create_file failed: 
 %d\n", error);
+	error = sysfs_create_file(power_kobj,
+				  &enable_off_mode_attr.attr);
+	if (error)
+		printk(KERN_ERR "sysfs_create_file failed: 
 %d\n", error);
 

return error;
}
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.h

2008-09-26 16:39:30.000000000 +0530

+++ linux-omap-2.6/arch/arm/mach-omap2/pm.h 2008-09-26
16:39:34.000000000 +0530

arch/arm/mach-omap2/pm.h +2 -1
@@ -18,10 +18,12 @@ extern int omap3_pm_init(void);
 
 extern unsigned short enable_dyn_sleep;
 extern unsigned short clocks_off_while_idle;
+extern unsigned short enable_off_mode;
 extern atomic_t sleep_block;
 
 extern void omap2_block_sleep(void);
 extern void omap2_allow_sleep(void);
+extern int set_next_pwrst(struct powerdomain *pwrdm);
 
 #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
 #define OMAP343X_TABLE_VALUE_OFFSET   0x30
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 12 lines · ext Kevin Hilman
Quoted 5 lines · Rajendra Nayak

I just managed to see that this patch seems to break suspend functionality. If after bootup I enable OFF mode the subsequent suspend tries to put a few power domains to OFF which are currently in RET, and since there is no code in place today to handle RET to OFF transitions, they don't transition to OFF and remain in RET.

See commit a974addcfa23181667fe32e5032820917bf4a2b2 from Tero Kristo. This patch was meant to address these kinds of transitions, but it seems it's not working exactly right. I'm debugging now.

Quoted 6 lines
Quoted 4 lines

Supporting run time enable/disable of OFF functionality is kind of becoming complicated. Do we really see a need to have a run-time option to enable/disable OFF mode or can we have a compile time option for this?

Run-time option is required.

Whole cpuidle + srf concept is about changing between OFF/RET/ON dynamically. So if implementing it through one sysfs entry is discarded because it's complicated, how do you think you could implement it in cpuidle and srf?

Quoted 163 lines

Kevin

Quoted 147 lines
Quoted 147 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Rajendra Nayak
Sent: Friday, September 26, 2008 5:50 PM
To: [email protected]
Cc: 'Kevin Hilman'
Subject: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support

This patch adds a runtime sysfs knob (/sys/power/enable_off_mode) to enable/disbale CORE OFF support for OMAP3.

---
 arch/arm/mach-omap2/pm.c     |   21 +++++++++++++++++----
 arch/arm/mach-omap2/pm.h     |    2 ++
 arch/arm/mach-omap2/pm34xx.c |   26 ++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 4 deletions(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c

2008-09-26 16:39:30.000000000 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c	
2008-09-26 16:39:34.000000000 +0530
arch/arm/mach-omap2/pm34xx.c +26 -0
@@ -395,6 +395,32 @@ static int omap3_can_sleep(void)
 	return 1;
 }
 
+int set_next_pwrst(struct powerdomain *pwrdm)
+{
+	struct power_state *pwrst;
+	int ret = 0;
+	u32 state;
+
+	if (!pwrdm->pwrsts)
+		return 0;
+
+	if (enable_off_mode)
+		state = PWRDM_POWER_OFF;
+	else
+		state = PWRDM_POWER_RET;
+
+	ret = pwrdm_set_next_pwrst(pwrdm, state);
+	if (ret) {
+		printk(KERN_ERR "Unable to set state of 
 powerdomain: %s\n",
+		       pwrdm->name);
+		goto err;
+	}
+	list_for_each_entry(pwrst, &pwrst_list, node)
+		pwrst->next_state = state;
+err:
+	return ret;
+}
+
 /* This sets pwrdm state (other than mpu & core. Currently only ON &
  * RET are supported. Function is assuming that clkdm doesn't have

* hw_sup mode enabled. */
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.c

2008-09-26 16:39:30.000000000 +0530

+++ linux-omap-2.6/arch/arm/mach-omap2/pm.c 2008-09-26
16:39:34.000000000 +0530

arch/arm/mach-omap2/pm.c +1 -0
@@ -35,6 +35,7 @@
 
 unsigned short enable_dyn_sleep;
 unsigned short clocks_off_while_idle;
+unsigned short enable_off_mode;
 atomic_t sleep_block = ATOMIC_INIT(0);
 
 static ssize_t idle_show(struct kobject *, struct 

kobj_attribute *, char *);

arch/arm/mach-omap2/pm.c +3 -0
@@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while
 static struct kobj_attribute clocks_off_while_idle_attr =
 	__ATTR(clocks_off_while_idle, 0644, idle_show, idle_store);
 
+static struct kobj_attribute enable_off_mode_attr =
+	__ATTR(enable_off_mode, 0644, idle_show, idle_store);
+
 static ssize_t idle_show(struct kobject *kobj, struct 
 kobj_attribute *attr,
 			 char *buf)

{

arch/arm/mach-omap2/pm.c +13 -4
@@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject 
 		return sprintf(buf, "%hu\n", enable_dyn_sleep);
 	else if (attr == &clocks_off_while_idle_attr)
 		return sprintf(buf, "%hu\n", clocks_off_while_idle);
+	else if (attr == &enable_off_mode_attr)
+		return sprintf(buf, "%hu\n", enable_off_mode);
 	else
 		return -EINVAL;
 }
@@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject
 		return -EINVAL;
 	}
 
-	if (attr == &sleep_while_idle_attr)
+	if (attr == &sleep_while_idle_attr) {
 		enable_dyn_sleep = value;
-	else if (attr == &clocks_off_while_idle_attr)
+	} else if (attr == &clocks_off_while_idle_attr) {
 		clocks_off_while_idle = value;
-	else
+	} else if (attr == &enable_off_mode_attr) {
+		enable_off_mode = value;
+		pwrdm_for_each(set_next_pwrst);
+	} else {
 		return -EINVAL;
-
+	}
 	return n;
 }
 
@@ -114,6 +123,10 @@ static int __init omap_pm_init(void)
 				  &clocks_off_while_idle_attr.attr);
 	if (error)
 		printk(KERN_ERR "sysfs_create_file failed: 
 %d\n", error);
+	error = sysfs_create_file(power_kobj,
+				  &enable_off_mode_attr.attr);
+	if (error)
+		printk(KERN_ERR "sysfs_create_file failed: 
 %d\n", error);
 

return error;
}
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.h

2008-09-26 16:39:30.000000000 +0530

+++ linux-omap-2.6/arch/arm/mach-omap2/pm.h 2008-09-26
16:39:34.000000000 +0530

arch/arm/mach-omap2/pm.h +2 -0
@@ -18,10 +18,12 @@ extern int omap3_pm_init(void);
 
 extern unsigned short enable_dyn_sleep;
 extern unsigned short clocks_off_while_idle;
+extern unsigned short enable_off_mode;
 extern atomic_t sleep_block;
 
 extern void omap2_block_sleep(void);
 extern void omap2_allow_sleep(void);
+extern int set_next_pwrst(struct powerdomain *pwrdm);
 
 #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
 #define OMAP343X_TABLE_VALUE_OFFSET   0x30
Quoted 7 lines
Quoted 7 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 6 lines
Jouni Högander

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 29 lines

-----Original Message-----
From: "Högander" Jouni [mailto:[email protected]]
Sent: Tuesday, September 30, 2008 3:19 PM
To: ext Kevin Hilman
Cc: Rajendra Nayak; [email protected]
Subject: Re: [PATCH 15/16] OMAP3: Dynamic enable/disable of OFF support

Quoted 9 lines · ext Kevin Hilman
Quoted 5 lines · Rajendra Nayak

I just managed to see that this patch seems to break suspend functionality. If after bootup I enable OFF mode the subsequent suspend tries to put a few power domains to OFF which are currently in RET, and since there is no code in place today to handle RET to OFF transitions, they don't transition to OFF and remain in RET.

See commit a974addcfa23181667fe32e5032820917bf4a2b2 from

Tero Kristo.

Quoted 8 lines

This patch was meant to address these kinds of transitions, but it seems it's not working exactly right. I'm debugging now.

Quoted 4 lines

Supporting run time enable/disable of OFF functionality is kind of becoming complicated. Do we really see a need to have a run-time option to enable/disable OFF mode or can we have a compile time option for this?

Quoted 6 lines
Quoted 1 line

Run-time option is required.

Whole cpuidle + srf concept is about changing between OFF/RET/ON dynamically. So if implementing it through one sysfs entry is discarded because it's complicated, how do you think you could implement it in cpuidle and srf?

What I meant was that hacking around the *existing* code (which neither has cpuidle nor SRF) just to support runtime enable/disable of OFF mode is getting complicated.

Quoted 167 lines
Quoted 7 lines

Kevin

Quoted 3 lines
Quoted 3 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of

Rajendra Nayak

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Sent: Friday, September 26, 2008 5:50 PM
To: [email protected]
Cc: 'Kevin Hilman'
Subject: [PATCH 15/16] OMAP3: Dynamic enable/disable of

OFF support

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

This patch adds a runtime sysfs knob (/sys/power/enable_off_mode) to enable/disbale CORE OFF support for OMAP3.

---
 arch/arm/mach-omap2/pm.c     |   21 +++++++++++++++++----
 arch/arm/mach-omap2/pm.h     |    2 ++
 arch/arm/mach-omap2/pm34xx.c |   26 ++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 4 deletions(-)
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Index: linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c

===================================================================

Quoted 28 lines
Quoted 28 lines
Quoted 28 lines

--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm34xx.c

2008-09-26 16:39:30.000000000 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/pm34xx.c	
2008-09-26 16:39:34.000000000 +0530
arch/arm/mach-omap2/pm34xx.c +19 -0
@@ -395,6 +395,32 @@ static int omap3_can_sleep(void)
 	return 1;
 }
 
+int set_next_pwrst(struct powerdomain *pwrdm)
+{
+	struct power_state *pwrst;
+	int ret = 0;
+	u32 state;
+
+	if (!pwrdm->pwrsts)
+		return 0;
+
+	if (enable_off_mode)
+		state = PWRDM_POWER_OFF;
+	else
+		state = PWRDM_POWER_RET;
+
+	ret = pwrdm_set_next_pwrst(pwrdm, state);
+	if (ret) {
+		printk(KERN_ERR "Unable to set state of 
 powerdomain: %s\n",
+		       pwrdm->name);
+		goto err;
Quoted 8 lines
Quoted 8 lines

arch/arm/mach-omap2/pm34xx.c static int omap3_can_sleep(void)

Quoted 8 lines
arch/arm/mach-omap2/pm34xx.c +7 -0
+	}
+	list_for_each_entry(pwrst, &pwrst_list, node)
+		pwrst->next_state = state;
+err:
+	return ret;
+}
+
 /* This sets pwrdm state (other than mpu & core. 

Currently only ON &

Quoted 1 line
Quoted 1 line

Review static int omap3_can_sleep(void) · line 426

Quoted 1 line
(quoted diff) +0 -0
  * RET are supported. Function is assuming that clkdm 

doesn't have

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

* hw_sup mode enabled. */
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.c

===================================================================

Quoted 65 lines
Quoted 65 lines
Quoted 65 lines

--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.c

2008-09-26 16:39:30.000000000 +0530

+++ linux-omap-2.6/arch/arm/mach-omap2/pm.c 2008-09-26
16:39:34.000000000 +0530

arch/arm/mach-omap2/pm.c +1 -0
@@ -35,6 +35,7 @@
 
 unsigned short enable_dyn_sleep;
 unsigned short clocks_off_while_idle;
+unsigned short enable_off_mode;
 atomic_t sleep_block = ATOMIC_INIT(0);
 
 static ssize_t idle_show(struct kobject *, struct 

kobj_attribute *, char *);

arch/arm/mach-omap2/pm.c +3 -0
@@ -47,6 +48,9 @@ static struct kobj_attribute sleep_while
 static struct kobj_attribute clocks_off_while_idle_attr =
 	__ATTR(clocks_off_while_idle, 0644, idle_show, idle_store);
 
+static struct kobj_attribute enable_off_mode_attr =
+	__ATTR(enable_off_mode, 0644, idle_show, idle_store);
+
 static ssize_t idle_show(struct kobject *kobj, struct 
 kobj_attribute *attr,
 			 char *buf)

{

arch/arm/mach-omap2/pm.c +13 -4
@@ -54,6 +58,8 @@ static ssize_t idle_show(struct kobject 
 		return sprintf(buf, "%hu\n", enable_dyn_sleep);
 	else if (attr == &clocks_off_while_idle_attr)
 		return sprintf(buf, "%hu\n", clocks_off_while_idle);
+	else if (attr == &enable_off_mode_attr)
+		return sprintf(buf, "%hu\n", enable_off_mode);
 	else
 		return -EINVAL;
 }
@@ -69,13 +75,16 @@ static ssize_t idle_store(struct kobject
 		return -EINVAL;
 	}
 
-	if (attr == &sleep_while_idle_attr)
+	if (attr == &sleep_while_idle_attr) {
 		enable_dyn_sleep = value;
-	else if (attr == &clocks_off_while_idle_attr)
+	} else if (attr == &clocks_off_while_idle_attr) {
 		clocks_off_while_idle = value;
-	else
+	} else if (attr == &enable_off_mode_attr) {
+		enable_off_mode = value;
+		pwrdm_for_each(set_next_pwrst);
+	} else {
 		return -EINVAL;
-
+	}
 	return n;
 }
 
@@ -114,6 +123,10 @@ static int __init omap_pm_init(void)
 				  &clocks_off_while_idle_attr.attr);
 	if (error)
 		printk(KERN_ERR "sysfs_create_file failed: 
 %d\n", error);
+	error = sysfs_create_file(power_kobj,
+				  &enable_off_mode_attr.attr);
+	if (error)
+		printk(KERN_ERR "sysfs_create_file failed: 
 %d\n", error);
 
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

return error;
}
Index: linux-omap-2.6/arch/arm/mach-omap2/pm.h

===================================================================

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

--- linux-omap-2.6.orig/arch/arm/mach-omap2/pm.h

2008-09-26 16:39:30.000000000 +0530

+++ linux-omap-2.6/arch/arm/mach-omap2/pm.h 2008-09-26
16:39:34.000000000 +0530

arch/arm/mach-omap2/pm.h +2 -0
@@ -18,10 +18,12 @@ extern int omap3_pm_init(void);
 
 extern unsigned short enable_dyn_sleep;
 extern unsigned short clocks_off_while_idle;
+extern unsigned short enable_off_mode;
 extern atomic_t sleep_block;
 
 extern void omap2_block_sleep(void);
 extern void omap2_allow_sleep(void);
+extern int set_next_pwrst(struct powerdomain *pwrdm);
 
 #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
 #define OMAP343X_TABLE_VALUE_OFFSET   0x30
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe

Quoted 11 lines

linux-omap" in

Quoted 4 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Jouni Högander

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Rajendra Nayak
Quoted 5 lines · Rajendra Nayak

I just managed to see that this patch seems to break suspend functionality. If after bootup I enable OFF mode the subsequent suspend tries to put a few power domains to OFF which are currently in RET, and since there is no code in place today to handle RET to OFF transitions, they don't transition to OFF and remain in RET.

Rajendra,

Try this patch on top of your series, it works for me to hit OFF in suspend and idle after having first hit RET in suspend and idle.

Note that my tests on 3430SDP-ES2 show that dynamic-idle with off-mode enabled eventually hangs. I am not seeing this hang on custom HW.

Kevin

===========================

Quoted 1 line

From a03d3cfd71e9438c9446365519f0cb9ced75d1dd Mon Sep 17 00:00:00 2001

From: Kevin Hilman <[email protected]>
Date: Tue, 30 Sep 2008 16:12:55 +0300
Subject: [PATCH] ARM: OMAP3: PM: allow runtime enable/disable of OFF mode

To enable off mode:

echo 1 > /sys/power/enable_off_mode

to disable:

echo 0 > /sys/power/enable_off_mode

---
 arch/arm/mach-omap2/pm.c     |    5 +++--
 arch/arm/mach-omap2/pm.h     |    2 +-
 arch/arm/mach-omap2/pm34xx.c |   42 ++++++++++++++++--------------------------
 3 files changed, 20 insertions(+), 29 deletions(-)
arch/arm/mach-omap2/pm.c +3 -2
index 412fc86..10f8058 100644
@@ -80,8 +80,9 @@ static ssize_t idle_store(struct kobject *kobj, struct kobj_attribute *attr,
 	} else if (attr == &clocks_off_while_idle_attr) {
 		clocks_off_while_idle = value;
 	} else if (attr == &enable_off_mode_attr) {
-		enable_off_mode = value;
-		pwrdm_for_each(set_next_pwrst);
+		int enable = (value > 0) ? 1 : 0;
+
+		omap3_pm_off_mode_enable(enable);
 	} else {
 		return -EINVAL;
 	}
arch/arm/mach-omap2/pm.h +1 -1
index 7e2c88a..901db2c 100644
@@ -23,7 +23,7 @@ extern atomic_t sleep_block;
 
 extern void omap2_block_sleep(void);
 extern void omap2_allow_sleep(void);
-extern int set_next_pwrst(struct powerdomain *pwrdm);
+extern void omap3_pm_off_mode_enable(int);
 
 #define OMAP343X_TABLE_ADDRESS_OFFSET 0x31
 #define OMAP343X_TABLE_VALUE_OFFSET   0x30
arch/arm/mach-omap2/pm34xx.c +16 -26

54 lines not on this page · raw message

Signature · 1 line
1.6.0