gpu: nvgpu: store last_freq in gk20a struct

In gk20a_scale_target(), to check for duplicate
freq requests we compare current frequency with
devfreq->previous_freq

But for very first request after boot, we have
devfreq->previous_freq set to MIN freq

And in case we evaluate new frew as MIN freq
then we skip calling postscale() and scaling
of EMC clock
This results in keeping EMC at MAX value

To fix this, add new variable last_freq in
gk20a structure.
Use this variable to store frequency value
and to compare for duplicate requests

Bug 200255163
Bug 200257544

Change-Id: Icfc57234c63f68cce8ccf8221237105272dad853
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1263747
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2016-12-06 20:59:58 +05:30
committed by mobile promotions
parent 866dafa484
commit 02b8cda953
2 changed files with 5 additions and 1 deletions

View File

@@ -950,6 +950,7 @@ struct gk20a {
struct devfreq *devfreq; struct devfreq *devfreq;
struct gk20a_scale_profile *scale_profile; struct gk20a_scale_profile *scale_profile;
unsigned long last_freq;
struct gk20a_ctxsw_trace *ctxsw_trace; struct gk20a_ctxsw_trace *ctxsw_trace;
struct gk20a_fecs_trace *fecs_trace; struct gk20a_fecs_trace *fecs_trace;

View File

@@ -182,7 +182,7 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq,
local_freq = max_freq; local_freq = max_freq;
/* Check for duplicate request */ /* Check for duplicate request */
if (local_freq == g->devfreq->previous_freq) if (local_freq == g->last_freq)
return 0; return 0;
/* set the final frequency */ /* set the final frequency */
@@ -195,6 +195,8 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq,
*freq = platform->clk_get_rate(dev); *freq = platform->clk_get_rate(dev);
} }
g->last_freq = *freq;
/* postscale will only scale emc (dram clock) if evaluating /* postscale will only scale emc (dram clock) if evaluating
* gk20a_tegra_get_emc_rate() produces a new or different emc * gk20a_tegra_get_emc_rate() produces a new or different emc
* target because the load or_and gpufreq has changed */ * target because the load or_and gpufreq has changed */
@@ -259,6 +261,7 @@ void gk20a_scale_resume(struct device *dev)
if (!devfreq) if (!devfreq)
return; return;
g->last_freq = 0;
devfreq_resume_device(devfreq); devfreq_resume_device(devfreq);
} }