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 <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1280630
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Deepak Nibade
2016-12-14 15:01:51 +05:30
committed by mobile promotions
parent b5c6aebe7a
commit 5d4ba0a6d8

View File

@@ -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;
return clk_round_rate(platform->clk[0], rate);
for (i = 0; i < max_states; ++i)
if (freq_table[i] > rate)
return freq_table[i];
return freq_table[max_states - 1];
}
static int gp10b_set_clk_rate(struct device *dev, unsigned long rate)