From e64bfcb2a383029a6c732835c3be5798967e1ab3 Mon Sep 17 00:00:00 2001 From: Wook Song Date: Thu, 22 Jun 2017 14:43:34 +0900 Subject: [PATCH 01/16] pass-hal: tm2: packaging: Fix bug in applying systemd-tmpfiles This patch changes the path which systemd-tmpfiles uses in %post from /usr/lib to %{_libdir}. Since the defualt path for the libraries is /usr/lib64 for aarch64, the daemon does not work properly with the hard-coded path used before. Change-Id: If18c89efe327ec2afc8ee3d974af269dadf56837 Signed-off-by: Wook Song --- packaging/pass-hal-tm2.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index fe46ef7..374a548 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -38,7 +38,7 @@ rm -rf %{buildroot} %post /sbin/ldconfig -systemd-tmpfiles /usr/lib/tmpfiles.d/pass-hal.conf --create +systemd-tmpfiles %{_libdir}/tmpfiles.d/pass-hal.conf --create %postun -p /sbin/ldconfig -- 2.7.4 From 4f5e25ba1dbe3bbfa96d8f63118cc394f3d8f3ed Mon Sep 17 00:00:00 2001 From: Wook Song Date: Tue, 20 Jun 2017 15:33:29 +0900 Subject: [PATCH 02/16] pass-hal: tm2: packaging: Restart daemon after install/uninstall This patch adds bits of code to %post and %postun sections so that the daemon is restarted when the package is installed/uninstalled. Note that the daemon is only restarted in the case of that the daemon is running before the hal package is installed/uninstalled. Change-Id: I89aca56051e44b91fc8bda4c1f47d5e5f260ba45 Signed-off-by: Wook Song --- packaging/pass-hal-tm2.spec | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 374a548..3dbec3e 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -39,8 +39,15 @@ rm -rf %{buildroot} %post /sbin/ldconfig systemd-tmpfiles %{_libdir}/tmpfiles.d/pass-hal.conf --create +if [ -f %{_unitdir}/pass.service ]; then + systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' +fi -%postun -p /sbin/ldconfig +%postun +/sbin/ldconfig +if [ -f %{_unitdir}/pass.service ]; then + systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' +fi %files %manifest %{name}.manifest -- 2.7.4 From 1c0fdf4afa577df0c911f3b81f6ba7ddd288ae55 Mon Sep 17 00:00:00 2001 From: Wook Song Date: Tue, 20 Jun 2017 17:19:26 +0900 Subject: [PATCH 03/16] pass-hal: tm2: Apply the value type change of pass_res_type This patch applies the change of the value type of the entry, "pass_res_type", to each PassResource section of the pass.conf file. Change-Id: I87ec4b72737ba30a3cdbb2446d852db484ff5fe5 Signed-off-by: Wook Song --- scripts/pass.conf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/pass.conf b/scripts/pass.conf index 9d09bc9..9892cba 100644 --- a/scripts/pass.conf +++ b/scripts/pass.conf @@ -7,7 +7,7 @@ pass_path_compatible=/proc/device-tree/compatible pass_num_resources=5 [PassResource0] -pass_res_type=1 +pass_res_type=cpu pass_res_name=cpu0 pass_path_conf_file=/etc/pass/pass-resource0.conf pass_path_load_table=/sys/kernel/debug/cpufreq/cpu0/load_table @@ -15,7 +15,7 @@ pass_first_cpu=0 pass_num_cpus=4 [PassResource1] -pass_res_type=1 +pass_res_type=cpu pass_res_name=cpu4 pass_path_conf_file=/etc/pass/pass-resource1.conf pass_path_load_table=/sys/kernel/debug/cpufreq/cpu4/load_table @@ -23,16 +23,16 @@ pass_first_cpu=4 pass_num_cpus=4 [PassResource2] -pass_res_type=2 +pass_res_type=bus pass_res_name=soc:memory_bus@0 pass_path_conf_file=/etc/pass/pass-resource2.conf [PassResource3] -pass_res_type=2 +pass_res_type=bus pass_res_name=soc:memory_bus@1 pass_path_conf_file=/etc/pass/pass-resource3.conf [PassResource4] -pass_res_type=3 +pass_res_type=gpu pass_res_name=14ac0000.mali pass_path_conf_file=/etc/pass/pass-resource4.conf -- 2.7.4 From 0215caba63027770004f997c302e1385a58cdfd9 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 29 Jun 2017 20:28:50 +0900 Subject: [PATCH 04/16] pass-hal: tm2: Use only /usr/lib/tmpfiles.d path for pass-hal.conf Even if architecture is aarch64, the systemd spec applies the rule files under the /usr/lib/tmpfiles.d. On aarch64, /usr/lib64/tmpfiles.d/pass-hal.conf is not applied. So, this patch changes the path of tmpfiles.d in order to support the PASS on aarch64. So, this patch changes the tmpfiles.d path to support the PASS on aarch64 as following: - /usr/lib64/tmpfiles.d -> /usr/lib/tmpfiles.d Change-Id: Icfa83149960235251b22df2ad7a82671c406c046 Signed-off-by: Chanwoo Choi --- CMakeLists.txt | 2 +- packaging/pass-hal-tm2.spec | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index edef99c..a78b065 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,4 +25,4 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource1.conf DESTINATIO INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource2.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource3.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource4.conf DESTINATION /etc/pass) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION ${LIB_INSTALL_DIR}/tmpfiles.d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION /usr/lib/tmpfiles.d) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 3dbec3e..6905672 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -38,7 +38,7 @@ rm -rf %{buildroot} %post /sbin/ldconfig -systemd-tmpfiles %{_libdir}/tmpfiles.d/pass-hal.conf --create +systemd-tmpfiles /usr/lib/tmpfiles.d/pass-hal.conf --create if [ -f %{_unitdir}/pass.service ]; then systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' fi @@ -52,7 +52,7 @@ fi %files %manifest %{name}.manifest %{_libdir}/pass/*.so -%{_libdir}/tmpfiles.d/pass-hal.conf +/usr/lib/tmpfiles.d/pass-hal.conf %config %{_sysconfdir}/pass/pass.conf %config %{_sysconfdir}/pass/pass-resource0.conf -- 2.7.4 From cd740cbf75cf947e803cb8bb4049c5fc742bc6ad Mon Sep 17 00:00:00 2001 From: Wook Song Date: Fri, 7 Jul 2017 11:46:18 +0900 Subject: [PATCH 05/16] pass-hal: tm2: Update TMU HAL functions to use pass_res_thermal_name This patch updates all HAL function bodies for TMU to use the new pass_res_thermal_name property of the 'pass.conf' file. Change-Id: I7f9b4507576d0d5e79ce7b503710193501617eab Signed-off-by: Wook Song Reviewed-by: Chanwoo Choi --- src/cpu/cpu.c | 43 +++++++++++-------------------------------- src/gpu/gpu.c | 16 +++++++--------- 2 files changed, 18 insertions(+), 41 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 1683cfe..f05c510 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -50,19 +50,13 @@ #define CPU_ONLINE_STATE_ON 1 #define CPU_ONLINE_STATE_OFF 0 -#define TMU_PATH_PREFIX "/sys/class/thermal/thermal_zone" +#define TMU_PATH_PREFIX "/sys/class/thermal/" #define TMU_TEMP_PATH_SUFFIX "/temp" #define TMU_POLICY_PATH_SUFFIX "/policy" #define TM2_CPU_MIN_NUM 0 #define TM2_CPU_MAX_NUM 7 -#define TM2_CPU_LITTLE_RESNAME "cpu0" -#define TM2_CPU_BIG_RESNAME "cpu4" -#define TM2_CPU_LITTLE_THERMAL_ZONE_NUM 3 -#define TM2_CPU_BIG_THERMAL_ZONE_NUM 0 - - static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) { char path[PATH_MAX]; @@ -327,25 +321,17 @@ static struct pass_resource_hotplug_ops tm2_cpu_hotplus_ops = { .set_online_max_num = NULL, }; -static int tm2_tmu_get_temp(char *res_name) +static int tm2_tmu_get_temp(char *res_thermal_name) { char path[PATH_MAX]; - int tz_num, temp; - int ret; + int temp, ret; - if (!res_name) + if (!res_thermal_name) return -EINVAL; - if (!strcmp(res_name, TM2_CPU_LITTLE_RESNAME)) - tz_num = TM2_CPU_LITTLE_THERMAL_ZONE_NUM; - else if (!strcmp(res_name, TM2_CPU_BIG_RESNAME)) - tz_num = TM2_CPU_BIG_THERMAL_ZONE_NUM; - else - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%d%s", + snprintf(path, PATH_MAX, "%s%s%s", TMU_PATH_PREFIX, - tz_num, + res_thermal_name, TMU_TEMP_PATH_SUFFIX); ret = sysfs_read_int(path, &temp); @@ -355,24 +341,17 @@ static int tm2_tmu_get_temp(char *res_name) return temp; } -static int tm2_tmu_get_policy(char *res_name, char *policy) +static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) { char path[PATH_MAX]; - int ret, tz_num; - - if ((!res_name) || (!policy)) - return -EINVAL; + int ret; - if (!strcmp(res_name, TM2_CPU_LITTLE_RESNAME)) - tz_num = TM2_CPU_LITTLE_THERMAL_ZONE_NUM; - else if (!strcmp(res_name, TM2_CPU_BIG_RESNAME)) - tz_num = TM2_CPU_BIG_THERMAL_ZONE_NUM; - else + if ((!res_thermal_name) || (!policy)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%d%s", + snprintf(path, PATH_MAX, "%s%s%s", TMU_PATH_PREFIX, - tz_num, + res_thermal_name, TMU_POLICY_PATH_SUFFIX); ret = sysfs_read_str(path, policy, BUFF_MAX); diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index aaf9cc4..46b0dec 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -35,12 +35,10 @@ #define DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX "/min_freq" #define DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX "/max_freq" -#define TMU_PATH_PREFIX "/sys/class/thermal/thermal_zone" +#define TMU_PATH_PREFIX "/sys/class/thermal/" #define TMU_TEMP_PATH_SUFFIX "/temp" #define TMU_POLICY_PATH_SUFFIX "/policy" -#define TM2_GPU_THERMAL_ZONE_NUM 2 - static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) { char path[PATH_MAX]; @@ -195,7 +193,7 @@ static struct pass_resource_dvfs_ops tm2_gpu_dvfs_ops = { .get_load_table = NULL, }; -static int tm2_tmu_get_temp(char *res_name) +static int tm2_tmu_get_temp(char *res_thermal_name); { char path[PATH_MAX]; int temp; @@ -204,9 +202,9 @@ static int tm2_tmu_get_temp(char *res_name) if (!res_name) return -EINVAL; - snprintf(path, PATH_MAX, "%s%d%s", + snprintf(path, PATH_MAX, "%s%s%s", TMU_PATH_PREFIX, - TM2_GPU_THERMAL_ZONE_NUM, + res_thermal_name, TMU_TEMP_PATH_SUFFIX); ret = sysfs_read_int(path, &temp); @@ -216,7 +214,7 @@ static int tm2_tmu_get_temp(char *res_name) return temp; } -static int tm2_tmu_get_policy(char *res_name, char *policy) +static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) { char path[PATH_MAX]; int ret; @@ -224,9 +222,9 @@ static int tm2_tmu_get_policy(char *res_name, char *policy) if ((!res_name) || (!policy)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%d%s", + snprintf(path, PATH_MAX, "%s%s%s", TMU_PATH_PREFIX, - TM2_GPU_THERMAL_ZONE_NUM, + res_thermal_name, TMU_POLICY_PATH_SUFFIX); ret = sysfs_read_str(path, policy, BUFF_MAX); -- 2.7.4 From aae2ece3f5fae2d2e2b16f04fb99920680ab2311 Mon Sep 17 00:00:00 2001 From: Wook Song Date: Fri, 7 Jul 2017 11:42:51 +0900 Subject: [PATCH 06/16] pass-hal: tm2: Add pass_res_thermal_name properties for CPU and GPU This patch adds new pass_res_thermal_name properties and their values for the CPU and GPU resources to the 'pass.conf' file. Change-Id: I5a9b257bb668cd4187921377d29c54d7a5376f47 Signed-off-by: Wook Song Reviewed-by: Chanwoo Choi --- scripts/pass.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/pass.conf b/scripts/pass.conf index 9892cba..8575acb 100644 --- a/scripts/pass.conf +++ b/scripts/pass.conf @@ -9,6 +9,7 @@ pass_num_resources=5 [PassResource0] pass_res_type=cpu pass_res_name=cpu0 +pass_res_thermal_name=thermal_zone3 pass_path_conf_file=/etc/pass/pass-resource0.conf pass_path_load_table=/sys/kernel/debug/cpufreq/cpu0/load_table pass_first_cpu=0 @@ -17,6 +18,7 @@ pass_num_cpus=4 [PassResource1] pass_res_type=cpu pass_res_name=cpu4 +pass_res_thermal_name=thermal_zone0 pass_path_conf_file=/etc/pass/pass-resource1.conf pass_path_load_table=/sys/kernel/debug/cpufreq/cpu4/load_table pass_first_cpu=4 @@ -35,4 +37,5 @@ pass_path_conf_file=/etc/pass/pass-resource3.conf [PassResource4] pass_res_type=gpu pass_res_name=14ac0000.mali +pass_res_thermal_name=thermal_zone2 pass_path_conf_file=/etc/pass/pass-resource4.conf -- 2.7.4 From 6d13c951864376c3e5561477de083cd500d0688e Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 7 Jul 2017 11:20:55 +0900 Subject: [PATCH 07/16] pass-hal: tm2: Remove the specific author information This patch removes the specific author information from HAL_MODULE_STRUCTURE. Change-Id: I6e8f36e957b7d13b18e1be5a4e53d3f25af47915 Signed-off-by: Chanwoo Choi --- src/bus/bus.c | 1 - src/cpu/cpu.c | 1 - src/gpu/gpu.c | 1 - 3 files changed, 3 deletions(-) diff --git a/src/bus/bus.c b/src/bus/bus.c index 82ca526..2463bfc 100644 --- a/src/bus/bus.c +++ b/src/bus/bus.c @@ -226,7 +226,6 @@ HAL_MODULE_STRUCTURE = { .device_version = DEV_VERSION_BUS, .id = PASS_RESOURCE_BUS_ID, .name = PASS_RESOURCE_BUS_NAME, - .author = "Wook Song ", .open = tm2_bus_open, .close = tm2_bus_close, }; diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index f05c510..9cac0de 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -405,7 +405,6 @@ HAL_MODULE_STRUCTURE = { .device_version = DEV_VERSION_CPU, .id = PASS_RESOURCE_CPU_ID, .name = PASS_RESOURCE_CPU_NAME, - .author = "Wook Song ", .open = tm2_cpu_open, .close = tm2_cpu_close, }; diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index 46b0dec..3f4d66a 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -277,7 +277,6 @@ HAL_MODULE_STRUCTURE = { .device_version = DEV_VERSION_GPU, .id = PASS_RESOURCE_GPU_ID, .name = PASS_RESOURCE_GPU_NAME, - .author = "Wook Song ", .open = tm2_gpu_open, .close = tm2_gpu_close, }; -- 2.7.4 From 50aa80dddec50a79232f916d088c9d55ebd3f201 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 7 Jul 2017 16:38:31 +0900 Subject: [PATCH 08/16] pass-hal: tm2: Fix build error for gpu.c The cd740cbf75cf9 ("pass-hal: tm2: Update TMU HAL functions to use pass_res_thermal_name") patch has the build errors. So, this patch fixes the build error on gpu.c. Change-Id: I92fd86cfbee586638c8d9b2868a85d5ec694c02b Signed-off-by: Chanwoo Choi --- src/gpu/gpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index 3f4d66a..eaa0039 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -193,13 +193,13 @@ static struct pass_resource_dvfs_ops tm2_gpu_dvfs_ops = { .get_load_table = NULL, }; -static int tm2_tmu_get_temp(char *res_thermal_name); +static int tm2_tmu_get_temp(char *res_thermal_name) { char path[PATH_MAX]; int temp; int ret; - if (!res_name) + if (!res_thermal_name) return -EINVAL; snprintf(path, PATH_MAX, "%s%s%s", @@ -219,7 +219,7 @@ static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) char path[PATH_MAX]; int ret; - if ((!res_name) || (!policy)) + if ((!res_thermal_name) || (!policy)) return -EINVAL; snprintf(path, PATH_MAX, "%s%s%s", -- 2.7.4 From 9e123cadb5b6d8ad1163ef0cb63a34f1e26b1fce Mon Sep 17 00:00:00 2001 From: Wook Song Date: Mon, 10 Jul 2017 16:24:43 +0900 Subject: [PATCH 09/16] pass-hal: tm2: Remove tm2-specific define statements for cpu This patch removes the tm2-specific define statements such as TM2_CPU_MIN_NUM and TM2_CPU_MAX_NUM, which were used to check CPU indexes out of range. The reasons why we need to remove this board-specific code are that 1) such CPU indexes out of range would never occur and 2) it is required to standardize the HAL function implementation. Change-Id: I10c96c36975bbe5b33e6102742fac917682616f1 Signed-off-by: Wook Song --- src/cpu/cpu.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 9cac0de..18f407e 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -54,9 +54,6 @@ #define TMU_TEMP_PATH_SUFFIX "/temp" #define TMU_POLICY_PATH_SUFFIX "/policy" -#define TM2_CPU_MIN_NUM 0 -#define TM2_CPU_MAX_NUM 7 - static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) { char path[PATH_MAX]; @@ -262,8 +259,6 @@ static int tm2_hotplug_get_online_state(char *res_name, int cpu) if ((!res_name)) return -EINVAL; - if ((cpu < TM2_CPU_MIN_NUM) || (cpu > TM2_CPU_MAX_NUM)) - return -EINVAL; snprintf(path, PATH_MAX, "%s%d%s", CPU_ONLINE_PATH_PREFIX, @@ -284,8 +279,6 @@ static int tm2_hotplug_set_online_state(char *res_name, int cpu, int on) if ((!res_name)) return -EINVAL; - if ((cpu < TM2_CPU_MIN_NUM) || (cpu > TM2_CPU_MAX_NUM)) - return -EINVAL; if ((on != CPU_ONLINE_STATE_ON) && (on != CPU_ONLINE_STATE_OFF)) return -EINVAL; -- 2.7.4 From 366b5218d3a2958ea91f5d84febd96ac877ad183 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Mon, 31 Jul 2017 16:21:15 +0900 Subject: [PATCH 10/16] pass-hal: tm2: Remove unncessary source code Since TM2 kernel supports standard interface for each resource, standard HAL can replace this specific HAL. After this, PASS HAL for TM2 only provides configuration files. Change-Id: If2f78b2a711ffa5f87797b19afc8edd96bab7700 Signed-off-by: Dongwoo Lee --- CMakeLists.txt | 9 - packaging/pass-hal-tm2.spec | 4 - src/bus/CMakeLists.txt | 24 --- src/bus/bus.c | 231 ------------------------- src/cpu/CMakeLists.txt | 24 --- src/cpu/cpu.c | 403 -------------------------------------------- src/gpu/CMakeLists.txt | 24 --- src/gpu/gpu.c | 282 ------------------------------- src/shared/sysfs.c | 127 -------------- src/shared/sysfs.h | 6 - 10 files changed, 1134 deletions(-) delete mode 100644 src/bus/CMakeLists.txt delete mode 100644 src/bus/bus.c delete mode 100644 src/cpu/CMakeLists.txt delete mode 100644 src/cpu/cpu.c delete mode 100644 src/gpu/CMakeLists.txt delete mode 100644 src/gpu/gpu.c delete mode 100644 src/shared/sysfs.c delete mode 100644 src/shared/sysfs.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a78b065..622008a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,11 +3,6 @@ PROJECT(pass-hal-tm2 C) SET(CMAKE_VERBOSE_MAKEFILE ON) -SET(PKG_MODULES - dlog) -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED ${PKG_MODULES}) - FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) @@ -15,10 +10,6 @@ ENDFOREACH(flag) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(DEST_DIR ${LIB_INSTALL_DIR}/pass) -ADD_SUBDIRECTORY(src/cpu) -ADD_SUBDIRECTORY(src/bus) -ADD_SUBDIRECTORY(src/gpu) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource0.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource1.conf DESTINATION /etc/pass) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 6905672..9f48068 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -15,9 +15,6 @@ ExclusiveArch: %{arm} aarch64 Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: cmake -BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(pass-hal-devel) %description PASS hal for TM2 @@ -51,7 +48,6 @@ fi %files %manifest %{name}.manifest -%{_libdir}/pass/*.so /usr/lib/tmpfiles.d/pass-hal.conf %config %{_sysconfdir}/pass/pass.conf diff --git a/src/bus/CMakeLists.txt b/src/bus/CMakeLists.txt deleted file mode 100644 index 2bca621..0000000 --- a/src/bus/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(bus C) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog glib-2.0) - -#HAL version -string(REPLACE "." ";" HAL_VERSION_LIST ${HAL_VERSION}) -list(GET HAL_VERSION_LIST 0 HAL_VERSION_MAJOR) -list(GET HAL_VERSION_LIST 1 HAL_VERSION_MINOR) -list(GET HAL_VERSION_LIST 2 HAL_VERSION_REVISION) -list(GET HAL_VERSION_LIST 3 HAL_VERSION_RELEASE) -add_definitions(-DVER_MAJOR=${HAL_VERSION_MAJOR} -DVER_MINOR=${HAL_VERSION_MINOR}) -add_definitions(-DVER_REVISION=${HAL_VERSION_REVISION} -DVER_RELEASE=${HAL_VERSION_RELEASE}) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -SET(SRCS ${PROJECT_NAME}.c - ../shared/sysfs.c) - -ADD_LIBRARY(${PROJECT_NAME} MODULE ${SRCS}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${DEST_DIR} COMPONENT RuntimeLibraries) diff --git a/src/bus/bus.c b/src/bus/bus.c deleted file mode 100644 index 2463bfc..0000000 --- a/src/bus/bus.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include -#include -#include - -#include "../shared/sysfs.h" - -/* TODO: Version! */ -#define HAL_VERSION MAKE_2B_CODE_4(VER_MAJOR,VER_MINOR,VER_REVISION,VER_RELEASE) -#define DEV_VERSION_BUS MAKE_2B_CODE_2(1,0) - -#define DEVFREQ_BUS_PATH_PREFIX "/sys/class/devfreq/" -#define DEVFREQ_BUS_CURR_GOVERNOR_PATH_SUFFIX "/governor" -#define DEVFREQ_BUS_CURR_FREQ_PATH_SUFFIX "/cur_freq" -#define DEVFREQ_BUS_MIN_FREQ_PATH_SUFFIX "/min_freq" -#define DEVFREQ_BUS_MAX_FREQ_PATH_SUFFIX "/max_freq" - -static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_read_str(path, governor, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_set_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_write_str(path, governor); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_curr_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_CURR_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_get_min_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_min_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_max_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_max_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_BUS_PATH_PREFIX, - res_name, - DEVFREQ_BUS_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - return 0; -} - - -static struct pass_resource_dvfs_ops tm2_bus_dvfs_ops = { - .get_curr_governor = tm2_dvfs_get_curr_governor, - .set_curr_governor = tm2_dvfs_set_curr_governor, - .get_avail_governor = NULL, - .get_curr_freq = tm2_dvfs_get_curr_freq, - .get_min_freq = tm2_dvfs_get_min_freq, - .set_min_freq = tm2_dvfs_set_min_freq, - .get_max_freq = tm2_dvfs_get_max_freq, - .set_max_freq = tm2_dvfs_set_max_freq, - .get_up_threshold = NULL, - .set_up_threshold = NULL, - .get_load_table = NULL, -}; - -static int tm2_bus_open(char *res_name, struct pass_resource_info *info, - struct pass_resource_common **common) -{ - struct pass_resource_bus *bus_res; - - if (!info) - return -EINVAL; - - /* TODO: Possibility of a memory leak */ - bus_res = calloc(1, sizeof(struct pass_resource_bus)); - if (!bus_res) - return -ENOMEM; - - bus_res->common.info = info; - bus_res->dvfs = tm2_bus_dvfs_ops; - - *common = (struct pass_resource_common *) bus_res; - - return 0; -} - -static int tm2_bus_close(char *res_name, struct pass_resource_common *common) -{ - if (!common) - return -EINVAL; - - free(common); - - return 0; -} - -HAL_MODULE_STRUCTURE = { - .magic = HAL_INFO_TAG, - .hal_version = HAL_VERSION, - .device_version = DEV_VERSION_BUS, - .id = PASS_RESOURCE_BUS_ID, - .name = PASS_RESOURCE_BUS_NAME, - .open = tm2_bus_open, - .close = tm2_bus_close, -}; diff --git a/src/cpu/CMakeLists.txt b/src/cpu/CMakeLists.txt deleted file mode 100644 index 3cd62b8..0000000 --- a/src/cpu/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(cpu C) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog glib-2.0) - -#HAL version -string(REPLACE "." ";" HAL_VERSION_LIST ${HAL_VERSION}) -list(GET HAL_VERSION_LIST 0 HAL_VERSION_MAJOR) -list(GET HAL_VERSION_LIST 1 HAL_VERSION_MINOR) -list(GET HAL_VERSION_LIST 2 HAL_VERSION_REVISION) -list(GET HAL_VERSION_LIST 3 HAL_VERSION_RELEASE) -add_definitions(-DVER_MAJOR=${HAL_VERSION_MAJOR} -DVER_MINOR=${HAL_VERSION_MINOR}) -add_definitions(-DVER_REVISION=${HAL_VERSION_REVISION} -DVER_RELEASE=${HAL_VERSION_RELEASE}) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -SET(SRCS ${PROJECT_NAME}.c - ../shared/sysfs.c) - -ADD_LIBRARY(${PROJECT_NAME} MODULE ${SRCS}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${DEST_DIR} COMPONENT RuntimeLibraries) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c deleted file mode 100644 index 18f407e..0000000 --- a/src/cpu/cpu.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include -#include -#include - -#include "../shared/sysfs.h" - -/* TODO: Version! */ -#define HAL_VERSION MAKE_2B_CODE_4(VER_MAJOR,VER_MINOR,VER_REVISION,VER_RELEASE) -#define DEV_VERSION_CPU MAKE_2B_CODE_2(1,0) - -#define CPUFREQ_PATH_PREFIX "/sys/devices/system/cpu/" -#define CPUFREQ_CURR_GOVERNOR_PATH_SUFFIX "/cpufreq/scaling_governor" -#define CPUFREQ_AVAIL_GOVERNOR_PATH_SUFFIX "/cpufreq/scaling_available_governors" - -/* - * The cpuinfo_cur_freq indicates the actual operating CPU freqeuncy - * and scaling_cur_freq is the CPU frequency set by the CPUFREQ policy. - */ -#define CPUFREQ_CURR_FREQ_PATH_SUFFIX "/cpufreq/cpuinfo_cur_freq" -#define CPUFREQ_MIN_FREQ_PATH_SUFFIX "/cpufreq/scaling_min_freq" -#define CPUFREQ_MAX_FREQ_PATH_SUFFIX "/cpufreq/scaling_max_freq" -#define CPUFREQ_UP_THRESHOLD_PATH_SUFFIX "/cpufreq/ondemand/up_threshold" - -#define LOADTABLE_PATH_PREFIX "/sys/kernel/debug/cpufreq/" -#define LOADTABLE_PATH_SUFFIX "/load_table" - -#define CPU_ONLINE_PATH_PREFIX "/sys/devices/system/cpu/cpu" -#define CPU_ONLINE_PATH_SUFFIX "/online" -#define CPU_ONLINE_STATE_ON 1 -#define CPU_ONLINE_STATE_OFF 0 - -#define TMU_PATH_PREFIX "/sys/class/thermal/" -#define TMU_TEMP_PATH_SUFFIX "/temp" -#define TMU_POLICY_PATH_SUFFIX "/policy" - -static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_read_str(path, governor, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_set_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_write_str(path, governor); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_curr_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_CURR_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_get_min_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_min_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_max_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_max_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - return 0; -} - -static int tm2_dvfs_get_up_threshold(char *res_name) -{ - char path[PATH_MAX]; - int val, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_UP_THRESHOLD_PATH_SUFFIX); - - ret = sysfs_read_int(path, &val); - if (ret < 0) - return ret; - - return val; -} - -static int tm2_dvfs_set_up_threshold(char *res_name, int up_threshold) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (up_threshold < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - CPUFREQ_PATH_PREFIX, - res_name, - CPUFREQ_UP_THRESHOLD_PATH_SUFFIX); - - ret = sysfs_write_int(path, up_threshold); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_load_table(char *res_name, void *pass_cpu_load_table) -{ - return 0; -} - -static struct pass_resource_dvfs_ops tm2_cpu_dvfs_ops = { - .get_curr_governor = tm2_dvfs_get_curr_governor, - .set_curr_governor = tm2_dvfs_set_curr_governor, - .get_avail_governor = NULL, - .get_curr_freq = tm2_dvfs_get_curr_freq, - .get_min_freq = tm2_dvfs_get_min_freq, - .set_min_freq = tm2_dvfs_set_min_freq, - .get_max_freq = tm2_dvfs_get_max_freq, - .set_max_freq = tm2_dvfs_set_max_freq, - .get_up_threshold = tm2_dvfs_get_up_threshold, - .set_up_threshold = tm2_dvfs_set_up_threshold, - .get_load_table = tm2_dvfs_get_load_table, -}; - -static int tm2_hotplug_get_online_state(char *res_name, int cpu) -{ - char path[PATH_MAX]; - int ret, online; - - if ((!res_name)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%d%s", - CPU_ONLINE_PATH_PREFIX, - cpu, - CPU_ONLINE_PATH_SUFFIX); - - ret = sysfs_read_int(path, &online); - if (ret < 0) - return ret; - - return online; -} - -static int tm2_hotplug_set_online_state(char *res_name, int cpu, int on) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name)) - return -EINVAL; - if ((on != CPU_ONLINE_STATE_ON) && (on != CPU_ONLINE_STATE_OFF)) - return -EINVAL; - - /* - * NOTE: Exynos SoC series cannot turn off the CPU0 - * because of h/w design. To prevent the critical problem, - * if someone try to turn off the CPU0, just return without any - * opertaion. - */ - if (on == 0 && cpu == 0) { - _E("cannot turn off the CPU0"); - return 0; - } - - snprintf(path, PATH_MAX, "%s%d%s", - CPU_ONLINE_PATH_PREFIX, - cpu, - CPU_ONLINE_PATH_SUFFIX); - - ret = sysfs_write_int(path, on); - if (ret < 0) - return ret; - - return 0; -} - -static struct pass_resource_hotplug_ops tm2_cpu_hotplus_ops = { - .get_online_state = tm2_hotplug_get_online_state, - .set_online_state = tm2_hotplug_set_online_state, - .get_online_min_num = NULL, - .set_online_min_num = NULL, - .get_online_max_num = NULL, - .set_online_max_num = NULL, -}; - -static int tm2_tmu_get_temp(char *res_thermal_name) -{ - char path[PATH_MAX]; - int temp, ret; - - if (!res_thermal_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - TMU_PATH_PREFIX, - res_thermal_name, - TMU_TEMP_PATH_SUFFIX); - - ret = sysfs_read_int(path, &temp); - if (ret < 0) - return ret; - - return temp; -} - -static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_thermal_name) || (!policy)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - TMU_PATH_PREFIX, - res_thermal_name, - TMU_POLICY_PATH_SUFFIX); - - ret = sysfs_read_str(path, policy, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static struct pass_resource_tmu_ops tm2_cpu_tmu_ops = { - .get_temp = tm2_tmu_get_temp, - .get_policy = tm2_tmu_get_policy, -}; - -static int tm2_cpu_open(char *res_name, struct pass_resource_info *info, - struct pass_resource_common **common) -{ - struct pass_resource_cpu *cpu_res; - - if (!info) - return -EINVAL; - - /* TODO: Possibility of a memory leak */ - cpu_res = calloc(1, sizeof(struct pass_resource_cpu)); - if (!cpu_res) - return -ENOMEM; - - cpu_res->common.info = info; - cpu_res->dvfs = tm2_cpu_dvfs_ops; - cpu_res->hotplug = tm2_cpu_hotplus_ops; - cpu_res->tmu = tm2_cpu_tmu_ops; - - *common = (struct pass_resource_common *) cpu_res; - - return 0; -} - -static int tm2_cpu_close(char *res_name, struct pass_resource_common *common) -{ - if (!common) - return -EINVAL; - - free(common); - - return 0; -} - -HAL_MODULE_STRUCTURE = { - .magic = HAL_INFO_TAG, - .hal_version = HAL_VERSION, - .device_version = DEV_VERSION_CPU, - .id = PASS_RESOURCE_CPU_ID, - .name = PASS_RESOURCE_CPU_NAME, - .open = tm2_cpu_open, - .close = tm2_cpu_close, -}; diff --git a/src/gpu/CMakeLists.txt b/src/gpu/CMakeLists.txt deleted file mode 100644 index 4425ca0..0000000 --- a/src/gpu/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(gpu C) - -INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog glib-2.0) - -#HAL version -string(REPLACE "." ";" HAL_VERSION_LIST ${HAL_VERSION}) -list(GET HAL_VERSION_LIST 0 HAL_VERSION_MAJOR) -list(GET HAL_VERSION_LIST 1 HAL_VERSION_MINOR) -list(GET HAL_VERSION_LIST 2 HAL_VERSION_REVISION) -list(GET HAL_VERSION_LIST 3 HAL_VERSION_RELEASE) -add_definitions(-DVER_MAJOR=${HAL_VERSION_MAJOR} -DVER_MINOR=${HAL_VERSION_MINOR}) -add_definitions(-DVER_REVISION=${HAL_VERSION_REVISION} -DVER_RELEASE=${HAL_VERSION_RELEASE}) - -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -SET(SRCS ${PROJECT_NAME}.c - ../shared/sysfs.c) - -ADD_LIBRARY(${PROJECT_NAME} MODULE ${SRCS}) -SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES PREFIX "") -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${DEST_DIR} COMPONENT RuntimeLibraries) diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c deleted file mode 100644 index eaa0039..0000000 --- a/src/gpu/gpu.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include -#include -#include - -#include "../shared/sysfs.h" - -/* TODO: Version! */ -#define HAL_VERSION MAKE_2B_CODE_4(VER_MAJOR,VER_MINOR,VER_REVISION,VER_RELEASE) -#define DEV_VERSION_GPU MAKE_2B_CODE_2(1,0) - -#define DEVFREQ_GPU_PATH_PREFIX "/sys/class/devfreq/" -#define DEVFREQ_GPU_CURR_GOVERNOR_PATH_SUFFIX "/governor" -#define DEVFREQ_GPU_CURR_FREQ_PATH_SUFFIX "/cur_freq" -#define DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX "/min_freq" -#define DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX "/max_freq" - -#define TMU_PATH_PREFIX "/sys/class/thermal/" -#define TMU_TEMP_PATH_SUFFIX "/temp" -#define TMU_POLICY_PATH_SUFFIX "/policy" - -static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_read_str(path, governor, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_set_curr_governor(char *res_name, char *governor) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (!governor)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_CURR_GOVERNOR_PATH_SUFFIX); - - ret = sysfs_write_str(path, governor); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_curr_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_CURR_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_get_min_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_min_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - - return 0; -} - -static int tm2_dvfs_get_max_freq(char *res_name) -{ - char path[PATH_MAX]; - int freq, ret; - - if (!res_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_read_int(path, &freq); - if (ret < 0) - return ret; - - return freq; -} - -static int tm2_dvfs_set_max_freq(char *res_name, int freq) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_name) || (freq < 0)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - DEVFREQ_GPU_PATH_PREFIX, - res_name, - DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX); - - ret = sysfs_write_int(path, freq); - if (ret < 0) - return ret; - return 0; -} - - -static struct pass_resource_dvfs_ops tm2_gpu_dvfs_ops = { - .get_curr_governor = tm2_dvfs_get_curr_governor, - .set_curr_governor = tm2_dvfs_set_curr_governor, - .get_avail_governor = NULL, - .get_curr_freq = tm2_dvfs_get_curr_freq, - .get_min_freq = tm2_dvfs_get_min_freq, - .set_min_freq = tm2_dvfs_set_min_freq, - .get_max_freq = tm2_dvfs_get_max_freq, - .set_max_freq = tm2_dvfs_set_max_freq, - .get_up_threshold = NULL, - .set_up_threshold = NULL, - .get_load_table = NULL, -}; - -static int tm2_tmu_get_temp(char *res_thermal_name) -{ - char path[PATH_MAX]; - int temp; - int ret; - - if (!res_thermal_name) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - TMU_PATH_PREFIX, - res_thermal_name, - TMU_TEMP_PATH_SUFFIX); - - ret = sysfs_read_int(path, &temp); - if (ret < 0) - return ret; - - return temp; -} - -static int tm2_tmu_get_policy(char *res_thermal_name, char *policy) -{ - char path[PATH_MAX]; - int ret; - - if ((!res_thermal_name) || (!policy)) - return -EINVAL; - - snprintf(path, PATH_MAX, "%s%s%s", - TMU_PATH_PREFIX, - res_thermal_name, - TMU_POLICY_PATH_SUFFIX); - - ret = sysfs_read_str(path, policy, BUFF_MAX); - if (ret < 0) - return ret; - - return 0; -} - -static struct pass_resource_tmu_ops tm2_gpu_tmu_ops = { - .get_temp = tm2_tmu_get_temp, - .get_policy = tm2_tmu_get_policy, -}; - -static int tm2_gpu_open(char *res_name, struct pass_resource_info *info, - struct pass_resource_common **common) -{ - struct pass_resource_gpu *gpu_res; - - if (!info) - return -EINVAL; - - /* TODO: Possibility of a memory leak */ - gpu_res = calloc(1, sizeof(struct pass_resource_gpu)); - if (!gpu_res) - return -ENOMEM; - - gpu_res->common.info = info; - gpu_res->dvfs = tm2_gpu_dvfs_ops; - gpu_res->tmu = tm2_gpu_tmu_ops; - - *common = (struct pass_resource_common *) gpu_res; - - return 0; -} - -static int tm2_gpu_close(char *res_name, struct pass_resource_common *common) -{ - if (!common) - return -EINVAL; - - free(common); - - return 0; -} - -HAL_MODULE_STRUCTURE = { - .magic = HAL_INFO_TAG, - .hal_version = HAL_VERSION, - .device_version = DEV_VERSION_GPU, - .id = PASS_RESOURCE_GPU_ID, - .name = PASS_RESOURCE_GPU_NAME, - .open = tm2_gpu_open, - .close = tm2_gpu_close, -}; diff --git a/src/shared/sysfs.c b/src/shared/sysfs.c deleted file mode 100644 index 57a168b..0000000 --- a/src/shared/sysfs.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include -#include -#include -#include -#include -#include - -#include "sysfs.h" - -static int sysfs_read_buf(char *path, char *buf, int len) -{ - int r, fd; - - if ((!path) || (!buf) || (len < 0)) - return -EINVAL; - - fd = open(path, O_RDONLY); - if (fd == -1) - return -ENOENT; - - r = read(fd, buf, len + 1); - close(fd); - - if ((r < 0) || (r > len)) - return -EIO; - - buf[r] = '\0'; - - return 0; -} - -static int sysfs_write_buf(char *path, char *buf) -{ - int w, fd; - - if ((!path) || (!buf)) - return -EINVAL; - - fd = open(path, O_WRONLY); - if (fd == -1) - return -ENOENT; - - w = write(fd, buf, strlen(buf)); - close(fd); - - if (w < 0) - return -EIO; - - return 0; -} - -int sysfs_read_int(char *path, int *val) -{ - char buf[MAX_BUF_SIZE]; - int r; - - if ((!path) || (!val)) - return -EINVAL; - - r = sysfs_read_buf(path, buf, MAX_BUF_SIZE); - if (r < 0) - return r; - - *val = atoi(buf); - return 0; -} - -int sysfs_read_str(char *path, char *str, int len) -{ - int r; - - if ((!path) || (!str) || (len <= 0)) - return -EINVAL; - - r = sysfs_read_buf(path, str, len); - if (r < 0) - return r; - - return 0; -} - -int sysfs_write_int(char *path, int val) -{ - char buf[MAX_BUF_SIZE]; - int w; - - if (!path) - return -EINVAL; - - snprintf(buf, MAX_BUF_SIZE, "%d", val); - w = sysfs_write_buf(path, buf); - if (w < 0) - return w; - - return 0; -} - -int sysfs_write_str(char *path, char *str) -{ - int w; - - if ((!path) || (!str)) - return -EINVAL; - - w = sysfs_write_buf(path, str); - if (w < 0) - return w; - - return 0; -} diff --git a/src/shared/sysfs.h b/src/shared/sysfs.h deleted file mode 100644 index 174804f..0000000 --- a/src/shared/sysfs.h +++ /dev/null @@ -1,6 +0,0 @@ -#define MAX_BUF_SIZE 255 - -int sysfs_read_int(char *path, int *val); -int sysfs_read_str(char *path, char *str, int len); -int sysfs_write_int(char *path, int val); -int sysfs_write_str(char *path, char *str); -- 2.7.4 From de3a1c0b7b4a4c624562029b9c440b69ffd3472e Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Tue, 1 Aug 2017 08:05:52 +0900 Subject: [PATCH 11/16] pass-hal: tm2: Add dependency on PASS and PASS standard HAL Now, pass-hal-tm2 only has configuration files, and all operation is processed in standard HAL. Thus, we should make HAL for TM2 depends on PASS and its standard HAL. To do this, Require for pass-hal-standard is added to RPM spec file. Change-Id: Ia0f738c22fc632fcf9bd4d9ce62f3187064cbb7a Signed-off-by: Dongwoo Lee Signed-off-by: Chanwoo Choi --- packaging/pass-hal-tm2.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 9f48068..adce8e6 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -14,6 +14,8 @@ ExclusiveArch: %{arm} aarch64 Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig +Requires: pass >= 0.0.1 +Requires: pass-hal-standard >= 0.0.1 BuildRequires: cmake %description -- 2.7.4 From f6a2a6188cacbb5d1df5838ba2f706e1007ff536 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Wed, 9 Aug 2017 15:54:17 +0900 Subject: [PATCH 12/16] pass-hal: tm2: Remove pass-hal.conf PASS HAL for TM2 only provides the specific configuration to standard HAL, and thus accessing files is not performed anymore in TM2 HAL. For this reason, it is better to move the pass-hal.conf into standard HAL. Since this, pass-hal.conf is removed in TM2 HAL, and it can be found in standard HAL. Change-Id: I91b306ba812572cdbe7580fdb25226787333892c Signed-off-by: Dongwoo Lee --- CMakeLists.txt | 1 - packaging/pass-hal-tm2.spec | 2 -- scripts/pass-hal.conf | 30 ------------------------------ 3 files changed, 33 deletions(-) delete mode 100644 scripts/pass-hal.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 622008a..47f6d89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,4 +16,3 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource1.conf DESTINATIO INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource2.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource3.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource4.conf DESTINATION /etc/pass) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-hal.conf DESTINATION /usr/lib/tmpfiles.d) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index adce8e6..ba28c02 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -37,7 +37,6 @@ rm -rf %{buildroot} %post /sbin/ldconfig -systemd-tmpfiles /usr/lib/tmpfiles.d/pass-hal.conf --create if [ -f %{_unitdir}/pass.service ]; then systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' fi @@ -50,7 +49,6 @@ fi %files %manifest %{name}.manifest -/usr/lib/tmpfiles.d/pass-hal.conf %config %{_sysconfdir}/pass/pass.conf %config %{_sysconfdir}/pass/pass-resource0.conf diff --git a/scripts/pass-hal.conf b/scripts/pass-hal.conf deleted file mode 100644 index 5d823db..0000000 --- a/scripts/pass-hal.conf +++ /dev/null @@ -1,30 +0,0 @@ -z /sys/devices/system/cpu/*/online 0660 root system_fw - -t /sys/devices/system/cpu/*/online - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/scaling_available_governors 0440 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/scaling_available_governors - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/cpuinfo_cur_freq 0440 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/cpuinfo_cur_freq - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/scaling_governor 0660 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/scaling_governor - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/scaling_min_freq 0660 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/scaling_min_freq - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/scaling_max_freq 0660 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/scaling_max_freq - - - - security.SMACK64="System" -z /sys/devices/system/cpu/*/cpufreq/ondemand/up_threshold 0660 root system_fw - -t /sys/devices/system/cpu/*/cpufreq/ondemand/up_threshold - - - - security.SMACK64="System" -z /sys/class/thermal/*/temp 0440 root system_fw - -t /sys/class/thermal/*/temp - - - - security.SMACK64="System" -z /sys/class/thermal/*/policy 0440 root system_fw - -t /sys/class/thermal/*/policy - - - - security.SMACK64="System" -z /sys/kernel/debug/cpufreq/*/load_table 0440 root system_fw - -t /sys/kernel/debug/cpufreq/*/load_table - - - - security.SMACK64="System" -z /sys/kernel/debug/cpufreq/*/load_table 0440 root system_fw - -t /sys/kernel/debug/cpufreq/*/load_table - - - - security.SMACK64="System" -z /sys/devices/platform/soc/*/devfreq/*/cur_freq 0440 root system_fw - -t /sys/devices/platform/soc/*/devfreq/*/cur_freq - - - - security.SMACK64="System" -z /sys/devices/platform/soc/*/devfreq/*/governor 0440 root system_fw - -t /sys/devices/platform/soc/*/devfreq/*/governor - - - - security.SMACK64="System" -z /sys/devices/platform/soc/*/devfreq/*/min_freq 0660 root system_fw - -t /sys/devices/platform/soc/*/devfreq/*/min_freq - - - - security.SMACK64="System" -z /sys/devices/platform/soc/*/devfreq/*/max_freq 0660 root system_fw - -t /sys/devices/platform/soc/*/devfreq/*/max_freq - - - - security.SMACK64="System" -- 2.7.4 From 306c76690c074c5a87dd9377c1680137a0a496ff Mon Sep 17 00:00:00 2001 From: Wook Song Date: Wed, 23 Aug 2017 10:29:35 +0900 Subject: [PATCH 13/16] pass-hal: tm2: Change the way to restart daemon after install/uninstall This patch simply changes the way to restart the pass daemon after installing or uninstalling this package. 'awk' is no longer needed. Note that the option 'try-restart' of systemctl is to restart one or more units (in this context, means the pass daemon) if active. Change-Id: I29f996dd05af0d681a1f3ce31f13c835fe5835ea Signed-off-by: Wook Song --- packaging/pass-hal-tm2.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index ba28c02..f6f0200 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -13,7 +13,9 @@ Source1: %{name}.manifest ExclusiveArch: %{arm} aarch64 Requires(post): /sbin/ldconfig +Requires(post): /bin/systemctl Requires(postun): /sbin/ldconfig +Requires(postun): /bin/systemctl Requires: pass >= 0.0.1 Requires: pass-hal-standard >= 0.0.1 BuildRequires: cmake @@ -38,13 +40,13 @@ rm -rf %{buildroot} %post /sbin/ldconfig if [ -f %{_unitdir}/pass.service ]; then - systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' + systemctl try-restart pass.service fi %postun /sbin/ldconfig if [ -f %{_unitdir}/pass.service ]; then - systemctl | grep pass.service | awk '{if ($3 == "active" && $4 == "running") system("systemctl restart pass.service")}' + systemctl try-restart pass.service fi %files -- 2.7.4 From 060694ee21f7ed754b17937fe957f401e5b4ed8a Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Mon, 28 Aug 2017 13:12:21 +0900 Subject: [PATCH 14/16] pass-hal: tm2: Add pass-resource5.conf for memory h/w device This patch adds the new resource configuration for the memory h/w device in order to handle the 'fault_around_bytes'[1] element. The 'fault_around_bytes' indicates the number of bytes to be mapped around the fault. If the value is low(e.g., 4096), it is able to increase the empty memory on normal case. On the other hand, if the value is high (e.g., 65536), it is able to improve the performance by mapping the huge pages such as the app launching. [1] https://lkml.org/lkml/2016/4/18/612 Change-Id: Icc280c4eaf82420eaafcc8611b9869a2738831e2 Signed-off-by: Chanwoo Choi --- CMakeLists.txt | 1 + packaging/pass-hal-tm2.spec | 1 + scripts/pass-resource5.conf | 33 +++++++++++++++++++++++++++++++++ scripts/pass.conf | 7 ++++++- 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 scripts/pass-resource5.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 47f6d89..fa7ef56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,3 +16,4 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource1.conf DESTINATIO INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource2.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource3.conf DESTINATION /etc/pass) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource4.conf DESTINATION /etc/pass) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/pass-resource5.conf DESTINATION /etc/pass) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index f6f0200..304de0b 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -58,3 +58,4 @@ fi %config %{_sysconfdir}/pass/pass-resource2.conf %config %{_sysconfdir}/pass/pass-resource3.conf %config %{_sysconfdir}/pass/pass-resource4.conf +%config %{_sysconfdir}/pass/pass-resource5.conf diff --git a/scripts/pass-resource5.conf b/scripts/pass-resource5.conf new file mode 100644 index 0000000..2a17227 --- /dev/null +++ b/scripts/pass-resource5.conf @@ -0,0 +1,33 @@ +[Pass] +pass_support=1 +pass_gov_type=0 + +pass_num_levels=2 +pass_init_level=0 +pass_min_level=0 +pass_max_level=1 + +[Level0] +fault_around_bytes=4096 + +[Level1] +fault_around_bytes=65536 + +############################ +### Add list of scenario ### +############################ +[PassScenario] +pass_scenario_support=yes +pass_num_scenarios=2 + +[Scenario0] +name=AppLaunch +support=yes +min_level=1 +max_level=1 + +[Scenario1] +name=UltraPowerSaving +support=yes +min_level=0 +max_level=0 diff --git a/scripts/pass.conf b/scripts/pass.conf index 8575acb..2b1a81e 100644 --- a/scripts/pass.conf +++ b/scripts/pass.conf @@ -4,7 +4,7 @@ [PassResource] pass_compatible=samsung,tm2 pass_path_compatible=/proc/device-tree/compatible -pass_num_resources=5 +pass_num_resources=6 [PassResource0] pass_res_type=cpu @@ -39,3 +39,8 @@ pass_res_type=gpu pass_res_name=14ac0000.mali pass_res_thermal_name=thermal_zone2 pass_path_conf_file=/etc/pass/pass-resource4.conf + +[PassResource5] +pass_res_type=memory +pass_res_name=memory +pass_path_conf_file=/etc/pass/pass-resource5.conf -- 2.7.4 From 654ff9167c281d2ea3c4365f1b5954f05bd6fe98 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Wed, 13 Sep 2017 14:28:11 +0900 Subject: [PATCH 15/16] pass-hal: tm2: Change the resource name for bus/gpu and frequency of bus device The devfreq framework in the mainline kernel uses the 'devfreqX' format for the device name through sysfs. According to the changed resource name of memory bus/GPU on TM2, this patch changes the resource name. And, the previous frequency of MIF (Memory Interface) in the pass-resource3.conf used the frequency of DMC (Dyanamic Memory Controller) instead of the real MIF's frequency. So, this patch changes the real frequency for MIF block. Change-Id: I39d61d2a8f75abc189fb24c7d55465d7b137c6c0 Signed-off-by: Chanwoo Choi --- scripts/pass-resource3.conf | 10 +++++----- scripts/pass.conf | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/pass-resource3.conf b/scripts/pass-resource3.conf index 2b8b368..080e9fb 100644 --- a/scripts/pass-resource3.conf +++ b/scripts/pass-resource3.conf @@ -8,19 +8,19 @@ pass_min_level=0 pass_max_level=4 [Level0] -limit_min_freq=78000000 +limit_min_freq=138000000 [Level1] -limit_min_freq=413000000 +limit_min_freq=165000000 [Level2] -limit_min_freq=543000000 +limit_min_freq=207000000 [Level3] -limit_min_freq=667000000 +limit_min_freq=275000000 [Level4] -limit_min_freq=825000000 +limit_min_freq=413000000 ############################ ### Add list of scenario ### diff --git a/scripts/pass.conf b/scripts/pass.conf index 2b1a81e..45ddf3b 100644 --- a/scripts/pass.conf +++ b/scripts/pass.conf @@ -26,17 +26,17 @@ pass_num_cpus=4 [PassResource2] pass_res_type=bus -pass_res_name=soc:memory_bus@0 +pass_res_name=devfreq1 pass_path_conf_file=/etc/pass/pass-resource2.conf [PassResource3] pass_res_type=bus -pass_res_name=soc:memory_bus@1 +pass_res_name=devfreq11 pass_path_conf_file=/etc/pass/pass-resource3.conf [PassResource4] pass_res_type=gpu -pass_res_name=14ac0000.mali +pass_res_name=devfreq0 pass_res_thermal_name=thermal_zone2 pass_path_conf_file=/etc/pass/pass-resource4.conf -- 2.7.4 From d1ab43e6fde2b06e08d4d9a45aa71bc2be3c2c53 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 12 Oct 2017 17:30:51 +0900 Subject: [PATCH 16/16] pass-hal: tm2: Disable AppLaunch scenario for memory h/w resource This patch disables the 'AppLaunch' scenario for memorh h/w resource in order to keep the 4096 byte of the fault_around_bytes. Change-Id: Ic5d9cea2252b34e62e1bda11b75e28e4831b6676 Signed-off-by: Chanwoo Choi --- scripts/pass-resource5.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pass-resource5.conf b/scripts/pass-resource5.conf index 2a17227..f1f2703 100644 --- a/scripts/pass-resource5.conf +++ b/scripts/pass-resource5.conf @@ -22,7 +22,7 @@ pass_num_scenarios=2 [Scenario0] name=AppLaunch -support=yes +support=no min_level=1 max_level=1 -- 2.7.4