diff options
author | Alex Frid <afrid@nvidia.com> | 2011-01-22 17:05:01 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:42:14 -0800 |
commit | 3fb18998c16204fd5fb1c63d4d43f55bf35e29dc (patch) | |
tree | 24fe96356e000356ba30dd0d36cff2e8ced50c47 /arch/arm/mach-tegra/clock.c | |
parent | c00e431f2dcc108084381b9afb37567cd734ccaa (diff) |
ARM: tegra: clock: Add clock state debugfs control
Original-Change-Id: I2a16c36c8ee414a1f046eda2f3bdb9c1d71caf8b
Reviewed-on: http://git-master/r/16657
Tested-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Original-Change-Id: Icc4b526f44697bd788d83434f6e9a62de005b09c
Rebase-Id: R34e12f5fbafa93a8f01cd00d83a33b356d0782ec
Diffstat (limited to 'arch/arm/mach-tegra/clock.c')
-rw-r--r-- | arch/arm/mach-tegra/clock.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index e4b3679029b1..9129fa19408f 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -835,6 +835,13 @@ static int rate_get(void *data, u64 *val) return 0; } +static int state_get(void *data, u64 *val) +{ + struct clk *c = (struct clk *)data; + *val = (u64)((c->state == ON) ? 1 : 0); + return 0; +} + #ifdef CONFIG_TEGRA_CLOCK_DEBUG_WRITE static const mode_t parent_rate_mode = S_IRUGO | S_IWUGO; @@ -882,6 +889,19 @@ static int rate_set(void *data, u64 val) } DEFINE_SIMPLE_ATTRIBUTE(rate_fops, rate_get, rate_set, "%llu\n"); +static int state_set(void *data, u64 val) +{ + struct clk *c = (struct clk *)data; + + if (val) + return clk_enable(c); + else { + clk_disable(c); + return 0; + } +} +DEFINE_SIMPLE_ATTRIBUTE(state_fops, state_get, state_set, "%llu\n"); + #else static const mode_t parent_rate_mode = S_IRUGO; @@ -894,6 +914,7 @@ static const struct file_operations parent_fops = { }; DEFINE_SIMPLE_ATTRIBUTE(rate_fops, rate_get, NULL, "%llu\n"); +DEFINE_SIMPLE_ATTRIBUTE(state_fops, state_get, NULL, "%llu\n"); #endif static int clk_debugfs_register_one(struct clk *c) @@ -927,6 +948,11 @@ static int clk_debugfs_register_one(struct clk *c) if (!d) goto err_out; + d = debugfs_create_file( + "state", parent_rate_mode, c->dent, c, &state_fops); + if (!d) + goto err_out; + if (c->inputs) { d = debugfs_create_file("possible_parents", S_IRUGO, c->dent, c, &possible_parents_fops); |