diff options
author | Alex Frid <afrid@nvidia.com> | 2013-10-01 20:55:56 -0700 |
---|---|---|
committer | Harry Hong <hhong@nvidia.com> | 2014-01-27 21:45:06 -0800 |
commit | 5bc2c17e236a36bc1812fe9e56bb55e3999dd9c2 (patch) | |
tree | 8452538bd015be9bedfb9d9b1e8c50d60ecf712c /arch | |
parent | e3a14401d49cfd75f752c49115903eecd720cac5 (diff) |
ARM: tegra: dvfs: Add dvfs table nodes to debugfs
Reviewed-on: http://git-master/r/281633
(cherry picked from commit ded9998ea6e78a3fc2b5be4c12bdb716a0612089)
Reviewed-on: http://git-master/r/348349
(cherry picked from commit 0e1f1108a562be22d41e5c1b19ace29d7696461c)
Signed-off-by: Alex Frid <afrid@nvidia.com>
Change-Id: I94eef4ca0f1610975ae5742ce6d64e05ff76cb1d
Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-on: http://git-master/r/356519
Reviewed-by: Harry Hong <hhong@nvidia.com>
Tested-by: Harry Hong <hhong@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/dvfs.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/dvfs.c b/arch/arm/mach-tegra/dvfs.c index b3bc0c5a43a5..02d0dc9956cd 100644 --- a/arch/arm/mach-tegra/dvfs.c +++ b/arch/arm/mach-tegra/dvfs.c @@ -1393,6 +1393,74 @@ static int core_override_set(void *data, u64 val) DEFINE_SIMPLE_ATTRIBUTE(core_override_fops, core_override_get, core_override_set, "%llu\n"); +static int dvfs_table_show(struct seq_file *s, void *data) +{ + int i; + struct dvfs *d; + struct dvfs_rail *rail; + const int *v_pll, *last_v_pll = NULL; + const int *v_dfll, *last_v_dfll = NULL; + + seq_printf(s, "DVFS tables: units mV/MHz\n"); + + mutex_lock(&dvfs_lock); + + list_for_each_entry(rail, &dvfs_rail_list, node) { + list_for_each_entry(d, &rail->dvfs, reg_node) { + bool mv_done = false; + v_pll = d->millivolts; + v_dfll = d->dfll_millivolts; + + if (v_pll && (last_v_pll != v_pll)) { + if (!mv_done) { + seq_printf(s, "\n"); + mv_done = true; + } + last_v_pll = v_pll; + seq_printf(s, "%-16s", rail->reg_id); + for (i = 0; i < d->num_freqs; i++) + seq_printf(s, "%7d", v_pll[i]); + seq_printf(s, "\n"); + } + + if (v_dfll && (last_v_dfll != v_dfll)) { + if (!mv_done) { + seq_printf(s, "\n"); + mv_done = true; + } + last_v_dfll = v_dfll; + seq_printf(s, "%-8s (dfll) ", rail->reg_id); + for (i = 0; i < d->num_freqs; i++) + seq_printf(s, "%7d", v_dfll[i]); + seq_printf(s, "\n"); + } + + seq_printf(s, "%-16s", d->clk_name); + for (i = 0; i < d->num_freqs; i++) { + unsigned int f = d->freqs[i]/100000; + seq_printf(s, " %4u.%u", f/10, f%10); + } + seq_printf(s, "\n"); + } + } + + mutex_unlock(&dvfs_lock); + + return 0; +} + +static int dvfs_table_open(struct inode *inode, struct file *file) +{ + return single_open(file, dvfs_table_show, inode->i_private); +} + +static const struct file_operations dvfs_table_fops = { + .open = dvfs_table_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + int __init dvfs_debugfs_init(struct dentry *clk_debugfs_root) { struct dentry *d; @@ -1422,6 +1490,11 @@ int __init dvfs_debugfs_init(struct dentry *clk_debugfs_root) if (!d) return -ENOMEM; + d = debugfs_create_file("dvfs_table", S_IRUGO, clk_debugfs_root, NULL, + &dvfs_table_fops); + if (!d) + return -ENOMEM; + return 0; } |