From 5d4ba0a6d8cf3d45c948b620e691a80921ad61a5 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 14 Dec 2016 15:01:51 +0530 Subject: gpu: nvgpu: round clock locally In gp10b_round_clk_rate(), we currently call clk_round_rate() to round the clock rate for us But since the frequency table is prepared using the frequency values supported in h/w, we can round the rate locally using the table Bug 1827281 Change-Id: I85d034326539590352badceb4164aa5d89ee8842 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1280630 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c') diff --git a/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c index 5e5c7703..9fabe1f5 100644 --- a/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c @@ -328,9 +328,17 @@ static unsigned long gp10b_get_clk_rate(struct device *dev) static long gp10b_round_clk_rate(struct device *dev, unsigned long rate) { - struct gk20a_platform *platform = gk20a_get_platform(dev); + struct gk20a *g = get_gk20a(dev); + struct gk20a_scale_profile *profile = g->scale_profile; + unsigned long *freq_table = profile->devfreq_profile.freq_table; + int max_states = profile->devfreq_profile.max_state; + int i; + + for (i = 0; i < max_states; ++i) + if (freq_table[i] > rate) + return freq_table[i]; - return clk_round_rate(platform->clk[0], rate); + return freq_table[max_states - 1]; } static int gp10b_set_clk_rate(struct device *dev, unsigned long rate) -- cgit v1.2.2