From b972f8d15eca74d91b932f16b09aacb893e110a8 Mon Sep 17 00:00:00 2001 From: Alex Frid Date: Tue, 22 Jul 2014 18:28:43 -0700 Subject: gpu: nvgpu: Init clock debugfs after clock support Initialized GK20A clock debugfs after clock support hardware and software are ready. Bug 1450787 Change-Id: I8ec2ef303a84b9151b7ce209a1864f1729382a44 Signed-off-by: Alex Frid Reviewed-on: http://git-master/r/440973 Reviewed-by: Yu-Huan Hsu --- drivers/gpu/nvgpu/gk20a/clk_gk20a.c | 15 ++++++++++++--- drivers/gpu/nvgpu/gk20a/clk_gk20a.h | 1 + drivers/gpu/nvgpu/gk20a/gk20a.c | 2 -- drivers/gpu/nvgpu/gk20a/gk20a.h | 4 ---- 4 files changed, 13 insertions(+), 9 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gk20a/clk_gk20a.c b/drivers/gpu/nvgpu/gk20a/clk_gk20a.c index abb9e98a..30f2b4ed 100644 --- a/drivers/gpu/nvgpu/gk20a/clk_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/clk_gk20a.c @@ -42,6 +42,10 @@ struct pll_parms gpc_pll_params = { 1, 32, /* PL */ }; +#ifdef CONFIG_DEBUG_FS +static int clk_gk20a_debugfs_init(struct gk20a *g); +#endif + static u8 pl_to_div[] = { /* PL: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 */ /* p: */ 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 12, 16, 20, 24, 32 }; @@ -661,6 +665,12 @@ int gk20a_init_clk_support(struct gk20a *g) if (err) return err; +#ifdef CONFIG_DEBUG_FS + if (!clk->debugfs_set) { + if (!clk_gk20a_debugfs_init(g)) + clk->debugfs_set = true; + } +#endif return err; } @@ -800,11 +810,10 @@ static int monitor_get(void *data, u64 *val) } DEFINE_SIMPLE_ATTRIBUTE(monitor_fops, monitor_get, NULL, "%llu\n"); -int clk_gk20a_debugfs_init(struct platform_device *dev) +static int clk_gk20a_debugfs_init(struct gk20a *g) { struct dentry *d; - struct gk20a_platform *platform = platform_get_drvdata(dev); - struct gk20a *g = get_gk20a(dev); + struct gk20a_platform *platform = platform_get_drvdata(g->dev); d = debugfs_create_file( "rate", S_IRUGO|S_IWUSR, platform->debugfs, g, &rate_fops); diff --git a/drivers/gpu/nvgpu/gk20a/clk_gk20a.h b/drivers/gpu/nvgpu/gk20a/clk_gk20a.h index f6cdd272..950034a4 100644 --- a/drivers/gpu/nvgpu/gk20a/clk_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/clk_gk20a.h @@ -56,6 +56,7 @@ struct clk_gk20a { struct mutex clk_mutex; bool sw_ready; bool clk_hw_on; + bool debugfs_set; }; int gk20a_init_clk_support(struct gk20a *g); diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index b0aef022..fb4e0886 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -1502,8 +1502,6 @@ static int gk20a_probe(struct platform_device *dev) gk20a_create_sysfs(dev); #ifdef CONFIG_DEBUG_FS - clk_gk20a_debugfs_init(dev); - spin_lock_init(&gk20a->debugfs_lock); gk20a->mm.ltc_enabled = true; gk20a->mm.ltc_enabled_debug = true; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 0b91420b..57cc338c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -591,10 +591,6 @@ static inline int support_gk20a_pmu(void){return 0;} void gk20a_create_sysfs(struct platform_device *dev); -#ifdef CONFIG_DEBUG_FS -int clk_gk20a_debugfs_init(struct platform_device *dev); -#endif - #define GK20A_BAR0_IORESOURCE_MEM 0 #define GK20A_BAR1_IORESOURCE_MEM 1 #define GK20A_SIM_IORESOURCE_MEM 2 -- cgit v1.2.2