diff options
author | Alex Frid <afrid@nvidia.com> | 2013-09-25 21:37:57 -0700 |
---|---|---|
committer | Ajay Nandakumar <anandakumarm@nvidia.com> | 2013-10-03 19:17:37 +0530 |
commit | 8bbfbe8d9554a6b2c21d49a54e6a7dbe3d8eed4a (patch) | |
tree | 127ccc5a009ac35bd17bf7ccaec78726529c4f84 /arch/arm/mach-tegra/dvfs.c | |
parent | 14e8e3bd4fa4b12029072cc0547d11938bd534a9 (diff) |
ARM: tegra: dvfs: Add GPU thermal dvfs table to debugfs
Bug 1273253
Change-Id: I4434f39434d505a1601b5f9275588b822302a937
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/279198
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
(cherry picked from commit 010f3fc5eb62ce35ad5d7c3ef191736d6d4afc55)
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/dvfs.c')
-rw-r--r-- | arch/arm/mach-tegra/dvfs.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/dvfs.c b/arch/arm/mach-tegra/dvfs.c index 4ed08e3f5136..e37048461780 100644 --- a/arch/arm/mach-tegra/dvfs.c +++ b/arch/arm/mach-tegra/dvfs.c @@ -1841,6 +1841,70 @@ 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 gpu_dvfs_t_show(struct seq_file *s, void *data) +{ + int i, j; + int num_ranges = 1; + int *trips = NULL; + struct dvfs *d; + struct dvfs_rail *rail = tegra_gpu_rail; + + if (!tegra_gpu_rail) { + seq_printf(s, "Only supported for T124 or higher\n"); + return -ENOSYS; + } + + mutex_lock(&dvfs_lock); + + d = list_first_entry(&rail->dvfs, struct dvfs, reg_node); + if (rail->vts_cdev && d->therm_dvfs) { + num_ranges = rail->vts_cdev->trip_temperatures_num + 1; + trips = rail->vts_cdev->trip_temperatures; + } + + seq_printf(s, "%-11s", "T(C)\\F(kHz)"); + for (i = 0; i < d->num_freqs; i++) { + unsigned int f = d->freqs[i]/100; + seq_printf(s, " %7u", f); + } + seq_printf(s, "\n"); + + for (j = 0; j < num_ranges; j++) { + seq_printf(s, "%s", j == rail->therm_scale_idx ? ">" : " "); + + if (!trips || (num_ranges == 1)) + seq_printf(s, "%4s..%-4s", "", ""); + else if (j == 0) + seq_printf(s, "%4s..%-4d", "", trips[j]); + else if (j == num_ranges - 1) + seq_printf(s, "%4d..%-4s", trips[j], ""); + else + seq_printf(s, "%4d..%-4d", trips[j-1], trips[j]); + + for (i = 0; i < d->num_freqs; i++) { + int mv = *(d->millivolts + j * MAX_DVFS_FREQS + i); + seq_printf(s, " %7d", mv); + } + seq_printf(s, " mV\n"); + } + + mutex_unlock(&dvfs_lock); + + return 0; +} + +static int gpu_dvfs_t_open(struct inode *inode, struct file *file) +{ + return single_open(file, gpu_dvfs_t_show, NULL); +} + +static const struct file_operations gpu_dvfs_t_fops = { + .open = gpu_dvfs_t_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static int dvfs_table_show(struct seq_file *s, void *data) { int i; @@ -1940,6 +2004,11 @@ int __init dvfs_debugfs_init(struct dentry *clk_debugfs_root) if (!d) return -ENOMEM; + d = debugfs_create_file("gpu_dvfs_t", S_IRUGO | S_IWUSR, + clk_debugfs_root, NULL, &gpu_dvfs_t_fops); + if (!d) + return -ENOMEM; + d = debugfs_create_file("dvfs_table", S_IRUGO, clk_debugfs_root, NULL, &dvfs_table_fops); if (!d) |