From 9c0c4dcf3f648509e10640a02efb35f8d0ffe074 Mon Sep 17 00:00:00 2001 From: Mahantesh Kumbar Date: Tue, 15 Nov 2016 17:23:12 +0530 Subject: gpu: nvgpu: Added lpwr_debug debugfs node - lpwr_debug node to dump current pstate & PG status. JIRA DNVGPU-165 Change-Id: I8240aea7145c3016946f4322fe0781d78ee2ec73 Signed-off-by: Mahantesh Kumbar Reviewed-on: http://git-master/r/1253509 (cherry picked from commit 4852997df5b89aeb8544ed9092ccc9ee8b8c375e) Reviewed-on: http://git-master/r/1271618 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index 11baa7af..9e722889 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c @@ -5272,6 +5272,49 @@ int gk20a_aelpg_init_and_enable(struct gk20a *g, u8 ctrl_id) } #ifdef CONFIG_DEBUG_FS +static int lpwr_debug_show(struct seq_file *s, void *data) +{ + struct gk20a *g = s->private; + + if (g->ops.pmu.pmu_pg_engines_feature_list && + g->ops.pmu.pmu_pg_engines_feature_list(g, + PMU_PG_ELPG_ENGINE_ID_GRAPHICS) != + PMU_PG_FEATURE_GR_POWER_GATING_ENABLED) { + seq_printf(s, "PSTATE: %u\n" + "RPPG Enabled: %u\n" + "RPPG ref count: %u\n" + "RPPG state: %u\n" + "MSCG Enabled: %u\n" + "MSCG pstate state: %u\n" + "MSCG transition state: %u\n", + g->ops.clk_arb.get_current_pstate(g), + g->elpg_enabled, g->pmu.elpg_refcnt, + g->pmu.elpg_stat, g->mscg_enabled, + g->pmu.mscg_stat, g->pmu.mscg_transition_state); + + } else + seq_printf(s, "ELPG Enabled: %u\n" + "ELPG ref count: %u\n" + "ELPG state: %u\n", + g->elpg_enabled, g->pmu.elpg_refcnt, + g->pmu.elpg_stat); + + return 0; + +} + +static int lpwr_debug_open(struct inode *inode, struct file *file) +{ + return single_open(file, lpwr_debug_show, inode->i_private); +} + +static const struct file_operations lpwr_debug_fops = { + .open = lpwr_debug_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + static int mscg_stat_show(struct seq_file *s, void *data) { struct gk20a *g = s->private; @@ -5613,6 +5656,12 @@ int gk20a_pmu_debugfs_init(struct device *dev) struct gk20a_platform *platform = dev_get_drvdata(dev); struct gk20a *g = get_gk20a(dev); + d = debugfs_create_file( + "lpwr_debug", S_IRUGO|S_IWUSR, platform->debugfs, g, + &lpwr_debug_fops); + if (!d) + goto err_out; + d = debugfs_create_file( "mscg_residency", S_IRUGO|S_IWUSR, platform->debugfs, g, &mscg_stat_fops); -- cgit v1.2.2