gpu: reset keep_count when loading shake[2/3]
authorJiyu Yang <Jiyu.Yang@amlogic.com>
Wed, 23 Oct 2019 17:10:38 +0000 (01:10 +0800)
committerJiyu Yang <jiyu.yang@amlogic.com>
Thu, 24 Oct 2019 09:20:31 +0000 (17:20 +0800)
PD#SWPL-15215

Problem:
preheat clk usually set before utilization is zero, which lead
stay_count go down from zero.

Solution:
1. reset stay_count when utilization in threshold
2. reset stay_count when preheat

Verify:
newton_BCM

Change-Id: Ia697fe129189c9481b5ec6180c65911866ed1a8d
Signed-off-by: Jiyu Yang <jiyu.yang@amlogic.com>
dvalin/kernel/drivers/gpu/arm/midgard/platform/devicetree/scaling.c

index 081a97b07a9555ec77a9354a0e42fdde941610ad..eafa237523cbc4abad28bfcb8eb0d6f2ba35f44a 100644 (file)
@@ -64,6 +64,7 @@ MODULE_PARM_DESC(scaling_dbg_level , "scaling debug level");
        } while (0)
 
 #ifndef CONFIG_MALI_DVFS
+static int mali_stay_count = 0;
 static inline void mali_clk_exected(void)
 {
        mali_dvfs_threshold_table * pdvfs = pmali_plat->dvfs_table;
@@ -219,6 +220,10 @@ u32 set_mali_rt_clkpp(u32 clk, u32 pp, u32 flush)
                else
                        ret = 1;
        }
+
+       if (flush)
+               mali_stay_count = pmali_plat->dvfs_table[currentStep].keep_count;
+
        if (pp < pinfo->minpp)
                pp = pinfo->minpp;
        else if (pp > pinfo->maxpp)
@@ -363,7 +368,6 @@ void trace_utilization(int utilization_gpu, u32 current_idx, u32 next,
 #endif
 
 #ifndef CONFIG_MALI_DVFS
-static int mali_stay_count = 0;
 static void mali_decide_next_status(int utilization_pp, int* next_fs_idx,
                int* pp_change_flag)
 {
@@ -448,6 +452,10 @@ static void mali_decide_next_status(int utilization_pp, int* next_fs_idx,
                } else if (change_mode == 2) { /* decrease PPS */
                        *pp_change_flag = -1;
                }
+       } else {
+               mali_stay_count = pmali_plat->dvfs_table[currentStep].keep_count;
+               scalingdbg(1, "reset to %d, decided_fs_idx=%d, mali_stay_count=%d\n",
+                               currentStep, decided_fs_idx, mali_stay_count);
        }
 
        if (decided_fs_idx < 0 ) {
@@ -463,6 +471,7 @@ static void mali_decide_next_status(int utilization_pp, int* next_fs_idx,
                mali_stay_count = pmali_plat->dvfs_table[decided_fs_idx].keep_count;
 
        *next_fs_idx = decided_fs_idx;
+       scalingdbg(1, "mali_stay_count=%d\n", mali_stay_count);
 }
 #endif