[PATCH 26/29] OMAP: Sysfs interface for enabling voltage off in idle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Kalle Jokiniemi <ext-kalle.jokiniemi@xxxxxxxxx>

This patch creates a sysfs interface (/sys/power/voltage_off_while_idle) to
set or clear a variable which can be used in determining wether voltage
regulators should be shut down in idle.

Signed-off-by: Kalle Jokiniemi <ext-kalle.jokiniemi@xxxxxxxxx>
---
 arch/arm/mach-omap2/pm.c |   21 ++++++++++++++++++++-
 arch/arm/mach-omap2/pm.h |    1 +
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index c063565..c89de1e 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -36,6 +36,7 @@
 unsigned short enable_dyn_sleep;
 unsigned short gpio_clocks_off_while_idle;
 unsigned short uart_clocks_off_while_idle;
+unsigned short voltage_off_while_idle;
 atomic_t sleep_block = ATOMIC_INIT(0);
 
 static ssize_t idle_show(struct kobject *, struct kobj_attribute *, char *);
@@ -51,6 +52,9 @@ static struct kobj_attribute gpio_clocks_off_while_idle_attr =
 static struct kobj_attribute uart_clocks_off_while_idle_attr =
 	__ATTR(uart_clocks_off_while_idle, 0644, idle_show, idle_store);
 
+static struct kobj_attribute voltage_off_while_idle_attr =
+	__ATTR(voltage_off_while_idle, 0644, idle_show, idle_store);
+
 static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
 			 char *buf)
 {
@@ -60,6 +64,8 @@ static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
 		return sprintf(buf, "%hu\n", gpio_clocks_off_while_idle);
 	else if (attr == &uart_clocks_off_while_idle_attr)
 		return sprintf(buf, "%hu\n", uart_clocks_off_while_idle);
+	else if (attr == &voltage_off_while_idle_attr)
+		return sprintf(buf, "%hu\n", voltage_off_while_idle);
 	else
 		return -EINVAL;
 }
@@ -81,6 +87,8 @@ static ssize_t idle_store(struct kobject *kobj, struct kobj_attribute *attr,
 		gpio_clocks_off_while_idle = value;
 	else if (attr == &uart_clocks_off_while_idle_attr)
 		uart_clocks_off_while_idle = value;
+	else if (attr == &voltage_off_while_idle_attr)
+		voltage_off_while_idle = value;
 	else
 		return -EINVAL;
 
@@ -129,9 +137,20 @@ static int __init omap_pm_init(void)
 
 	error = sysfs_create_file(power_kobj,
 				  &gpio_clocks_off_while_idle_attr.attr);
-	if (error)
+	if (error) {
 		printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
+		return error;
+	}
 
+	voltage_off_while_idle = 0;
+	/* Going to 0V on anything under ES2.1 will eventually cause a crash */
+	if (is_sil_rev_greater_than(OMAP3430_REV_ES2_0)) {
+		error = sysfs_create_file(power_kobj,
+				  &voltage_off_while_idle_attr.attr);
+		if (error)
+			printk(KERN_ERR "sysfs_create_file failed: %d\n",
+								error);
+	}
 	return error;
 }
 
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 7776cdb..aad4aeb 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -19,6 +19,7 @@ extern int omap3_pm_init(void);
 extern unsigned short enable_dyn_sleep;
 extern unsigned short gpio_clocks_off_while_idle;
 extern unsigned short uart_clocks_off_while_idle;
+extern unsigned short voltage_off_while_idle;
 extern atomic_t sleep_block;
 
 extern void omap2_block_sleep(void);
-- 
1.6.0

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

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux