Skip to contentSkip to conversation

PM: drop clocks_off_while_idle

PATCH In review Kevin Hilman 3 participants 7 messages May 19, 2009 – May 20, 2009

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

cover PM: drop clocks_off_while_idle

The sysfs control /sys/power/clocks_off_while_idle only affects the UART clocks. And these can now be controlled with a UART specific timeout sysfs control. The system default behavior is to have the equivalent of clocks_off_while_idle == 1 and a UART inactivity timeout of 5 seconds.

Now one can use

/sys/devices/platform/serial8250.<uart>/sleep_timeout

to set the inactivity timer for the UART in seconds. Setting this value to zero disables the timout and is the equivalent of doing an

echo 0 > /sys/power/clocks_off_while_idle

Kevin Hilman (2):
OMAP: PM: UART: zero sleep_timeout will disable timeout feature OMAP2/3: PM: remove /sys/power/clocks_off_while_idle

 arch/arm/mach-omap2/pm.c     |   12 ------------
 arch/arm/mach-omap2/pm.h     |    1 -
 arch/arm/mach-omap2/serial.c |   16 +++++++++++-----
 3 files changed, 11 insertions(+), 18 deletions(-)
#1 lore raw

PATCH 1/2 OMAP: PM: UART: zero sleep_timeout will disable timeout feature

Writing zero to /sys/devices/platform/serial8250.<uart>/sleep_timeout will disable the timeout feature and prevent UART clocks from being disabled.

---
 arch/arm/mach-omap2/serial.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/serial.c +11 -2
index 0762165..c9059fd 100644
@@ -235,7 +235,10 @@ static void omap_uart_block_sleep(struct omap_uart_state *uart)
 
 	omap_uart_smart_idle_enable(uart, 0);
 	uart->can_sleep = 0;
-	mod_timer(&uart->timer, jiffies + uart->timeout);
+	if (uart->timeout)
+		mod_timer(&uart->timer, jiffies + uart->timeout);
+	else
+		del_timer(&uart->timer);
 }
 
 static void omap_uart_allow_sleep(struct omap_uart_state *uart)
@@ -465,8 +468,14 @@ static ssize_t sleep_timeout_store(struct kobject *kobj,
 		return -EINVAL;
 	}
 	sleep_timeout = value * HZ;
-	list_for_each_entry(uart, &uart_list, node)
+	list_for_each_entry(uart, &uart_list, node) {
 		uart->timeout = sleep_timeout;
+		if (uart->timeout)
+			mod_timer(&uart->timer, jiffies + uart->timeout);
+		else
+			/* A zero value means disable timeout feature */
+			omap_uart_block_sleep(uart);
+	}
 	return n;
 }
 
Signature · 1 line
1.6.2.2
#2 lore raw

PATCH 2/2 OMAP2/3: PM: remove /sys/power/clocks_off_while_idle

The sysfs control /sys/power/clocks_off_while_idle only affects the UART clocks. And these can now be controlled with a UART specific timeout sysfs control. The system default behavior is to have the equivalent of clocks_off_while_idle == 1 and a UART inactivity timeout of 5 seconds.

Now one can use

/sys/devices/platform/serial8250.<uart>/sleep_timeout

to set the inactivity timer for the UART in seconds. Setting this value to zero disables the timout and is the equivalent of doing an

echo 0 > /sys/power/clocks_off_while_idle

---
 arch/arm/mach-omap2/pm.c     |   12 ------------
 arch/arm/mach-omap2/pm.h     |    1 -
 arch/arm/mach-omap2/serial.c |    3 ---
 3 files changed, 0 insertions(+), 16 deletions(-)
arch/arm/mach-omap2/pm.c +0 -12
index 58ed520..8633f86 100644
@@ -39,7 +39,6 @@
 #include "pm.h"
 
 unsigned short enable_dyn_sleep;
-unsigned short clocks_off_while_idle;
 unsigned short enable_off_mode;
 unsigned short voltage_off_while_idle;
 unsigned short wakeup_timer_seconds;
@@ -52,9 +51,6 @@ static ssize_t idle_store(struct kobject *k, struct kobj_attribute *,
 static struct kobj_attribute sleep_while_idle_attr =
 	__ATTR(sleep_while_idle, 0644, idle_show, idle_store);
 
-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);
 
