Commit c7165ccf authored by Jouni Hogander's avatar Jouni Hogander Committed by Tony Lindgren

OMAP: PM: Add new sysfs option for disabling clocks when entering idle

There are drivers that are not disabling their clocks (gpio &
uart). These clocks need to be disabled if retention/off state is
wanted when idling. Before disabling them in idle loop this option
needs to be checked.
Signed-off-by: default avatarJouni Hogander <jouni.hogander@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent d8721109
...@@ -31,30 +31,51 @@ ...@@ -31,30 +31,51 @@
#include "pm.h" #include "pm.h"
unsigned short enable_dyn_sleep; unsigned short enable_dyn_sleep;
unsigned short clocks_off_while_idle;
atomic_t sleep_block = ATOMIC_INIT(0); atomic_t sleep_block = ATOMIC_INIT(0);
static ssize_t idle_show(struct kobject *, struct kobj_attribute *, char *);
static ssize_t idle_store(struct kobject *k, struct kobj_attribute *,
const char *buf, size_t n);
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 ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr, static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf) char *buf)
{ {
return sprintf(buf, "%hu\n", enable_dyn_sleep); 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
return -EINVAL;
} }
static ssize_t idle_store(struct kobject *kobj, struct kobj_attribute *attr, static ssize_t idle_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t n) const char *buf, size_t n)
{ {
unsigned short value; unsigned short value;
if (sscanf(buf, "%hu", &value) != 1 || if (sscanf(buf, "%hu", &value) != 1 ||
(value != 0 && value != 1)) { (value != 0 && value != 1)) {
printk(KERN_ERR "idle_sleep_store: Invalid value\n"); printk(KERN_ERR "idle_store: Invalid value\n");
return -EINVAL; return -EINVAL;
} }
enable_dyn_sleep = value;
if (attr == &sleep_while_idle_attr)
enable_dyn_sleep = value;
else if (attr == &clocks_off_while_idle_attr)
clocks_off_while_idle = value;
else
return -EINVAL;
return n; return n;
} }
static struct kobj_attribute sleep_while_idle_attr =
__ATTR(sleep_while_idle, 0644, idle_show, idle_store);
void omap2_block_sleep(void) void omap2_block_sleep(void)
{ {
atomic_inc(&sleep_block); atomic_inc(&sleep_block);
...@@ -86,6 +107,10 @@ int __init omap_pm_init(void) ...@@ -86,6 +107,10 @@ int __init omap_pm_init(void)
error = sysfs_create_file(power_kobj, &sleep_while_idle_attr.attr); error = sysfs_create_file(power_kobj, &sleep_while_idle_attr.attr);
if (error) if (error)
printk(KERN_ERR "sysfs_create_file failed: %d\n", 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);
return error; return error;
} }
......
...@@ -17,6 +17,7 @@ extern int omap2_pm_init(void); ...@@ -17,6 +17,7 @@ extern int omap2_pm_init(void);
extern int omap3_pm_init(void); extern int omap3_pm_init(void);
extern unsigned short enable_dyn_sleep; extern unsigned short enable_dyn_sleep;
extern unsigned short clocks_off_while_idle;
extern atomic_t sleep_block; extern atomic_t sleep_block;
#ifdef CONFIG_PM_DEBUG #ifdef CONFIG_PM_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment