pass: gov: Add new 'limit_min_freq' property in 'Level' section
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 2 Feb 2017 10:18:42 +0000 (19:18 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 2 Feb 2017 23:43:19 +0000 (08:43 +0900)
This patch adds the new 'limit_min_freq' property in 'Level' section.
It means that if 'Level(x) section' contains the 'limit_min_freq' property,
the governor set the minimum frequency for DVFS h/w resource such as
cpu, memory bus and gpu.

Change-Id: I57f49ad47fa5ebf3e15aee24a448c2b47914779e
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-gov.c
src/pass/pass-parser.c
src/pass/pass.h

index b45ee03e7f07bbe291f017550df36505f416c5ba..2bb038b8f30f63b875ac20a0a97f77316a217149 100644 (file)
@@ -224,6 +224,7 @@ static int pass_governor_change_level(struct pass_policy *policy, int new_level)
        struct pass_hotplug *hotplug = policy->hotplug;
        int curr_level = policy->curr_level;
        int limit_max_freq;
+       int limit_min_freq;
        int limit_max_cpu;
        int online;
        int ret;
@@ -238,10 +239,11 @@ static int pass_governor_change_level(struct pass_policy *policy, int new_level)
                return 0;
 
        /*
-        * Get maximum CPU frequency/the maximum number of online CPU
+        * Get the max/min frequency and the number of max online
         * according to PASS level.
         */
        limit_max_freq = table[new_level].limit_max_freq;
+       limit_min_freq = table[new_level].limit_min_freq;
        limit_max_cpu = table[new_level].limit_max_cpu;
 
        policy->prev_level = policy->curr_level;
@@ -260,18 +262,32 @@ static int pass_governor_change_level(struct pass_policy *policy, int new_level)
                pass_hotplug_set_online(policy, online);
        }
 
-       /* Set maximum CPU frequency */
-       ret = pass_set_max_freq(pass_res, limit_max_freq);
-       if (ret < 0) {
-               _E("cannot set the maximum frequency of %s", cdata->res_name);
-               return -EINVAL;
+       /* Set maximum frequency */
+       if (limit_max_freq) {
+               ret = pass_set_max_freq(pass_res, limit_max_freq);
+               if (ret < 0) {
+                       _E("cannot set the maximum frequency of %s",
+                                               cdata->res_name);
+                       return -EINVAL;
+               }
+       }
+
+       /* Set minimum frequency */
+       if (limit_min_freq) {
+               ret = pass_set_min_freq(pass_res, limit_min_freq);
+               if (ret < 0) {
+                       _E("cannot set the minimum frequency of %s",
+                                               cdata->res_name);
+                       return -EINVAL;
+               }
        }
 
        /*
-       _I("[PASS %s] Level %4s '%d->%d' : '%d'Hz/'%d'Core\n",
+       _I("[PASS %s] Level %4s '%d->%d' : 'max %d | min %d'Hz/'%d'Core\n",
                pass_res->cdata.res_name,
                (curr_level > new_level ? "DOWN" : "UP"),
-               curr_level, new_level, limit_max_freq, limit_max_cpu);
+               curr_level, new_level,
+               limit_max_freq, limit_min_freq, limit_max_cpu);
        */
 
        return 0;
index 0a9f2304903f71745fa4f3f31dfef1d47f449b8b..b6500a3a4be96a0f8a6f3dbfa46555f31a36a108 100644 (file)
@@ -128,6 +128,8 @@ static int  pass_parse_level(struct parse_result *result,
 
        if (MATCH(result->name, "limit_max_freq"))
                policy->pass_table[level].limit_max_freq = atoi(result->value);
+       else if (MATCH(result->name, "limit_min_freq"))
+               policy->pass_table[level].limit_min_freq = atoi(result->value);
        else if (MATCH(result->name, "limit_max_cpu"))
                policy->pass_table[level].limit_max_cpu = atoi(result->value);
 
@@ -367,6 +369,10 @@ int pass_get_table(struct pass_policy *policy, char *pass_conf_path)
                        _I("%s| policy->pass_table[%d].limit_max_freq : %d\n",
                                pass_res->cdata.res_name, level,
                                policy->pass_table[level].limit_max_freq);
+               if (policy->pass_table[level].limit_min_freq)
+                       _I("%s| policy->pass_table[%d].limit_min_freq : %d\n",
+                               pass_res->cdata.res_name, level,
+                               policy->pass_table[level].limit_min_freq);
                if (policy->pass_table[level].limit_max_cpu)
                        _I("%s| policy->pass_table[%d].limit_max_cpu : %d\n",
                                pass_res->cdata.res_name, level,
index 9768392f93cb4ca11861049b11a28b87c2ba0960..7c7453625f8f57a003f66915a765ac69b326accf 100644 (file)
@@ -136,6 +136,7 @@ struct pass_level_condition {
 struct pass_table {
        /* Constraints condition for powersaving */
        int limit_max_freq;
+       int limit_min_freq;
        int limit_max_cpu;
 
        /* Governor timer's timeout for each pass level */