From 7a28547892bfa73d31c1423b33e98030840a4f6d Mon Sep 17 00:00:00 2001 From: Alex Frid Date: Tue, 8 May 2018 18:58:22 -0700 Subject: gpu: nvgpu: Fix Gpu sysfs access to Fmax@Vmin Currently gpu sysfs retrieves Fmax@Vmin by direct call into Tegra DVFS driver that introduces compile time dependencies on CONFIG_TEGRA_DVFS. In addition incorrect clock is used for DVFS information access. Re-factored sysfs node to use generic GPU clock operation for Fmax@Vmin read. This would fix a bug in target clock selection, and allows to remove dependency of sysfs on CONFIG_TEGRA_DVFS. Updated nvgpu_linux_get_fmax_at_vmin_safe operation itself so it can be called on platforms that does not support Tegra DVFS, although 0 will still be returned as Fmax@Vmin on such platforms. Bug 2045903 Change-Id: I32cce25320df026288c82458c913b0cde9ad4f72 Signed-off-by: Alex Frid Reviewed-on: https://git-master.nvidia.com/r/1710924 Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/clk.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/clk.c') diff --git a/drivers/gpu/nvgpu/common/linux/clk.c b/drivers/gpu/nvgpu/common/linux/clk.c index 8bffc07b..a0e56455 100644 --- a/drivers/gpu/nvgpu/common/linux/clk.c +++ b/drivers/gpu/nvgpu/common/linux/clk.c @@ -84,15 +84,18 @@ static int nvgpu_linux_clk_set_rate(struct gk20a *g, return ret; } -static unsigned long nvgpu_linux_get_fmax_at_vmin_safe(struct clk_gk20a *clk) +static unsigned long nvgpu_linux_get_fmax_at_vmin_safe(struct gk20a *g) { /* - * On Tegra GPU clock exposed to frequency governor is a shared user on - * GPCPLL bus (gbus). The latter can be accessed as GPU clock parent. - * Respectively the grandparent is PLL reference clock. + * On Tegra platforms with GPCPLL bus (gbus) GPU tegra_clk clock exposed + * to frequency governor is a shared user on the gbus. The latter can be + * accessed as GPU clock parent, and incorporate DVFS related data. */ - return tegra_dvfs_get_fmax_at_vmin_safe_t( - clk_get_parent(clk->tegra_clk)); + if (g->clk.tegra_clk) + return tegra_dvfs_get_fmax_at_vmin_safe_t( + clk_get_parent(g->clk.tegra_clk)); + + return 0; } static u32 nvgpu_linux_get_ref_clock_rate(struct gk20a *g) -- cgit v1.2.2