From b69d69ec4d3cb1bf783b6c169dc230f2401bf756 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 16 Mar 2016 15:52:20 +0530 Subject: [PATCH] devfreq: compare previous_freq only if podgov disabled In update_devfreq(), we currently get target frequency, compare it with previous_freq, and set it only if new freq is different one But get_target_freq() (nvhost_pod_estimate_freq()) already takes care of such cases in normal conditions Hence, remove the check with previous_freq in update_devfreq() For case when we disable podgov governor, we might still end up setting max freq all the time Hence, add a check on previous_freq, and if previous_freq is already max, do not set it Bug 200175874 Bug 200161377 Change-Id: I287d37c07ee6214ed48612482211ce0f45088ca4 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1111437 Reviewed-on: http://git-master/r/1113417 (cherry picked from linux-4.9 commit 9c424ce31bedac5db0c2d93e083f20ea89ed1836) Reviewed-on: https://git-master.nvidia.com/r/1770136 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/governor_pod_scaling.c b/drivers/devfreq/governor_pod_scaling.c index 472647a1..611cd923 100644 --- a/drivers/devfreq/governor_pod_scaling.c +++ b/drivers/devfreq/governor_pod_scaling.c @@ -3,7 +3,7 @@ * * Tegra Graphics Host 3D clock scaling * - * Copyright (c) 2012-2015, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2012-2016, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -732,7 +732,10 @@ static int nvhost_pod_estimate_freq(struct devfreq *df, /* Ensure maximal clock when scaling is disabled */ if (!podgov->enable) { *freq = df->max_freq; - return 0; + if (*freq == df->previous_freq) + return GET_TARGET_FREQ_DONTSCALE; + else + return 0; } if (podgov->p_user) {