diff options
author | Alex Frid <afrid@nvidia.com> | 2012-01-06 22:33:49 -0800 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-01-16 09:05:13 -0800 |
commit | 0dce7213008f114fc17f183f11b3cf19f270edac (patch) | |
tree | db7485dcdb7917ea66b02bd104dc864671b470b2 /arch/arm/mach-tegra/clock.c | |
parent | 6759a2fd2b74e7548d65eb23510568e9b2ec3552 (diff) |
ARM: tegra: clock: Expand shared bus debugfs entries
Added possible rates debugfs entries for shared buses.
Change-Id: Ibe2ae38b1667599988397633d03ece534f840a31
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/73895
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Tested-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/75148
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/clock.c')
-rw-r--r-- | arch/arm/mach-tegra/clock.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index ec483c840672..434e010ddbef 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -1242,6 +1242,36 @@ static int time_on_get(void *data, u64 *val) } DEFINE_SIMPLE_ATTRIBUTE(time_on_fops, time_on_get, NULL, "%llu\n"); +static int possible_rates_show(struct seq_file *s, void *data) +{ + struct clk *c = s->private; + long rate = 0; + + /* shared bus clock must round up, unless top of range reached */ + while (rate <= c->max_rate) { + long rounded_rate = c->ops->round_rate(c, rate); + if (IS_ERR_VALUE(rounded_rate) || (rounded_rate <= rate)) + break; + + rate = rounded_rate + 2000; /* 2kHz resolution */ + seq_printf(s, "%ld ", rounded_rate / 1000); + } + seq_printf(s, "(kHz)\n"); + return 0; +} + +static int possible_rates_open(struct inode *inode, struct file *file) +{ + return single_open(file, possible_rates_show, inode->i_private); +} + +static const struct file_operations possible_rates_fops = { + .open = possible_rates_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static int clk_debugfs_register_one(struct clk *c) { struct dentry *d; @@ -1290,6 +1320,13 @@ static int clk_debugfs_register_one(struct clk *c) goto err_out; } + if (c->ops && c->ops->round_rate && c->ops->shared_bus_update) { + d = debugfs_create_file("possible_rates", S_IRUGO, c->dent, + c, &possible_rates_fops); + if (!d) + goto err_out; + } + return 0; err_out: |