summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter De Schrijver <pdeschrijver@nvidia.com>2011-05-02 15:43:06 +0300
committerNiket Sirsi <nsirsi@nvidia.com>2011-06-24 21:20:13 -0700
commit326928845e261b4becb3eba96d92dacfb144324a (patch)
tree4e44c24e84eacdd4f9c7b3bb286fa15021e298ad
parent2c9577e2e693935cd72a4424586f68c067745a2c (diff)
ARM: tegra: generate status events for all clocks
Change-Id: I55f52ab038764079811c68b3bb3738a9de17d7bf Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com> Reviewed-on: http://git-master/r/31530 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/clock.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index f1b45b3f3dc2..da7ca265bf6b 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -1010,6 +1010,61 @@ static const struct file_operations clock_tree_fops = {
.release = single_release,
};
+static void syncevent_one(struct clk *c)
+{
+ struct clk *child;
+
+ if (c->state == ON)
+ trace_clock_enable(c->name, 1, smp_processor_id());
+ else
+ trace_clock_disable(c->name, 0, smp_processor_id());
+
+ trace_clock_set_rate(c->name, clk_get_rate_all_locked(c),
+ smp_processor_id());
+
+ list_for_each_entry(child, &clocks, node) {
+ if (child->parent != c)
+ continue;
+
+ syncevent_one(child);
+ }
+}
+
+static int syncevent_write(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct clk *c;
+ char buffer[40];
+ int buf_size;
+
+ memset(buffer, 0, sizeof(buffer));
+ buf_size = min(count, (sizeof(buffer)-1));
+
+ if (copy_from_user(buffer, user_buf, buf_size))
+ return -EFAULT;
+
+ if (!strnicmp("all", buffer, 3)) {
+ mutex_lock(&clock_list_lock);
+
+ clk_lock_all();
+
+ list_for_each_entry(c, &clocks, node) {
+ if (c->parent == NULL)
+ syncevent_one(c);
+ }
+
+ clk_unlock_all();
+
+ mutex_unlock(&clock_list_lock);
+ }
+
+ return count;
+}
+
+static const struct file_operations syncevent_fops = {
+ .write = syncevent_write,
+};
+
static int possible_parents_show(struct seq_file *s, void *data)
{
struct clk *c = s->private;
@@ -1246,6 +1301,9 @@ static int __init clk_debugfs_init(void)
if (!d)
goto err_out;
+ d = debugfs_create_file("syncevents", S_IWUGO, clk_debugfs_root, NULL,
+ &syncevent_fops);
+
if (dvfs_debugfs_init(clk_debugfs_root))
goto err_out;