From 02b8cda953f7ff0cc9750b79b62712609da9d6ad Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 6 Dec 2016 20:59:58 +0530 Subject: 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 Reviewed-on: http://git-master/r/1263747 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gk20a_scale.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_scale.c') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c index e3b21c5a..dbc2f06c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c @@ -182,7 +182,7 @@ static int gk20a_scale_target(struct device *dev, unsigned long *freq, local_freq = max_freq; /* Check for duplicate request */ - if (local_freq == g->devfreq->previous_freq) + if (local_freq == g->last_freq) return 0; /* 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); } + g->last_freq = *freq; + /* postscale will only scale emc (dram clock) if evaluating * gk20a_tegra_get_emc_rate() produces a new or different emc * target because the load or_and gpufreq has changed */ @@ -259,6 +261,7 @@ void gk20a_scale_resume(struct device *dev) if (!devfreq) return; + g->last_freq = 0; devfreq_resume_device(devfreq); } -- cgit v1.2.2