@@ -85,8 +81,6 @@ static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
 {
 	if (attr == &sleep_while_idle_attr)
 		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 if (attr == &voltage_off_while_idle_attr)
@@ -109,8 +103,6 @@ static ssize_t idle_store(struct kobject *kobj, struct kobj_attribute *attr,
 
 	if (attr == &sleep_while_idle_attr) {
 		enable_dyn_sleep = value;
-	} else if (attr == &clocks_off_while_idle_attr) {
-		clocks_off_while_idle = value;
 	} else if (attr == &enable_off_mode_attr) {
 		enable_off_mode = value;
 		omap3_pm_off_mode_enable(enable_off_mode);
@@ -255,10 +247,6 @@ static int __init omap_pm_init(void)
 	if (error)
 		printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
 	error = sysfs_create_file(power_kobj,
-				  &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);
arch/arm/mach-omap2/pm.h +0 -1
index e523d75..2547e1b 100644
@@ -24,7 +24,6 @@ static inline int omap3_idle_init(void) { return 0; }
 #endif
 
 extern unsigned short enable_dyn_sleep;
-extern unsigned short clocks_off_while_idle;
 extern unsigned short enable_off_mode;
 extern unsigned short voltage_off_while_idle;
 extern atomic_t sleep_block;
arch/arm/mach-omap2/serial.c +0 -3
index c9059fd..8c27700 100644
@@ -263,9 +263,6 @@ void omap_uart_prepare_idle(int num)
 	struct omap_uart_state *uart;
 
 	list_for_each_entry(uart, &uart_list, node) {
-		if (!clocks_off_while_idle)
-			continue;
-
 		if (num == uart->num && uart->can_sleep) {
 			omap_uart_disable_clocks(uart);
 			return;
Signature · 1 line
1.6.2.2
maintainer
#3 lore raw

Re: [PATCH 2/2] OMAP2/3: PM: remove /sys/power/clocks_off_while_idle

Quoted 8 lines · Kevin Hilman

The sysfs control /sys/power/clocks_off_while_idle only affects the UART clocks. And these can now be controlled with a UART specific timeout sysfs control. The system default behavior is to have the equivalent of clocks_off_while_idle == 1 and a UART inactivity timeout of 5 seconds.

Now one can use

Quoted 7 lines

/sys/devices/platform/serial8250.<uart>/sleep_timeout

to set the inactivity timer for the UART in seconds. Setting this value to zero disables the timout and is the equivalent of doing an

echo 0 > /sys/power/clocks_off_while_idle

Sounds like a nice improvment to me!

Tony

Quoted 92 lines
---
 arch/arm/mach-omap2/pm.c     |   12 ------------
 arch/arm/mach-omap2/pm.h     |    1 -
 arch/arm/mach-omap2/serial.c |    3 ---
 3 files changed, 0 insertions(+), 16 deletions(-)
arch/arm/mach-omap2/pm.c +0 -12
index 58ed520..8633f86 100644
@@ -39,7 +39,6 @@
 #include "pm.h"
 
 unsigned short enable_dyn_sleep;
-unsigned short clocks_off_while_idle;
 unsigned short enable_off_mode;
 unsigned short voltage_off_while_idle;
 unsigned short wakeup_timer_seconds;
@@ -52,9 +51,6 @@ static ssize_t idle_store(struct kobject *k, struct kobj_attribute *,
 static struct kobj_attribute sleep_while_idle_attr =
 	__ATTR(sleep_while_idle, 0644, idle_show, idle_store);
 
-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);
 
@@ -85,8 +81,6 @@ static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
 {
 	if (attr == &sleep_while_idle_attr)
 		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 if (attr == &voltage_off_while_idle_attr)
@@ -109,8 +103,6 @@ static ssize_t idle_store(struct kobject *kobj, struct kobj_attribute *attr,
 
 	if (attr == &sleep_while_idle_attr) {
 		enable_dyn_sleep = value;
-	} else if (attr == &clocks_off_while_idle_attr) {
-		clocks_off_while_idle = value;
 	} else if (attr == &enable_off_mode_attr) {
 		enable_off_mode = value;
 		omap3_pm_off_mode_enable(enable_off_mode);
@@ -255,10 +247,6 @@ static int __init omap_pm_init(void)
 	if (error)
 		printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
 	error = sysfs_create_file(power_kobj,
-				  &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);
arch/arm/mach-omap2/pm.h +0 -1
index e523d75..2547e1b 100644
@@ -24,7 +24,6 @@ static inline int omap3_idle_init(void) { return 0; }
 #endif
 
 extern unsigned short enable_dyn_sleep;
-extern unsigned short clocks_off_while_idle;
 extern unsigned short enable_off_mode;
 extern unsigned short voltage_off_while_idle;
 extern atomic_t sleep_block;
arch/arm/mach-omap2/serial.c +0 -3
index c9059fd..8c27700 100644
@@ -263,9 +263,6 @@ void omap_uart_prepare_idle(int num)
 	struct omap_uart_state *uart;
 
 	list_for_each_entry(uart, &uart_list, node) {
-		if (!clocks_off_while_idle)
-			continue;
-
 		if (num == uart->num && uart->can_sleep) {
 			omap_uart_disable_clocks(uart);
 			return;
Signature · 6 lines
1.6.2.2

--
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
Quoted 5 lines · Richard

Kevin,

Quoted 2 lines

From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Kevin Hilman

Quoted 7 lines
Quoted 3 lines

echo 0 > /sys/power/clocks_off_while_idle

For PM branch are you keeping any kind of running readme file for inclusion in Documentation directory? It would be pretty useful to capture interface changes.

No. Nothing in-kernel at the moment as this is all work-in-progress and changing.

However, Vikram and company are mostly done with a Wiki page on omapzoom.org that documents all the sysfs knobs and other debugging techniques.

Kevin

#6 lore raw
In reply to Kevin Hilman
Quoted 8 lines · Kevin Hilman

The sysfs control /sys/power/clocks_off_while_idle only affects the UART clocks. And these can now be controlled with a UART specific timeout sysfs control. The system default behavior is to have the equivalent of clocks_off_while_idle == 1 and a UART inactivity timeout of 5 seconds.

Now one can use

Quoted 9 lines

/sys/devices/platform/serial8250.<uart>/sleep_timeout

to set the inactivity timer for the UART in seconds. Setting this value to zero disables the timout and is the equivalent of doing an

echo 0 > /sys/power/clocks_off_while_idle

Pushing this series to the PM branch.

Kevin