From 625f652f8966c3f1363234925f6ff3d7d56a18d7 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 29 Nov 2016 14:03:25 +0530 Subject: [PATCH] devfreq: set current freq in case no change required API scaling_state_check() returns 0 in case no change in frequency is required In nvhost_pod_estimate_freq(), we set *freq to 0 in case scaling_state_check() returns 0 And as a result of this, update_devfreq() will just keep setting minimum frequency instead of keeping same frequency - and this results in huge performance degradation To fix this, set *freq to current frequency in case scaling_state_check() returns 0 as estimated frequency Bug 200255163 Change-Id: Ia8fe54dfd48b0898cc1dd53d821b1c95865b1f57 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1261281 (cherry picked from linux-4.9 commit 624718566201ce9c0b9780be6f29dc2ae9082b09) Reviewed-on: https://git-master.nvidia.com/r/1770146 Reviewed-by: Mikko Perttunen GVS: Gerrit_Virtual_Submit Reviewed-by: Timo Alho Tested-by: Timo Alho Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/devfreq/governor_pod_scaling.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/governor_pod_scaling.c b/drivers/devfreq/governor_pod_scaling.c index 3ffaeb78..cca36999 100644 --- a/drivers/devfreq/governor_pod_scaling.c +++ b/drivers/devfreq/governor_pod_scaling.c @@ -799,8 +799,10 @@ static int nvhost_pod_estimate_freq(struct devfreq *df, msecs_to_jiffies(podgov->p_slowdown_delay)); } - if (!(*freq) || - (freqlist_up(podgov, *freq, 0) == dev_stat.current_frequency)) + if (!(*freq)) + *freq = dev_stat.current_frequency; + + if (freqlist_up(podgov, *freq, 0) == dev_stat.current_frequency) return 0; podgov->last_scale = now;