pass-hal: tw3: Change sysfs node to control min/max frequency of CPU 01/240201/1 accepted/tizen/unified/20200810.123007 submit/tizen/20200810.073747
authorChanwoo Choi <cw00.choi@samsung.com>
Tue, 4 Aug 2020 09:46:31 +0000 (18:46 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 4 Aug 2020 09:46:31 +0000 (18:46 +0900)
When change the maximum cpu frequency with node[1], it doesnt' change
the value of /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq.
[1] /sys/devices/system/cpu/cpufreq/pmqos/cpufreq_max

So, change the sysfs node to control min/max cpu frequency with following
nodes:
- /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
- /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq

Change-Id: I3ec88b554e2450ef475cfbb6b910679041b5fb47
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
scripts/pass-hal.conf
src/cpu/cpu.c

index 445ba84..803a884 100644 (file)
@@ -2,6 +2,10 @@ z      /sys/devices/system/cpu/cpufreq/pmqos/* 0660    root    system_fw       -
 t      /sys/devices/system/cpu/cpufreq/pmqos/* -       -       -       -       security.SMACK64="System::Shared"
 z      /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq   0440    root    system_fw       -
 t      /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq   -       -       -       -       security.SMACK64="System::Shared"
+z      /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq   0660    root    system_fw       -
+t      /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq   -       -       -       -       security.SMACK64="System::Shared"
+z      /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq   0660    root    system_fw       -
+t      /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq   -       -       -       -       security.SMACK64="System::Shared"
 z      /sys/class/sec/temperature/*    0440    root    system_fw       -
 t      /sys/class/sec/temperature/*    -       -       -       -       security.SMACK64="System::Shared"
 z      /sys/kernel/debug/fault_around_bytes    0660    root    system_fw       -
index 3eea31d..169ce13 100644 (file)
 
 #include "../shared/sysfs.h"
 
+#define CPUFREQ_PATH_PREFIX                    "/sys/devices/system/cpu/"
 #define CPUFREQ_PMQOS_PATH_PREFIX              "/sys/devices/system/cpu/cpufreq/pmqos"
 #define CPUFREQ_PATH_PREFIX                    "/sys/devices/system/cpu/"
 #define TMU_PATH_PREFIX                                "/sys/class/sec/temperature/"
 
 #define CPUFREQ_CPU_ONLINE_MIN_NUM_PATH_SUFFIX "/cpu_online_min"
 #define CPUFREQ_CPU_ONLINE_MAX_NUM_PATH_SUFFIX "/cpu_online_max"
-#define CPUFREQ_MAX_FREQ_PATH_SUFFIX           "/cpufreq_max"
-#define CPUFREQ_MIN_FREQ_PATH_SUFFIX           "/cpufreq_min"
+#define CPUFREQ_MAX_FREQ_PATH_SUFFIX           "/cpufreq/scaling_max_freq"
+#define CPUFREQ_MIN_FREQ_PATH_SUFFIX           "/cpufreq/scaling_min_freq"
 #define CPUFREQ_CURR_FREQ_PATH_SUFFIX          "/cpufreq/cpuinfo_cur_freq"
 
 #define CPUFREQ_DEFAULT_MIN_FREQ               0
@@ -71,9 +72,10 @@ static int tw3_dvfs_get_min_freq(char *res_name)
        if (!res_name)
                return -EINVAL;
 
-       snprintf(path, PATH_MAX, "%s%s",
-                CPUFREQ_PMQOS_PATH_PREFIX,
-                CPUFREQ_MIN_FREQ_PATH_SUFFIX);
+       snprintf(path, PATH_MAX, "%s%s%s",
+               CPUFREQ_PATH_PREFIX,
+               res_name,
+               CPUFREQ_MIN_FREQ_PATH_SUFFIX);
 
        ret = sysfs_read_int(path, &min_freq);
        if (ret < 0)
@@ -90,8 +92,9 @@ static int tw3_dvfs_set_min_freq(char *res_name, int freq)
        if (!res_name)
                return -EINVAL;
 
-       ret = snprintf(path, PATH_MAX, "%s%s",
-               CPUFREQ_PMQOS_PATH_PREFIX,
+       snprintf(path, PATH_MAX, "%s%s%s",
+               CPUFREQ_PATH_PREFIX,
+               res_name,
                CPUFREQ_MIN_FREQ_PATH_SUFFIX);
 
        ret = sysfs_write_int(path, freq);
@@ -110,8 +113,9 @@ static int tw3_dvfs_get_max_freq(char *res_name)
        if (!res_name)
                return -EINVAL;
 
-       snprintf(path, PATH_MAX, "%s%s",
-                CPUFREQ_PMQOS_PATH_PREFIX,
+       snprintf(path, PATH_MAX, "%s%s%s",
+                CPUFREQ_PATH_PREFIX,
+                res_name,
                 CPUFREQ_MAX_FREQ_PATH_SUFFIX);
 
        ret = sysfs_read_int(path, &max_freq);
@@ -129,8 +133,9 @@ static int tw3_dvfs_set_max_freq(char *res_name, int freq)
        if (!res_name)
                return -EINVAL;
 
-       snprintf(path, PATH_MAX, "%s%s",
-               CPUFREQ_PMQOS_PATH_PREFIX,
+       snprintf(path, PATH_MAX, "%s%s%s",
+               CPUFREQ_PATH_PREFIX,
+               res_name,
                CPUFREQ_MAX_FREQ_PATH_SUFFIX);
 
        ret = sysfs_write_int(path, freq);