From 2618c4605ceef0fb6b94552aa9b8258c9e01df88 Mon Sep 17 00:00:00 2001 From: Wook Song Date: Wed, 8 Feb 2017 14:45:41 +0900 Subject: [PATCH 02/15] pass-hal: tm2: Create spec file for RPM package This patch creates files required to build the RPM package. Although it is possible to build the package, only one empty RPM file would be created since source files are not implemented yet. Change-Id: I5d573623669d2284d8b285af67faa54cc0fe6cef Signed-off-by: Wook Song --- CMakeLists.txt | 16 ++++++++++++++++ packaging/pass-hal-tm2.manifest | 5 +++++ packaging/pass-hal-tm2.spec | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 packaging/pass-hal-tm2.manifest create mode 100644 packaging/pass-hal-tm2.spec diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..78f784c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,16 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.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) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(DEST_DIR ${LIB_INSTALL_DIR}/pass) diff --git a/packaging/pass-hal-tm2.manifest b/packaging/pass-hal-tm2.manifest new file mode 100644 index 0000000..75b0fa5 --- /dev/null +++ b/packaging/pass-hal-tm2.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec new file mode 100644 index 0000000..68f4213 --- /dev/null +++ b/packaging/pass-hal-tm2.spec @@ -0,0 +1,36 @@ +%define version 0.0.1 +%define release 1 + +Name: pass-hal-tm2 +Summary: PASS hal for TM2 +Version: %{version} +Release: %{release} +Group: System/Hardware Adaptation +License: Apache-2.0 +Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest +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 + +%prep +%setup -q +cp %{SOURCE1} . + +%build +%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DHAL_VERSION=%{version}.%{release} + +make %{?jobs:-j%jobs} + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%manifest %{name}.manifest -- 2.7.4 From dc1bc98362ef5358502d8b2ce6606d2431db856e Mon Sep 17 00:00:00 2001 From: Wook Song Date: Wed, 8 Feb 2017 14:57:22 +0900 Subject: [PATCH 03/15] pass-hal: tm2: Add implementation of HAL for CPU This patch adds an implementation of the PASS HAL for CPU. Change-Id: I74afc0c021ad462e1630d84bbe922ee3fac52b6e Signed-off-by: Wook Song --- CMakeLists.txt | 2 + packaging/pass-hal-tm2.spec | 6 + src/cpu/CMakeLists.txt | 24 +++ src/cpu/cpu.c | 403 ++++++++++++++++++++++++++++++++++++++++++++ src/shared/sysfs.c | 110 ++++++++++++ src/shared/sysfs.h | 6 + 6 files changed, 551 insertions(+) create mode 100644 src/cpu/CMakeLists.txt create mode 100644 src/cpu/cpu.c create mode 100644 src/shared/sysfs.c create mode 100644 src/shared/sysfs.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 78f784c..116648e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,3 +14,5 @@ ENDFOREACH(flag) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(DEST_DIR ${LIB_INSTALL_DIR}/pass) + +ADD_SUBDIRECTORY(src/cpu) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 68f4213..2752cf8 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -28,9 +28,15 @@ cp %{SOURCE1} . make %{?jobs:-j%jobs} +%install +rm -rf %{buildroot} + +%make_install + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %manifest %{name}.manifest +%{_libdir}/pass/*.so diff --git a/src/cpu/CMakeLists.txt b/src/cpu/CMakeLists.txt new file mode 100644 index 0000000..3cd62b8 --- /dev/null +++ b/src/cpu/CMakeLists.txt @@ -0,0 +1,24 @@ +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 new file mode 100644 index 0000000..a9e23bc --- /dev/null +++ b/src/cpu/cpu.c @@ -0,0 +1,403 @@ +#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/thermal_zone" +#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]; + 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; + if ((cpu < TM2_CPU_MIN_NUM) || (cpu > TM2_CPU_MAX_NUM)) + 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 ((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; + + /* TODO: Can we turn off CPU0? */ + + 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, +}; + +static int tm2_tmu_get_temp(char *res_name) +{ + char path[PATH_MAX]; + int tz_num, temp; + int ret; + + if (!res_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", + TMU_PATH_PREFIX, + tz_num, + 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_name, char *policy) +{ + char path[PATH_MAX]; + int ret, tz_num; + + if ((!res_name) || (!policy)) + 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", + TMU_PATH_PREFIX, + tz_num, + 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(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(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, + .author = "Wook Song ", + .open = tm2_cpu_open, + .close = tm2_cpu_close, +}; diff --git a/src/shared/sysfs.c b/src/shared/sysfs.c new file mode 100644 index 0000000..9217b40 --- /dev/null +++ b/src/shared/sysfs.c @@ -0,0 +1,110 @@ +#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 new file mode 100644 index 0000000..174804f --- /dev/null +++ b/src/shared/sysfs.h @@ -0,0 +1,6 @@ +#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 cffce96c189f7599fbd4338ef6d0b138a24e8a6f Mon Sep 17 00:00:00 2001 From: Wook Song Date: Wed, 8 Feb 2017 15:12:44 +0900 Subject: [PATCH 04/15] pass-hal: tm2: Add implementation of HAL for BUS This patch adds an implementation of the PASS HAL for BUS. Change-Id: Idf118b9df51c0fad13e0d5db8d1ff58a541a7aab Signed-off-by: Wook Song --- CMakeLists.txt | 1 + src/bus/CMakeLists.txt | 24 ++++++ src/bus/bus.c | 230 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 src/bus/CMakeLists.txt create mode 100644 src/bus/bus.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 116648e..92efed1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,3 +16,4 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(DEST_DIR ${LIB_INSTALL_DIR}/pass) ADD_SUBDIRECTORY(src/cpu) +ADD_SUBDIRECTORY(src/bus) diff --git a/src/bus/CMakeLists.txt b/src/bus/CMakeLists.txt new file mode 100644 index 0000000..2bca621 --- /dev/null +++ b/src/bus/CMakeLists.txt @@ -0,0 +1,24 @@ +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 new file mode 100644 index 0000000..b9d8c95 --- /dev/null +++ b/src/bus/bus.c @@ -0,0 +1,230 @@ +#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/devices/platform/soc/" +#define DEVFREQ_BUS_PATH_INFIX "/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%s%s", + DEVFREQ_BUS_PATH_PREFIX, + res_name, + DEVFREQ_BUS_PATH_INFIX, + 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%s%s", + DEVFREQ_BUS_PATH_PREFIX, + res_name, + DEVFREQ_BUS_PATH_INFIX, + 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%s%s", + DEVFREQ_BUS_PATH_PREFIX, + res_name, + DEVFREQ_BUS_PATH_INFIX, + 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%s%s", + DEVFREQ_BUS_PATH_PREFIX, + res_name, + DEVFREQ_BUS_PATH_INFIX, + 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%s%s", + DEVFREQ_BUS_PATH_PREFIX, + res_name, + DEVFREQ_BUS_PATH_INFIX, + 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%s%s", + DEVFREQ_BUS_PATH_PREFIX, + res_name, + DEVFREQ_BUS_PATH_INFIX, + 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%s%s", + DEVFREQ_BUS_PATH_PREFIX, + res_name, + DEVFREQ_BUS_PATH_INFIX, + 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(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(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, + .author = "Wook Song ", + .open = tm2_bus_open, + .close = tm2_bus_close, +}; -- 2.7.4 From a89a42404931ddc6a28fa2ea68beff3d7b57068a Mon Sep 17 00:00:00 2001 From: Wook Song Date: Wed, 8 Feb 2017 15:26:18 +0900 Subject: [PATCH 05/15] pass-hal: tm2: Add implementation of HAL for GPU This patch adds an implementation of the PASS HAL for GPU. Change-Id: I1002bcce81c7ff35ef46ab09ceaed27a255a5611 Signed-off-by: Wook Song --- CMakeLists.txt | 1 + src/gpu/CMakeLists.txt | 24 +++++ src/gpu/gpu.c | 283 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 308 insertions(+) create mode 100644 src/gpu/CMakeLists.txt create mode 100644 src/gpu/gpu.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 92efed1..e9131cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,3 +17,4 @@ SET(DEST_DIR ${LIB_INSTALL_DIR}/pass) ADD_SUBDIRECTORY(src/cpu) ADD_SUBDIRECTORY(src/bus) +ADD_SUBDIRECTORY(src/gpu) diff --git a/src/gpu/CMakeLists.txt b/src/gpu/CMakeLists.txt new file mode 100644 index 0000000..4425ca0 --- /dev/null +++ b/src/gpu/CMakeLists.txt @@ -0,0 +1,24 @@ +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 new file mode 100644 index 0000000..28a8ffd --- /dev/null +++ b/src/gpu/gpu.c @@ -0,0 +1,283 @@ +#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/devices/platform/soc/" +#define DEVFREQ_GPU_PATH_INFIX "/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/thermal_zone" +#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]; + int ret; + + if ((!res_name) || (!governor)) + return -EINVAL; + + snprintf(path, PATH_MAX, "%s%s%s%s%s", + DEVFREQ_GPU_PATH_PREFIX, + res_name, + DEVFREQ_GPU_PATH_INFIX, + 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%s%s", + DEVFREQ_GPU_PATH_PREFIX, + res_name, + DEVFREQ_GPU_PATH_INFIX, + 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%s%s", + DEVFREQ_GPU_PATH_PREFIX, + res_name, + DEVFREQ_GPU_PATH_INFIX, + 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%s%s", + DEVFREQ_GPU_PATH_PREFIX, + res_name, + DEVFREQ_GPU_PATH_INFIX, + 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%s%s", + DEVFREQ_GPU_PATH_PREFIX, + res_name, + DEVFREQ_GPU_PATH_INFIX, + 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%s%s", + DEVFREQ_GPU_PATH_PREFIX, + res_name, + DEVFREQ_GPU_PATH_INFIX, + 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%s%s", + DEVFREQ_GPU_PATH_PREFIX, + res_name, + DEVFREQ_GPU_PATH_INFIX, + 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_name) +{ + char path[PATH_MAX]; + int temp; + int ret; + + if (!res_name) + return -EINVAL; + + snprintf(path, PATH_MAX, "%s%d%s", + TMU_PATH_PREFIX, + TM2_GPU_THERMAL_ZONE_NUM, + 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_name, char *policy) +{ + char path[PATH_MAX]; + int ret; + + if ((!res_name) || (!policy)) + return -EINVAL; + + snprintf(path, PATH_MAX, "%s%d%s", + TMU_PATH_PREFIX, + TM2_GPU_THERMAL_ZONE_NUM, + 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(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(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, + .author = "Wook Song ", + .open = tm2_gpu_open, + .close = tm2_gpu_close, +}; -- 2.7.4 From 42d0c4fb6b84b4275cb931473723f04ce21abe16 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 9 Feb 2017 18:52:25 +0900 Subject: [PATCH 06/15] pass-hal: tm2: Modify the sysfs path for BUS/GPU resource This patches modifes the default sysfs path for bus/gpu resource as following: Because TM2 uses the devfreq subsystem in Linux Kernel for memory bus and gpu. - /sys/class/devfreq/(devfreq device name) Signed-off-by: Chanwoo Choi --- src/bus/bus.c | 31 ++++++++----------------------- src/gpu/gpu.c | 31 ++++++++----------------------- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/src/bus/bus.c b/src/bus/bus.c index b9d8c95..e4c7bbf 100644 --- a/src/bus/bus.c +++ b/src/bus/bus.c @@ -12,8 +12,7 @@ #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/devices/platform/soc/" -#define DEVFREQ_BUS_PATH_INFIX "/devfreq/" +#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" @@ -27,11 +26,9 @@ static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) if ((!res_name) || (!governor)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_BUS_PATH_PREFIX, res_name, - DEVFREQ_BUS_PATH_INFIX, - res_name, DEVFREQ_BUS_CURR_GOVERNOR_PATH_SUFFIX); ret = sysfs_read_str(path, governor, BUFF_MAX); @@ -49,11 +46,9 @@ static int tm2_dvfs_set_curr_governor(char *res_name, char *governor) if ((!res_name) || (!governor)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_BUS_PATH_PREFIX, res_name, - DEVFREQ_BUS_PATH_INFIX, - res_name, DEVFREQ_BUS_CURR_GOVERNOR_PATH_SUFFIX); ret = sysfs_write_str(path, governor); @@ -71,11 +66,9 @@ static int tm2_dvfs_get_curr_freq(char *res_name) if (!res_name) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_BUS_PATH_PREFIX, res_name, - DEVFREQ_BUS_PATH_INFIX, - res_name, DEVFREQ_BUS_CURR_FREQ_PATH_SUFFIX); ret = sysfs_read_int(path, &freq); @@ -93,11 +86,9 @@ static int tm2_dvfs_get_min_freq(char *res_name) if (!res_name) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_BUS_PATH_PREFIX, res_name, - DEVFREQ_BUS_PATH_INFIX, - res_name, DEVFREQ_BUS_MIN_FREQ_PATH_SUFFIX); ret = sysfs_read_int(path, &freq); @@ -115,11 +106,9 @@ static int tm2_dvfs_set_min_freq(char *res_name, int freq) if ((!res_name) || (freq < 0)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_BUS_PATH_PREFIX, res_name, - DEVFREQ_BUS_PATH_INFIX, - res_name, DEVFREQ_BUS_MIN_FREQ_PATH_SUFFIX); ret = sysfs_write_int(path, freq); @@ -137,11 +126,9 @@ static int tm2_dvfs_get_max_freq(char *res_name) if (!res_name) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_BUS_PATH_PREFIX, res_name, - DEVFREQ_BUS_PATH_INFIX, - res_name, DEVFREQ_BUS_MAX_FREQ_PATH_SUFFIX); ret = sysfs_read_int(path, &freq); @@ -159,11 +146,9 @@ static int tm2_dvfs_set_max_freq(char *res_name, int freq) if ((!res_name) || (freq < 0)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_BUS_PATH_PREFIX, res_name, - DEVFREQ_BUS_PATH_INFIX, - res_name, DEVFREQ_BUS_MAX_FREQ_PATH_SUFFIX); ret = sysfs_write_int(path, freq); diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index 28a8ffd..3ef3c10 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -12,8 +12,7 @@ #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/devices/platform/soc/" -#define DEVFREQ_GPU_PATH_INFIX "/devfreq/" +#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" @@ -33,11 +32,9 @@ static int tm2_dvfs_get_curr_governor(char *res_name, char *governor) if ((!res_name) || (!governor)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_GPU_PATH_PREFIX, res_name, - DEVFREQ_GPU_PATH_INFIX, - res_name, DEVFREQ_GPU_CURR_GOVERNOR_PATH_SUFFIX); ret = sysfs_read_str(path, governor, BUFF_MAX); @@ -55,11 +52,9 @@ static int tm2_dvfs_set_curr_governor(char *res_name, char *governor) if ((!res_name) || (!governor)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_GPU_PATH_PREFIX, res_name, - DEVFREQ_GPU_PATH_INFIX, - res_name, DEVFREQ_GPU_CURR_GOVERNOR_PATH_SUFFIX); ret = sysfs_write_str(path, governor); @@ -77,11 +72,9 @@ static int tm2_dvfs_get_curr_freq(char *res_name) if (!res_name) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_GPU_PATH_PREFIX, res_name, - DEVFREQ_GPU_PATH_INFIX, - res_name, DEVFREQ_GPU_CURR_FREQ_PATH_SUFFIX); ret = sysfs_read_int(path, &freq); @@ -99,11 +92,9 @@ static int tm2_dvfs_get_min_freq(char *res_name) if (!res_name) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_GPU_PATH_PREFIX, res_name, - DEVFREQ_GPU_PATH_INFIX, - res_name, DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX); ret = sysfs_read_int(path, &freq); @@ -121,11 +112,9 @@ static int tm2_dvfs_set_min_freq(char *res_name, int freq) if ((!res_name) || (freq < 0)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_GPU_PATH_PREFIX, res_name, - DEVFREQ_GPU_PATH_INFIX, - res_name, DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX); ret = sysfs_write_int(path, freq); @@ -143,11 +132,9 @@ static int tm2_dvfs_get_max_freq(char *res_name) if (!res_name) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_GPU_PATH_PREFIX, res_name, - DEVFREQ_GPU_PATH_INFIX, - res_name, DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX); ret = sysfs_read_int(path, &freq); @@ -165,11 +152,9 @@ static int tm2_dvfs_set_max_freq(char *res_name, int freq) if ((!res_name) || (freq < 0)) return -EINVAL; - snprintf(path, PATH_MAX, "%s%s%s%s%s", + snprintf(path, PATH_MAX, "%s%s%s", DEVFREQ_GPU_PATH_PREFIX, res_name, - DEVFREQ_GPU_PATH_INFIX, - res_name, DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX); ret = sysfs_write_int(path, freq); -- 2.7.4 From daed400de5365da7bc22cfbf024ea3f1c19ad72a Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 10 Feb 2017 13:10:07 +0900 Subject: [PATCH 07/15] pass-hal: tm2: Add the configuration files for resources This patch adds the new configuration files for resources of TM2 board. - pass.conf contains the number of supported resources and the information of each resource such as CPU, BUS and GPU. - pass-resource0.conf is the configuration file for LITTLE Cores on TM2. - pass-resource1.conf is the configuration file for big Cores on TM2. - pass-resource2.conf is the configuration file for Memory Bus (INT block) on TM2. - pass-resource3.conf is the configuration file for Memory Bus (MFI block) on TM2. - pass-resource4.conf is the configuration file for MALI GPU on TM2. Change-Id: Idd77b63c12a96633ed1feed327513db92e4ead33 Signed-off-by: Chanwoo Choi --- CMakeLists.txt | 7 + packaging/pass-hal-tm2.spec | 7 + scripts/pass-resource0.conf | 409 +++++++++++++++++++++++++++++++++++ scripts/pass-resource1.conf | 509 ++++++++++++++++++++++++++++++++++++++++++++ scripts/pass-resource2.conf | 260 ++++++++++++++++++++++ scripts/pass-resource3.conf | 263 +++++++++++++++++++++++ scripts/pass-resource4.conf | 263 +++++++++++++++++++++++ scripts/pass.conf | 37 ++++ 8 files changed, 1755 insertions(+) create mode 100644 scripts/pass-resource0.conf create mode 100644 scripts/pass-resource1.conf create mode 100644 scripts/pass-resource2.conf create mode 100644 scripts/pass-resource3.conf create mode 100644 scripts/pass-resource4.conf create mode 100644 scripts/pass.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index e9131cf..35033cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,3 +18,10 @@ 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) +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) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 2752cf8..77e2b4c 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -40,3 +40,10 @@ rm -rf %{buildroot} %files %manifest %{name}.manifest %{_libdir}/pass/*.so + +%config %{_sysconfdir}/pass/pass.conf +%config %{_sysconfdir}/pass/pass-resource0.conf +%config %{_sysconfdir}/pass/pass-resource1.conf +%config %{_sysconfdir}/pass/pass-resource2.conf +%config %{_sysconfdir}/pass/pass-resource3.conf +%config %{_sysconfdir}/pass/pass-resource4.conf diff --git a/scripts/pass-resource0.conf b/scripts/pass-resource0.conf new file mode 100644 index 0000000..98a73d6 --- /dev/null +++ b/scripts/pass-resource0.conf @@ -0,0 +1,409 @@ +[Pass] +pass_compatible=samsung,tm2 +pass_support=1 +pass_gov_type=2 + +pass_num_levels=12 +pass_init_level=4 +pass_min_level=4 +pass_max_level=11 + +pass_cpu_threshold=60 +pass_up_threshold=50 +pass_down_threshold=30 + +pass_num_cpu_stats=20 + +pass_level_up_threshold=1 +pass_governor_timeout=0.4 + +[Level0] +limit_max_freq=1000000 +limit_min_cpu=1 +num_down_cond=0 +num_up_cond=1 +num_up_cond_freq=800000 +num_left_cond=0 +num_right_cond=1 +num_right_cond_nr_running=100 +num_right_cond_busy_cpu=1 + +[Level1] +limit_max_freq=1000000 +limit_min_cpu=2 +num_down_cond=0 +num_up_cond=1 +num_up_cond_freq=800000 +num_left_cond=1 +num_left_cond_nr_running=100 +num_left_cond_busy_cpu=1 +num_right_cond=1 +num_right_cond_nr_running=200 +num_right_cond_busy_cpu=2 + +[Level2] +limit_max_freq=1000000 +limit_min_cpu=3 +num_down_cond=0 +num_up_cond=1 +num_up_cond_freq=800000 +num_left_cond=1 +num_left_cond_nr_running=200 +num_left_cond_busy_cpu=2 +num_right_cond=1 +num_right_cond_nr_running=300 +num_right_cond_busy_cpu=3 + +[Level3] +limit_max_freq=1000000 +limit_min_cpu=4 +num_down_cond=0 +num_up_cond=1 +num_up_cond_freq=800000 +num_left_cond=1 +num_left_cond_nr_running=300 +num_left_cond_busy_cpu=3 +num_right_cond=0 + +[Level4] +limit_max_freq=1200000 +limit_min_cpu=1 +num_down_cond=1 +num_down_cond_freq=1000000 +num_up_cond=1 +num_up_cond_freq=1200000 +num_left_cond=0 +num_right_cond=1 +num_right_cond_nr_running=100 +num_right_cond_busy_cpu=1 + +[Level5] +limit_max_freq=1200000 +limit_min_cpu=2 +num_down_cond=1 +num_down_cond_freq=1000000 +num_up_cond=1 +num_up_cond_freq=1200000 +num_left_cond=1 +num_left_cond_nr_running=100 +num_left_cond_busy_cpu=1 +num_right_cond=1 +num_right_cond_nr_running=200 +num_right_cond_busy_cpu=2 + +[Level6] +limit_max_freq=1200000 +limit_min_cpu=3 +num_down_cond=1 +num_down_cond_freq=1000000 +num_up_cond=1 +num_up_cond_freq=1200000 +num_left_cond=1 +num_left_cond_nr_running=200 +num_left_cond_busy_cpu=2 +num_right_cond=1 +num_right_cond_nr_running=300 +num_right_cond_busy_cpu=3 + +[Level7] +limit_max_freq=1200000 +limit_min_cpu=4 +num_down_cond=1 +num_down_cond_freq=1000000 +num_up_cond=1 +num_up_cond_freq=1200000 +num_left_cond=1 +num_left_cond_nr_running=300 +num_left_cond_busy_cpu=3 +num_right_cond=0 + +[Level8] +limit_max_freq=1300000 +limit_min_cpu=1 +num_down_cond=1 +num_down_cond_freq=1200000 +num_up_cond=1 +num_up_cond_freq=1300000 +num_left_cond=0 +num_right_cond=1 +num_right_cond_nr_running=100 +num_right_cond_busy_cpu=1 + +[Level9] +limit_max_freq=1300000 +limit_min_cpu=2 +num_down_cond=1 +num_down_cond_freq=1200000 +num_up_cond=1 +num_up_cond_freq=1300000 +num_left_cond=1 +num_left_cond_nr_running=100 +num_left_cond_busy_cpu=1 +num_right_cond=1 +num_right_cond_nr_running=200 +num_right_cond_busy_cpu=2 + +[Level10] +limit_max_freq=1300000 +limit_min_cpu=3 +num_down_cond=1 +num_down_cond_freq=1200000 +num_up_cond=1 +num_up_cond_freq=1300000 +num_left_cond=1 +num_left_cond_nr_running=200 +num_left_cond_busy_cpu=2 +num_right_cond=1 +num_right_cond_nr_running=300 +num_right_cond_busy_cpu=3 + +[Level11] +limit_max_freq=1300000 +limit_min_cpu=4 +num_down_cond=1 +num_down_cond_freq=1200000 +num_up_cond=1 +num_up_cond_freq=1300000 +num_left_cond=1 +num_left_cond_nr_running=300 +num_left_cond_busy_cpu=3 +num_right_cond=0 + +############################ +### Add list of scenario ### +############################ +[PassScenario] +pass_scenario_support=yes +pass_num_scenarios=52 + +[Scenario0] +name=AppLaunch +support=yes + +min_level=9 +max_level=11 + +[Scenario1] +name=AppLaunchHome +support=yes + +min_level=9 +max_level=11 + +[Scenario2] +name=BeautyShot +support=no + +[Scenario3] +name=Browser +support=no + +[Scenario4] +name=BrowserDash +support=no + +[Scenario5] +name=BrowserJavaScript +support=yes + +min_level=9 +max_level=11 + +[Scenario6] +name=BrowserLoading +support=no + +[Scenario7] +name=BrowserScroll +support=no + +[Scenario8] +name=CallSound +support=no + +[Scenario9] +name=CameraBurstShot +support=no + +[Scenario10] +name=CameraCaptureAtRec +support=no + +[Scenario11] +name=CameraPreview +support=no + +[Scenario12] +name=CameraSoundAndShot +support=no + +[Scenario13] +name=ContactSearch +support=no + +[Scenario14] +name=Emergency +support=no + +[Scenario15] +name=GalleryScroll +support=no + +[Scenario16] +name=GalleryRotation +support=no + +[Scenario17] +name=GetDefaultLockTime +support=no + +[Scenario18] +name=GpsSerialCno +support=no + +[Scenario19] +name=GpuBoost +support=no + +[Scenario20] +name=GpuWakeup +support=no + +[Scenario21] +name=HomeScreen +support=no + +[Scenario22] +name=ImageViewer +support=no + +[Scenario23] +name=IMEInput +support=no + +[Scenario24] +name=LockScreen +support=no + +[Scenario25] +name=LowBattery +support=no + +[Scenario26] +name=MtpSendFile +support=no + +[Scenario27] +name=MusicPlayLcdOn +support=no + +[Scenario28] +name=PowerSaving +support=no + +[Scenario29] +name=ProcessCrashed +support=no + +[Scenario30] +name=ReservedMode +support=no + +[Scenario31] +name=ScreenMirroring +support=no + +[Scenario32] +name=SmemoZoom +support=no + +[Scenario33] +name=SVoice +support=no + +[Scenario34] +name=WebappLaunch +support=no + +[Scenario35] +name=WifiThroughput +support=no + +[Scenario36] +name=PowerOff +support=no + +[Scenario37] +name=WebAppDrag +support=no + +[Scenario38] +name=WebAppFlick +support=no + +[Scenario39] +name=SensorWakeup +support=no + +[Scenario40] +name=UgLaunch +support=no + +[Scenario41] +name=MusicScroll +support=no + +[Scenario42] +name=FileScroll +support=no + +[Scenario43] +name=VideoScroll +support=no + +[Scenario44] +name=EmailScroll +support=yes + +min_level=9 +max_level=11 + +[Scenario45] +name=ContactScroll +support=no + +[Scenario46] +name=TizenStoreScroll +support=yes + +min_level=9 +max_level=11 + +[Scenario47] +name=CallLogScroll +support=yes + +min_level=9 +max_level=11 + +[Scenario48] +name=MyfilesScroll +support=yes + +min_level=9 +max_level=11 + +[Scenario49] +name=MessageScroll +support=yes + +min_level=9 +max_level=11 + +[Scenario50] +name=SIOP +support=no + +[Scenario51] +name=UltraPowerSaving +support=no diff --git a/scripts/pass-resource1.conf b/scripts/pass-resource1.conf new file mode 100644 index 0000000..9f65eee --- /dev/null +++ b/scripts/pass-resource1.conf @@ -0,0 +1,509 @@ +[Pass] +pass_compatible=samsung,tm2 +pass_support=1 +pass_gov_type=2 + +pass_num_levels=20 +pass_init_level=4 +pass_min_level=4 +pass_max_level=19 + +pass_cpu_threshold=80 +pass_up_threshold=60 +pass_down_threshold=30 + +pass_num_cpu_stats=20 + +pass_level_up_threshold=1 +pass_governor_timeout=0.4 + +[Level0] +limit_max_freq=1000000 +limit_min_cpu=1 +num_down_cond=0 +num_up_cond=1 +num_up_cond_freq=1000000 +num_left_cond=0 +num_right_cond=1 +num_right_cond_nr_running=100 +num_right_cond_busy_cpu=1 + +[Level1] +limit_max_freq=1000000 +limit_min_cpu=2 +num_down_cond=0 +num_up_cond=1 +num_up_cond_freq=1000000 +num_left_cond=1 +num_left_cond_nr_running=100 +num_left_cond_busy_cpu=1 +num_right_cond=1 +num_right_cond_nr_running=200 +num_right_cond_busy_cpu=2 + +[Level2] +limit_max_freq=1000000 +limit_min_cpu=3 +num_down_cond=0 +num_up_cond=1 +num_up_cond_freq=1000000 +num_left_cond=1 +num_left_cond_nr_running=200 +num_left_cond_busy_cpu=2 +num_right_cond=1 +num_right_cond_nr_running=300 +num_right_cond_busy_cpu=3 + +[Level3] +limit_max_freq=1000000 +limit_min_cpu=4 +num_down_cond=0 +num_up_cond=1 +num_up_cond_freq=1000000 +num_left_cond=1 +num_left_cond_nr_running=300 +num_left_cond_busy_cpu=3 +num_right_cond=0 + +[Level4] +limit_max_freq=1200000 +limit_min_cpu=1 +num_down_cond=1 +num_down_cond_freq=1000000 +num_up_cond=1 +num_up_cond_freq=1200000 +num_left_cond=0 +num_right_cond=1 +num_right_cond_nr_running=100 +num_right_cond_busy_cpu=1 + +[Level5] +limit_max_freq=1200000 +limit_min_cpu=2 +num_down_cond=1 +num_down_cond_freq=1000000 +num_up_cond=1 +num_up_cond_freq=1200000 +num_left_cond=1 +num_left_cond_nr_running=100 +num_left_cond_busy_cpu=1 +num_right_cond=1 +num_right_cond_nr_running=200 +num_right_cond_busy_cpu=2 + +[Level6] +limit_max_freq=1200000 +limit_min_cpu=3 +num_down_cond=1 +num_down_cond_freq=1000000 +num_up_cond=1 +num_up_cond_freq=1200000 +num_left_cond=1 +num_left_cond_nr_running=200 +num_left_cond_busy_cpu=2 +num_right_cond=1 +num_right_cond_nr_running=300 +num_right_cond_busy_cpu=3 + +[Level7] +limit_max_freq=1200000 +limit_min_cpu=4 +num_down_cond=1 +num_down_cond_freq=1000000 +num_up_cond=1 +num_up_cond_freq=1200000 +num_left_cond=1 +num_left_cond_nr_running=300 +num_left_cond_busy_cpu=3 +num_right_cond=0 + +[Level8] +limit_max_freq=1300000 +limit_min_cpu=1 +num_down_cond=1 +num_down_cond_freq=1100000 +num_up_cond=1 +num_up_cond_freq=1300000 +num_left_cond=0 +num_right_cond=1 +num_right_cond_nr_running=100 +num_right_cond_busy_cpu=1 + +[Level9] +limit_max_freq=1300000 +limit_min_cpu=2 +num_down_cond=1 +num_down_cond_freq=1100000 +num_up_cond=1 +num_up_cond_freq=1300000 +num_left_cond=1 +num_left_cond_nr_running=100 +num_left_cond_busy_cpu=1 +num_right_cond=1 +num_right_cond_nr_running=200 +num_right_cond_busy_cpu=2 + +[Level10] +limit_max_freq=1300000 +limit_min_cpu=3 +num_down_cond=1 +num_down_cond_freq=1100000 +num_up_cond=1 +num_up_cond_freq=1300000 +num_left_cond=1 +num_left_cond_nr_running=200 +num_left_cond_busy_cpu=2 +num_right_cond=1 +num_right_cond_nr_running=300 +num_right_cond_busy_cpu=3 + +[Level11] +limit_max_freq=1300000 +limit_min_cpu=4 +num_down_cond=1 +num_down_cond_freq=1100000 +num_up_cond=1 +num_up_cond_freq=1300000 +num_left_cond=1 +num_left_cond_nr_running=300 +num_left_cond_busy_cpu=3 +num_right_cond=0 + +[Level12] +limit_max_freq=1500000 +limit_min_cpu=1 +num_down_cond=1 +num_down_cond_freq=1300000 +num_up_cond=1 +num_up_cond_freq=1500000 +num_left_cond=0 +num_right_cond=1 +num_right_cond_nr_running=100 +num_right_cond_busy_cpu=1 + +[Level13] +limit_max_freq=1500000 +limit_min_cpu=2 +num_down_cond=1 +num_down_cond_freq=1300000 +num_up_cond=1 +num_up_cond_freq=1500000 +num_left_cond=1 +num_left_cond_nr_running=100 +num_left_cond_busy_cpu=1 +num_right_cond=1 +num_right_cond_nr_running=200 +num_right_cond_busy_cpu=2 + +[Level14] +limit_max_freq=1500000 +limit_min_cpu=3 +num_down_cond=1 +num_down_cond_freq=1300000 +num_up_cond=1 +num_up_cond_freq=1500000 +num_left_cond=1 +num_left_cond_nr_running=200 +num_left_cond_busy_cpu=2 +num_right_cond=1 +num_right_cond_nr_running=300 +num_right_cond_busy_cpu=3 + +[Level15] +limit_max_freq=1500000 +limit_min_cpu=4 +num_down_cond=1 +num_down_cond_freq=1300000 +num_up_cond=1 +num_up_cond_freq=1500000 +num_left_cond=1 +num_left_cond_nr_running=300 +num_left_cond_busy_cpu=3 +num_right_cond=0 + +[Level16] +limit_max_freq=1700000 +limit_min_cpu=1 +num_down_cond=1 +num_down_cond_freq=1500000 +num_up_cond=0 +num_left_cond=0 +num_right_cond=1 +num_right_cond_nr_running=100 +num_right_cond_busy_cpu=1 + +[Level17] +limit_max_freq=1700000 +limit_min_cpu=2 +num_down_cond=1 +num_down_cond_freq=1500000 +num_up_cond=0 +num_left_cond=1 +num_left_cond_nr_running=100 +num_left_cond_busy_cpu=1 +num_right_cond=1 +num_right_cond_nr_running=200 +num_right_cond_busy_cpu=2 + +[Level18] +limit_max_freq=1700000 +limit_min_cpu=3 +num_down_cond=1 +num_down_cond_freq=1500000 +num_up_cond=0 +num_left_cond=1 +num_left_cond_nr_running=200 +num_left_cond_busy_cpu=2 +num_right_cond=1 +num_right_cond_nr_running=300 +num_right_cond_busy_cpu=3 + +[Level19] +limit_max_freq=1700000 +limit_min_cpu=4 +num_down_cond=1 +num_down_cond_freq=1500000 +num_up_cond=0 +num_left_cond=1 +num_left_cond_nr_running=300 +num_left_cond_busy_cpu=3 +num_right_cond=0 + +############################ +### Add list of scenario ### +############################ +[PassScenario] +pass_scenario_support=yes +pass_num_scenarios=52 + +[Scenario0] +name=AppLaunch +support=yes + +min_level=13 +max_level=15 + +[Scenario1] +name=AppLaunchHome +support=yes + +min_level=13 +max_level=15 + +[Scenario2] +name=BeautyShot +support=no + +[Scenario3] +name=Browser +support=no + +[Scenario4] +name=BrowserDash +support=no + +[Scenario5] +name=BrowserJavaScript +support=yes + +min_level=13 +max_level=15 + +[Scenario6] +name=BrowserLoading +support=no + +[Scenario7] +name=BrowserScroll +support=no + +[Scenario8] +name=CallSound +support=no + +[Scenario9] +name=CameraBurstShot +support=no + +[Scenario10] +name=CameraCaptureAtRec +support=no + +[Scenario11] +name=CameraPreview +support=no + +[Scenario12] +name=CameraSoundAndShot +support=no + +[Scenario13] +name=ContactSearch +support=no + +[Scenario14] +name=Emergency +support=no + +[Scenario15] +name=GalleryScroll +support=no + +[Scenario16] +name=GalleryRotation +support=no + +[Scenario17] +name=GetDefaultLockTime +support=no + +[Scenario18] +name=GpsSerialCno +support=no + +[Scenario19] +name=GpuBoost +support=no + +[Scenario20] +name=GpuWakeup +support=no + +[Scenario21] +name=HomeScreen +support=no + +[Scenario22] +name=ImageViewer +support=no + +[Scenario23] +name=IMEInput +support=no + +[Scenario24] +name=LockScreen +support=no + +[Scenario25] +name=LowBattery +support=no + +[Scenario26] +name=MtpSendFile +support=no + +[Scenario27] +name=MusicPlayLcdOn +support=no + +[Scenario28] +name=PowerSaving +support=no + +[Scenario29] +name=ProcessCrashed +support=no + +[Scenario30] +name=ReservedMode +support=no + +[Scenario31] +name=ScreenMirroring +support=no + +[Scenario32] +name=SmemoZoom +support=no + +[Scenario33] +name=SVoice +support=no + +[Scenario34] +name=WebappLaunch +support=no + +[Scenario35] +name=WifiThroughput +support=no + +[Scenario36] +name=PowerOff +support=no + +[Scenario37] +name=WebAppDrag +support=no + +[Scenario38] +name=WebAppFlick +support=no + +[Scenario39] +name=SensorWakeup +support=no + +[Scenario40] +name=UgLaunch +support=no + +[Scenario41] +name=MusicScroll +support=no + +[Scenario42] +name=FileScroll +support=no + +[Scenario43] +name=VideoScroll +support=no + +[Scenario44] +name=EmailScroll +support=yes + +min_level=13 +max_level=15 + +[Scenario45] +name=ContactScroll +support=no + +[Scenario46] +name=TizenStoreScroll +support=yes + +min_level=13 +max_level=15 + +[Scenario47] +name=CallLogScroll +support=yes + +min_level=13 +max_level=15 + +[Scenario48] +name=MyfilesScroll +support=yes + +min_level=13 +max_level=15 + +[Scenario49] +name=MessageScroll +support=yes + +min_level=13 +max_level=15 + +[Scenario50] +name=SIOP +support=no + +[Scenario51] +name=UltraPowerSaving +support=no diff --git a/scripts/pass-resource2.conf b/scripts/pass-resource2.conf new file mode 100644 index 0000000..47e42ae --- /dev/null +++ b/scripts/pass-resource2.conf @@ -0,0 +1,260 @@ +[Pass] +pass_compatible=samsung,tm2 +pass_support=1 +pass_gov_type=0 + +pass_num_levels=4 +pass_init_level=0 +pass_min_level=0 +pass_max_level=3 + +[Level0] +limit_min_freq=100000000 + +[Level1] +limit_min_freq=267000000 + +[Level2] +limit_min_freq=334000000 + +[Level3] +limit_min_freq=400000000 + +############################ +### Add list of scenario ### +############################ +[PassScenario] +pass_scenario_support=yes +pass_num_scenarios=52 + +[Scenario0] +name=AppLaunch +support=yes + +min_level=3 +max_level=3 + +[Scenario1] +name=AppLaunchHome +support=yes + +min_level=3 +max_level=3 + +[Scenario2] +name=BeautyShot +support=no + +[Scenario3] +name=Browser +support=no + +[Scenario4] +name=BrowserDash +support=no + +[Scenario5] +name=BrowserJavaScript +support=yes + +min_level=3 +max_level=3 + +[Scenario6] +name=BrowserLoading +support=no + +[Scenario7] +name=BrowserScroll +support=no + +[Scenario8] +name=CallSound +support=no + +[Scenario9] +name=CameraBurstShot +support=no + +[Scenario10] +name=CameraCaptureAtRec +support=no + +[Scenario11] +name=CameraPreview +support=no + +[Scenario12] +name=CameraSoundAndShot +support=no + +[Scenario13] +name=ContactSearch +support=no + +[Scenario14] +name=Emergency +support=no + +[Scenario15] +name=GalleryScroll +support=no + +[Scenario16] +name=GalleryRotation +support=no + +[Scenario17] +name=GetDefaultLockTime +support=no + +[Scenario18] +name=GpsSerialCno +support=no + +[Scenario19] +name=GpuBoost +support=no + +[Scenario20] +name=GpuWakeup +support=no + +[Scenario21] +name=HomeScreen +support=no + +[Scenario22] +name=ImageViewer +support=no + +[Scenario23] +name=IMEInput +support=no + +[Scenario24] +name=LockScreen +support=no + +[Scenario25] +name=LowBattery +support=no + +[Scenario26] +name=MtpSendFile +support=no + +[Scenario27] +name=MusicPlayLcdOn +support=no + +[Scenario28] +name=PowerSaving +support=no + +[Scenario29] +name=ProcessCrashed +support=no + +[Scenario30] +name=ReservedMode +support=no + +[Scenario31] +name=ScreenMirroring +support=no + +[Scenario32] +name=SmemoZoom +support=no + +[Scenario33] +name=SVoice +support=no + +[Scenario34] +name=WebappLaunch +support=no + +[Scenario35] +name=WifiThroughput +support=no + +[Scenario36] +name=PowerOff +support=no + +[Scenario37] +name=WebAppDrag +support=no + +[Scenario38] +name=WebAppFlick +support=no + +[Scenario39] +name=SensorWakeup +support=no + +[Scenario40] +name=UgLaunch +support=no + +[Scenario41] +name=MusicScroll +support=no + +[Scenario42] +name=FileScroll +support=no + +[Scenario43] +name=VideoScroll +support=no + +[Scenario44] +name=EmailScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario45] +name=ContactScroll +support=no + +[Scenario46] +name=TizenStoreScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario47] +name=CallLogScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario48] +name=MyfilesScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario49] +name=MessageScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario50] +name=SIOP +support=no + +[Scenario51] +name=UltraPowerSaving +support=no diff --git a/scripts/pass-resource3.conf b/scripts/pass-resource3.conf new file mode 100644 index 0000000..543fe24 --- /dev/null +++ b/scripts/pass-resource3.conf @@ -0,0 +1,263 @@ +[Pass] +pass_compatible=samsung,tm2 +pass_support=1 +pass_gov_type=0 + +pass_num_levels=5 +pass_init_level=0 +pass_min_level=0 +pass_max_level=4 + +[Level0] +limit_min_freq=78000000 + +[Level1] +limit_min_freq=413000000 + +[Level2] +limit_min_freq=543000000 + +[Level3] +limit_min_freq=667000000 + +[Level4] +limit_min_freq=825000000 + +############################ +### Add list of scenario ### +############################ +[PassScenario] +pass_scenario_support=yes +pass_num_scenarios=52 + +[Scenario0] +name=AppLaunch +support=yes + +min_level=4 +max_level=4 + +[Scenario1] +name=AppLaunchHome +support=yes + +min_level=4 +max_level=4 + +[Scenario2] +name=BeautyShot +support=no + +[Scenario3] +name=Browser +support=no + +[Scenario4] +name=BrowserDash +support=no + +[Scenario5] +name=BrowserJavaScript +support=yes + +min_level=4 +max_level=4 + +[Scenario6] +name=BrowserLoading +support=no + +[Scenario7] +name=BrowserScroll +support=no + +[Scenario8] +name=CallSound +support=no + +[Scenario9] +name=CameraBurstShot +support=no + +[Scenario10] +name=CameraCaptureAtRec +support=no + +[Scenario11] +name=CameraPreview +support=no + +[Scenario12] +name=CameraSoundAndShot +support=no + +[Scenario13] +name=ContactSearch +support=no + +[Scenario14] +name=Emergency +support=no + +[Scenario15] +name=GalleryScroll +support=no + +[Scenario16] +name=GalleryRotation +support=no + +[Scenario17] +name=GetDefaultLockTime +support=no + +[Scenario18] +name=GpsSerialCno +support=no + +[Scenario19] +name=GpuBoost +support=no + +[Scenario20] +name=GpuWakeup +support=no + +[Scenario21] +name=HomeScreen +support=no + +[Scenario22] +name=ImageViewer +support=no + +[Scenario23] +name=IMEInput +support=no + +[Scenario24] +name=LockScreen +support=no + +[Scenario25] +name=LowBattery +support=no + +[Scenario26] +name=MtpSendFile +support=no + +[Scenario27] +name=MusicPlayLcdOn +support=no + +[Scenario28] +name=PowerSaving +support=no + +[Scenario29] +name=ProcessCrashed +support=no + +[Scenario30] +name=ReservedMode +support=no + +[Scenario31] +name=ScreenMirroring +support=no + +[Scenario32] +name=SmemoZoom +support=no + +[Scenario33] +name=SVoice +support=no + +[Scenario34] +name=WebappLaunch +support=no + +[Scenario35] +name=WifiThroughput +support=no + +[Scenario36] +name=PowerOff +support=no + +[Scenario37] +name=WebAppDrag +support=no + +[Scenario38] +name=WebAppFlick +support=no + +[Scenario39] +name=SensorWakeup +support=no + +[Scenario40] +name=UgLaunch +support=no + +[Scenario41] +name=MusicScroll +support=no + +[Scenario42] +name=FileScroll +support=no + +[Scenario43] +name=VideoScroll +support=no + +[Scenario44] +name=EmailScroll +support=yes + +min_level=4 +max_level=4 + +[Scenario45] +name=ContactScroll +support=no + +[Scenario46] +name=TizenStoreScroll +support=yes + +min_level=4 +max_level=4 + +[Scenario47] +name=CallLogScroll +support=yes + +min_level=4 +max_level=4 + +[Scenario48] +name=MyfilesScroll +support=yes + +min_level=4 +max_level=4 + +[Scenario49] +name=MessageScroll +support=yes + +min_level=4 +max_level=4 + +[Scenario50] +name=SIOP +support=no + +[Scenario51] +name=UltraPowerSaving +support=no diff --git a/scripts/pass-resource4.conf b/scripts/pass-resource4.conf new file mode 100644 index 0000000..31855d1 --- /dev/null +++ b/scripts/pass-resource4.conf @@ -0,0 +1,263 @@ +[Pass] +pass_compatible=samsung,tm2 +pass_support=1 +pass_gov_type=0 + +pass_num_levels=5 +pass_init_level=0 +pass_min_level=0 +pass_max_level=4 + +[Level0] +limit_min_freq=160000000 + +[Level1] +limit_min_freq=500000000 + +[Level2] +limit_min_freq=550000000 + +[Level3] +limit_min_freq=600000000 + +[Level4] +limit_min_freq=700000000 + +############################ +### Add list of scenario ### +############################ +[PassScenario] +pass_scenario_support=yes +pass_num_scenarios=52 + +[Scenario0] +name=AppLaunch +support=yes + +min_level=3 +max_level=3 + +[Scenario1] +name=AppLaunchHome +support=yes + +min_level=3 +max_level=3 + +[Scenario2] +name=BeautyShot +support=no + +[Scenario3] +name=Browser +support=no + +[Scenario4] +name=BrowserDash +support=no + +[Scenario5] +name=BrowserJavaScript +support=yes + +min_level=3 +max_level=3 + +[Scenario6] +name=BrowserLoading +support=no + +[Scenario7] +name=BrowserScroll +support=no + +[Scenario8] +name=CallSound +support=no + +[Scenario9] +name=CameraBurstShot +support=no + +[Scenario10] +name=CameraCaptureAtRec +support=no + +[Scenario11] +name=CameraPreview +support=no + +[Scenario12] +name=CameraSoundAndShot +support=no + +[Scenario13] +name=ContactSearch +support=no + +[Scenario14] +name=Emergency +support=no + +[Scenario15] +name=GalleryScroll +support=no + +[Scenario16] +name=GalleryRotation +support=no + +[Scenario17] +name=GetDefaultLockTime +support=no + +[Scenario18] +name=GpsSerialCno +support=no + +[Scenario19] +name=GpuBoost +support=no + +[Scenario20] +name=GpuWakeup +support=no + +[Scenario21] +name=HomeScreen +support=no + +[Scenario22] +name=ImageViewer +support=no + +[Scenario23] +name=IMEInput +support=no + +[Scenario24] +name=LockScreen +support=no + +[Scenario25] +name=LowBattery +support=no + +[Scenario26] +name=MtpSendFile +support=no + +[Scenario27] +name=MusicPlayLcdOn +support=no + +[Scenario28] +name=PowerSaving +support=no + +[Scenario29] +name=ProcessCrashed +support=no + +[Scenario30] +name=ReservedMode +support=no + +[Scenario31] +name=ScreenMirroring +support=no + +[Scenario32] +name=SmemoZoom +support=no + +[Scenario33] +name=SVoice +support=no + +[Scenario34] +name=WebappLaunch +support=no + +[Scenario35] +name=WifiThroughput +support=no + +[Scenario36] +name=PowerOff +support=no + +[Scenario37] +name=WebAppDrag +support=no + +[Scenario38] +name=WebAppFlick +support=no + +[Scenario39] +name=SensorWakeup +support=no + +[Scenario40] +name=UgLaunch +support=no + +[Scenario41] +name=MusicScroll +support=no + +[Scenario42] +name=FileScroll +support=no + +[Scenario43] +name=VideoScroll +support=no + +[Scenario44] +name=EmailScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario45] +name=ContactScroll +support=no + +[Scenario46] +name=TizenStoreScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario47] +name=CallLogScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario48] +name=MyfilesScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario49] +name=MessageScroll +support=yes + +min_level=3 +max_level=3 + +[Scenario50] +name=SIOP +support=no + +[Scenario51] +name=UltraPowerSaving +support=no diff --git a/scripts/pass.conf b/scripts/pass.conf new file mode 100644 index 0000000..a40cb5e --- /dev/null +++ b/scripts/pass.conf @@ -0,0 +1,37 @@ +# Default pass.conf +# - If you want to use PASS(Power Aware System Service), you have to create +# new 'pass-[target type].conf' configuration file. +[PassResource] +pass_compatible=samsung,tm2 +pass_num_resources=5 + +[PassResource0] +pass_res_type=1 +pass_res_name=cpu0 +pass_path_conf_file=/etc/pass/pass-resource0.conf +pass_path_load_table=/sys/kernel/debug/cpufreq/cpu0/load_table +pass_first_cpu=0 +pass_num_cpus=4 + +[PassResource1] +pass_res_type=1 +pass_res_name=cpu4 +pass_path_conf_file=/etc/pass/pass-resource1.conf +pass_path_load_table=/sys/kernel/debug/cpufreq/cpu4/load_table +pass_first_cpu=4 +pass_num_cpus=4 + +[PassResource2] +pass_res_type=2 +pass_res_name=soc:memory_bus@0 +pass_path_conf_file=/etc/pass/pass-resource2.conf + +[PassResource3] +pass_res_type=2 +pass_res_name=soc:memory_bus@1 +pass_path_conf_file=/etc/pass/pass-resource3.conf + +[PassResource4] +pass_res_type=3 +pass_res_name=14ac0000.mali +pass_path_conf_file=/etc/pass/pass-resource4.conf -- 2.7.4 From 35917ef15f0172fdc80560f51869fad872ee928b Mon Sep 17 00:00:00 2001 From: Wook Song Date: Tue, 14 Feb 2017 17:43:24 +0900 Subject: [PATCH 08/15] pass-hal: tm2: Update hotplug ops for set/get functions of min/max online CPUs This patch updates the hotplug ops for the CPU resource in order to include the new functions which set and get the minimum/maximum number of online CPUs. Change-Id: Ied59bdf57db5be3f4d7600198d79d17802a2af7d Signed-off-by: Wook Song --- src/cpu/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index a9e23bc..83bdde0 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -296,6 +296,10 @@ static int tm2_hotplug_set_online_state(char *res_name, int cpu, int on) 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_name) -- 2.7.4 From 0ddbb2a96dd40778f4bb8bd493093526406e78ae Mon Sep 17 00:00:00 2001 From: Wook Song Date: Wed, 15 Feb 2017 14:29:12 +0900 Subject: [PATCH 09/15] pass-hal: tm2: Add new path_compatible entry to conf file This patch adds the new pass_path_compatible entry, that indicates the path where the pass can get the compatible board information, to the PassResource section in the pass.conf file. If the following patch (895f20b pass: parser: Add parsing of pass_path_compatible) is applied to the pass, you should apply this patch to the pass-hal-tm2 in order to make the pass work correctly. Change-Id: I563c6f451918765bd282e4c9b8a1edaee606cd3b Signed-off-by: Wook Song --- scripts/pass.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/pass.conf b/scripts/pass.conf index a40cb5e..9d09bc9 100644 --- a/scripts/pass.conf +++ b/scripts/pass.conf @@ -3,6 +3,7 @@ # new 'pass-[target type].conf' configuration file. [PassResource] pass_compatible=samsung,tm2 +pass_path_compatible=/proc/device-tree/compatible pass_num_resources=5 [PassResource0] -- 2.7.4 From 6c55220f676257f91e28e8b43fcf1301bfa4d8a3 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Wed, 15 Feb 2017 16:03:35 +0900 Subject: [PATCH 10/15] pass-hal: tm2: Remove unneeded pass_compatible from pass-resource*.conf This patch removes the unneeded the 'pass_compatible' entry from the pass-resource*.conf because it is not required any more. Change-Id: I0a3772cf14c627844e44e17a8663190328ca7727 Signed-off-by: Chanwoo Choi --- scripts/pass-resource0.conf | 1 - scripts/pass-resource1.conf | 1 - scripts/pass-resource2.conf | 1 - scripts/pass-resource3.conf | 1 - scripts/pass-resource4.conf | 1 - 5 files changed, 5 deletions(-) diff --git a/scripts/pass-resource0.conf b/scripts/pass-resource0.conf index 98a73d6..e422130 100644 --- a/scripts/pass-resource0.conf +++ b/scripts/pass-resource0.conf @@ -1,5 +1,4 @@ [Pass] -pass_compatible=samsung,tm2 pass_support=1 pass_gov_type=2 diff --git a/scripts/pass-resource1.conf b/scripts/pass-resource1.conf index 9f65eee..0baf9c0 100644 --- a/scripts/pass-resource1.conf +++ b/scripts/pass-resource1.conf @@ -1,5 +1,4 @@ [Pass] -pass_compatible=samsung,tm2 pass_support=1 pass_gov_type=2 diff --git a/scripts/pass-resource2.conf b/scripts/pass-resource2.conf index 47e42ae..e525d7c 100644 --- a/scripts/pass-resource2.conf +++ b/scripts/pass-resource2.conf @@ -1,5 +1,4 @@ [Pass] -pass_compatible=samsung,tm2 pass_support=1 pass_gov_type=0 diff --git a/scripts/pass-resource3.conf b/scripts/pass-resource3.conf index 543fe24..9469f74 100644 --- a/scripts/pass-resource3.conf +++ b/scripts/pass-resource3.conf @@ -1,5 +1,4 @@ [Pass] -pass_compatible=samsung,tm2 pass_support=1 pass_gov_type=0 diff --git a/scripts/pass-resource4.conf b/scripts/pass-resource4.conf index 31855d1..e7675b3 100644 --- a/scripts/pass-resource4.conf +++ b/scripts/pass-resource4.conf @@ -1,5 +1,4 @@ [Pass] -pass_compatible=samsung,tm2 pass_support=1 pass_gov_type=0 -- 2.7.4 From 78fee1066da9c0e58e13951d6a8bd67d097e14fd Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Fri, 17 Feb 2017 15:39:11 +0900 Subject: [PATCH 11/15] pass-hal: tm2: Fix value of governor type for bus/gpu resource This patch fixes the value of governor type for BUS/GPU h/w resource because PASS core redefines the governor types as following: - PASS_GOV_DUMMY : -1 - PASS_GOV_BASIC : 0 - PASS_GOV_HOTPLUG_ONLY : 1 - PASS_GOV_RADIATION : 2 - PASS_GOV_STEP : 3 The BUS/GPU resource on TM2 use the PASS_GOV_BASIC governor which uses both HAL interface and Resource controller. Change-Id: I408784aa0a1539b32b83b87b6f621655d504784f Signed-off-by: Chanwoo Choi --- scripts/pass-resource0.conf | 2 +- scripts/pass-resource1.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pass-resource0.conf b/scripts/pass-resource0.conf index e422130..eb29b81 100644 --- a/scripts/pass-resource0.conf +++ b/scripts/pass-resource0.conf @@ -1,6 +1,6 @@ [Pass] pass_support=1 -pass_gov_type=2 +pass_gov_type=3 pass_num_levels=12 pass_init_level=4 diff --git a/scripts/pass-resource1.conf b/scripts/pass-resource1.conf index 0baf9c0..dac8029 100644 --- a/scripts/pass-resource1.conf +++ b/scripts/pass-resource1.conf @@ -1,6 +1,6 @@ [Pass] pass_support=1 -pass_gov_type=2 +pass_gov_type=3 pass_num_levels=20 pass_init_level=4 -- 2.7.4 From 3ed0e8b6169b5c15b1e48857b262d9fe90b9de47 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Tue, 28 Mar 2017 14:18:58 +0900 Subject: [PATCH 12/15] packaging: Add ExclusiveArch property to build on armv7l and aarch64 This patch adds the 'ExclusiveArch' property in order to build this package only for both armv7l and aarch64. Change-Id: I232653570a88e6ef5bfb48c6cdbd084efdd7ac3d Signed-off-by: Chanwoo Choi --- packaging/pass-hal-tm2.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packaging/pass-hal-tm2.spec b/packaging/pass-hal-tm2.spec index 77e2b4c..c5bed67 100644 --- a/packaging/pass-hal-tm2.spec +++ b/packaging/pass-hal-tm2.spec @@ -9,6 +9,9 @@ Group: System/Hardware Adaptation License: Apache-2.0 Source0: %{name}-%{version}.tar.gz Source1: %{name}.manifest + +ExclusiveArch: %{arm} aarch64 + Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig BuildRequires: cmake -- 2.7.4 From be39886e397460c0def610cb0a9723a07929cb14 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Tue, 28 Mar 2017 20:05:50 +0900 Subject: [PATCH 13/15] pass-hal: tm2: Adjust the condition to improve the performance This patch adjusts the condition value of each pass level for big.LITTLE core in order to improve the performance - pass-resource0.conf for LITTLE core - pass-resource1.conf for big core And this patch contains the simple test result according to the test case. - Test 1: Enable PASS with the adjustment of this patch. - Test 2: Enable PASS without the adjustment. - Test 3: Disable PASS (Normal state) [Test result with TPMS] ---------------------------------------------------------------------------------------- |Test 1 |Test 2 |Test 3 | TPMS test case |PASS enable |PASS enable |PASS disable | ---------------------------------------------------------------------------------------- App Launching Time - org.tizen.helloworld | 0.378 (s) | 0.425 (s) | 0.421 (s) | Booting Time | 21.13 (s) | 21.16 (s) | 21.15 (s) | GLBench - Egypt_Offscreen | 161.08 (fps) | 158.24 (fps) | 147.71 (fps)| GLBench - Egypt_Standard | 42.0 (fps) | 38.94 (fps) | 41.7 (fps)| GLBench - Pro_Offscreen | 263.23 (fps) | 243.52 (fps) | 210.77 (fps)| GLBench - Pro_Standard | 53.24 (fps) | 52.11 (fps) | 53.84 (fps)| Web App Launching Time - 5OPuG0pfe7.basic | 0.528 (s) | 0.516 (s) | 0.55 (s) | ---------------------------------------------------------------------------------------- Change-Id: I8290c3f9078f388338786672ff5b83bed96c1ff1 Signed-off-by: Chanwoo Choi --- scripts/pass-resource0.conf | 62 +++++++------- scripts/pass-resource1.conf | 192 ++++++++++++++++---------------------------- 2 files changed, 101 insertions(+), 153 deletions(-) diff --git a/scripts/pass-resource0.conf b/scripts/pass-resource0.conf index eb29b81..2e88730 100644 --- a/scripts/pass-resource0.conf +++ b/scripts/pass-resource0.conf @@ -3,13 +3,13 @@ pass_support=1 pass_gov_type=3 pass_num_levels=12 -pass_init_level=4 -pass_min_level=4 +pass_init_level=0 +pass_min_level=0 pass_max_level=11 -pass_cpu_threshold=60 -pass_up_threshold=50 -pass_down_threshold=30 +pass_cpu_threshold=30 +pass_up_threshold=30 +pass_down_threshold=80 pass_num_cpu_stats=20 @@ -21,7 +21,7 @@ limit_max_freq=1000000 limit_min_cpu=1 num_down_cond=0 num_up_cond=1 -num_up_cond_freq=800000 +num_up_cond_freq=600000 num_left_cond=0 num_right_cond=1 num_right_cond_nr_running=100 @@ -32,9 +32,9 @@ limit_max_freq=1000000 limit_min_cpu=2 num_down_cond=0 num_up_cond=1 -num_up_cond_freq=800000 +num_up_cond_freq=600000 num_left_cond=1 -num_left_cond_nr_running=100 +num_left_cond_nr_running=150 num_left_cond_busy_cpu=1 num_right_cond=1 num_right_cond_nr_running=200 @@ -45,7 +45,7 @@ limit_max_freq=1000000 limit_min_cpu=3 num_down_cond=0 num_up_cond=1 -num_up_cond_freq=800000 +num_up_cond_freq=600000 num_left_cond=1 num_left_cond_nr_running=200 num_left_cond_busy_cpu=2 @@ -58,7 +58,7 @@ limit_max_freq=1000000 limit_min_cpu=4 num_down_cond=0 num_up_cond=1 -num_up_cond_freq=800000 +num_up_cond_freq=600000 num_left_cond=1 num_left_cond_nr_running=300 num_left_cond_busy_cpu=3 @@ -68,9 +68,9 @@ num_right_cond=0 limit_max_freq=1200000 limit_min_cpu=1 num_down_cond=1 -num_down_cond_freq=1000000 +num_down_cond_freq=800000 num_up_cond=1 -num_up_cond_freq=1200000 +num_up_cond_freq=800000 num_left_cond=0 num_right_cond=1 num_right_cond_nr_running=100 @@ -80,11 +80,11 @@ num_right_cond_busy_cpu=1 limit_max_freq=1200000 limit_min_cpu=2 num_down_cond=1 -num_down_cond_freq=1000000 +num_down_cond_freq=800000 num_up_cond=1 -num_up_cond_freq=1200000 +num_up_cond_freq=800000 num_left_cond=1 -num_left_cond_nr_running=100 +num_left_cond_nr_running=150 num_left_cond_busy_cpu=1 num_right_cond=1 num_right_cond_nr_running=200 @@ -94,25 +94,25 @@ num_right_cond_busy_cpu=2 limit_max_freq=1200000 limit_min_cpu=3 num_down_cond=1 -num_down_cond_freq=1000000 +num_down_cond_freq=800000 num_up_cond=1 -num_up_cond_freq=1200000 +num_up_cond_freq=800000 num_left_cond=1 num_left_cond_nr_running=200 num_left_cond_busy_cpu=2 num_right_cond=1 -num_right_cond_nr_running=300 +num_right_cond_nr_running=250 num_right_cond_busy_cpu=3 [Level7] limit_max_freq=1200000 limit_min_cpu=4 num_down_cond=1 -num_down_cond_freq=1000000 +num_down_cond_freq=800000 num_up_cond=1 -num_up_cond_freq=1200000 +num_up_cond_freq=800000 num_left_cond=1 -num_left_cond_nr_running=300 +num_left_cond_nr_running=250 num_left_cond_busy_cpu=3 num_right_cond=0 @@ -120,9 +120,9 @@ num_right_cond=0 limit_max_freq=1300000 limit_min_cpu=1 num_down_cond=1 -num_down_cond_freq=1200000 +num_down_cond_freq=900000 num_up_cond=1 -num_up_cond_freq=1300000 +num_up_cond_freq=900000 num_left_cond=0 num_right_cond=1 num_right_cond_nr_running=100 @@ -132,11 +132,11 @@ num_right_cond_busy_cpu=1 limit_max_freq=1300000 limit_min_cpu=2 num_down_cond=1 -num_down_cond_freq=1200000 +num_down_cond_freq=900000 num_up_cond=1 -num_up_cond_freq=1300000 +num_up_cond_freq=900000 num_left_cond=1 -num_left_cond_nr_running=100 +num_left_cond_nr_running=150 num_left_cond_busy_cpu=1 num_right_cond=1 num_right_cond_nr_running=200 @@ -146,25 +146,25 @@ num_right_cond_busy_cpu=2 limit_max_freq=1300000 limit_min_cpu=3 num_down_cond=1 -num_down_cond_freq=1200000 +num_down_cond_freq=900000 num_up_cond=1 -num_up_cond_freq=1300000 +num_up_cond_freq=900000 num_left_cond=1 num_left_cond_nr_running=200 num_left_cond_busy_cpu=2 num_right_cond=1 -num_right_cond_nr_running=300 +num_right_cond_nr_running=250 num_right_cond_busy_cpu=3 [Level11] limit_max_freq=1300000 limit_min_cpu=4 num_down_cond=1 -num_down_cond_freq=1200000 +num_down_cond_freq=900000 num_up_cond=1 num_up_cond_freq=1300000 num_left_cond=1 -num_left_cond_nr_running=300 +num_left_cond_nr_running=250 num_left_cond_busy_cpu=3 num_right_cond=0 diff --git a/scripts/pass-resource1.conf b/scripts/pass-resource1.conf index dac8029..040388d 100644 --- a/scripts/pass-resource1.conf +++ b/scripts/pass-resource1.conf @@ -2,14 +2,14 @@ pass_support=1 pass_gov_type=3 -pass_num_levels=20 -pass_init_level=4 -pass_min_level=4 -pass_max_level=19 +pass_num_levels=16 +pass_init_level=0 +pass_min_level=0 +pass_max_level=15 -pass_cpu_threshold=80 -pass_up_threshold=60 -pass_down_threshold=30 +pass_cpu_threshold=30 +pass_up_threshold=30 +pass_down_threshold=80 pass_num_cpu_stats=20 @@ -21,7 +21,7 @@ limit_max_freq=1000000 limit_min_cpu=1 num_down_cond=0 num_up_cond=1 -num_up_cond_freq=1000000 +num_up_cond_freq=600000 num_left_cond=0 num_right_cond=1 num_right_cond_nr_running=100 @@ -32,12 +32,12 @@ limit_max_freq=1000000 limit_min_cpu=2 num_down_cond=0 num_up_cond=1 -num_up_cond_freq=1000000 +num_up_cond_freq=600000 num_left_cond=1 num_left_cond_nr_running=100 num_left_cond_busy_cpu=1 num_right_cond=1 -num_right_cond_nr_running=200 +num_right_cond_nr_running=150 num_right_cond_busy_cpu=2 [Level2] @@ -45,12 +45,12 @@ limit_max_freq=1000000 limit_min_cpu=3 num_down_cond=0 num_up_cond=1 -num_up_cond_freq=1000000 +num_up_cond_freq=600000 num_left_cond=1 num_left_cond_nr_running=200 num_left_cond_busy_cpu=2 num_right_cond=1 -num_right_cond_nr_running=300 +num_right_cond_nr_running=250 num_right_cond_busy_cpu=3 [Level3] @@ -58,213 +58,161 @@ limit_max_freq=1000000 limit_min_cpu=4 num_down_cond=0 num_up_cond=1 -num_up_cond_freq=1000000 +num_up_cond_freq=600000 num_left_cond=1 -num_left_cond_nr_running=300 +num_left_cond_nr_running=250 num_left_cond_busy_cpu=3 num_right_cond=0 [Level4] -limit_max_freq=1200000 -limit_min_cpu=1 -num_down_cond=1 -num_down_cond_freq=1000000 -num_up_cond=1 -num_up_cond_freq=1200000 -num_left_cond=0 -num_right_cond=1 -num_right_cond_nr_running=100 -num_right_cond_busy_cpu=1 - -[Level5] -limit_max_freq=1200000 -limit_min_cpu=2 -num_down_cond=1 -num_down_cond_freq=1000000 -num_up_cond=1 -num_up_cond_freq=1200000 -num_left_cond=1 -num_left_cond_nr_running=100 -num_left_cond_busy_cpu=1 -num_right_cond=1 -num_right_cond_nr_running=200 -num_right_cond_busy_cpu=2 - -[Level6] -limit_max_freq=1200000 -limit_min_cpu=3 -num_down_cond=1 -num_down_cond_freq=1000000 -num_up_cond=1 -num_up_cond_freq=1200000 -num_left_cond=1 -num_left_cond_nr_running=200 -num_left_cond_busy_cpu=2 -num_right_cond=1 -num_right_cond_nr_running=300 -num_right_cond_busy_cpu=3 - -[Level7] -limit_max_freq=1200000 -limit_min_cpu=4 -num_down_cond=1 -num_down_cond_freq=1000000 -num_up_cond=1 -num_up_cond_freq=1200000 -num_left_cond=1 -num_left_cond_nr_running=300 -num_left_cond_busy_cpu=3 -num_right_cond=0 - -[Level8] limit_max_freq=1300000 limit_min_cpu=1 num_down_cond=1 -num_down_cond_freq=1100000 +num_down_cond_freq=800000 num_up_cond=1 -num_up_cond_freq=1300000 +num_up_cond_freq=800000 num_left_cond=0 num_right_cond=1 num_right_cond_nr_running=100 num_right_cond_busy_cpu=1 -[Level9] +[Level5] limit_max_freq=1300000 limit_min_cpu=2 num_down_cond=1 -num_down_cond_freq=1100000 +num_down_cond_freq=800000 num_up_cond=1 -num_up_cond_freq=1300000 +num_up_cond_freq=800000 num_left_cond=1 num_left_cond_nr_running=100 num_left_cond_busy_cpu=1 num_right_cond=1 -num_right_cond_nr_running=200 +num_right_cond_nr_running=150 num_right_cond_busy_cpu=2 -[Level10] +[Level6] limit_max_freq=1300000 limit_min_cpu=3 num_down_cond=1 -num_down_cond_freq=1100000 +num_down_cond_freq=800000 num_up_cond=1 -num_up_cond_freq=1300000 +num_up_cond_freq=800000 num_left_cond=1 num_left_cond_nr_running=200 num_left_cond_busy_cpu=2 num_right_cond=1 -num_right_cond_nr_running=300 +num_right_cond_nr_running=250 num_right_cond_busy_cpu=3 -[Level11] +[Level7] limit_max_freq=1300000 limit_min_cpu=4 num_down_cond=1 -num_down_cond_freq=1100000 +num_down_cond_freq=800000 num_up_cond=1 -num_up_cond_freq=1300000 +num_up_cond_freq=800000 num_left_cond=1 -num_left_cond_nr_running=300 +num_left_cond_nr_running=250 num_left_cond_busy_cpu=3 num_right_cond=0 -[Level12] +[Level8] limit_max_freq=1500000 limit_min_cpu=1 num_down_cond=1 -num_down_cond_freq=1300000 +num_down_cond_freq=1000000 num_up_cond=1 -num_up_cond_freq=1500000 +num_up_cond_freq=1000000 num_left_cond=0 num_right_cond=1 num_right_cond_nr_running=100 num_right_cond_busy_cpu=1 -[Level13] +[Level9] limit_max_freq=1500000 limit_min_cpu=2 num_down_cond=1 -num_down_cond_freq=1300000 +num_down_cond_freq=1000000 num_up_cond=1 -num_up_cond_freq=1500000 +num_up_cond_freq=1000000 num_left_cond=1 num_left_cond_nr_running=100 num_left_cond_busy_cpu=1 num_right_cond=1 -num_right_cond_nr_running=200 +num_right_cond_nr_running=150 num_right_cond_busy_cpu=2 -[Level14] +[Level10] limit_max_freq=1500000 limit_min_cpu=3 num_down_cond=1 -num_down_cond_freq=1300000 +num_down_cond_freq=1000000 num_up_cond=1 -num_up_cond_freq=1500000 +num_up_cond_freq=1000000 num_left_cond=1 num_left_cond_nr_running=200 num_left_cond_busy_cpu=2 num_right_cond=1 -num_right_cond_nr_running=300 +num_right_cond_nr_running=250 num_right_cond_busy_cpu=3 -[Level15] +[Level11] limit_max_freq=1500000 limit_min_cpu=4 num_down_cond=1 -num_down_cond_freq=1300000 +num_down_cond_freq=1000000 num_up_cond=1 -num_up_cond_freq=1500000 +num_up_cond_freq=1000000 num_left_cond=1 -num_left_cond_nr_running=300 +num_left_cond_nr_running=250 num_left_cond_busy_cpu=3 num_right_cond=0 -[Level16] +[Level12] limit_max_freq=1700000 limit_min_cpu=1 num_down_cond=1 -num_down_cond_freq=1500000 +num_down_cond_freq=1000000 num_up_cond=0 num_left_cond=0 num_right_cond=1 num_right_cond_nr_running=100 num_right_cond_busy_cpu=1 -[Level17] +[Level13] limit_max_freq=1700000 limit_min_cpu=2 num_down_cond=1 -num_down_cond_freq=1500000 +num_down_cond_freq=1000000 num_up_cond=0 num_left_cond=1 num_left_cond_nr_running=100 num_left_cond_busy_cpu=1 num_right_cond=1 -num_right_cond_nr_running=200 +num_right_cond_nr_running=150 num_right_cond_busy_cpu=2 -[Level18] +[Level14] limit_max_freq=1700000 limit_min_cpu=3 num_down_cond=1 -num_down_cond_freq=1500000 +num_down_cond_freq=1000000 num_up_cond=0 num_left_cond=1 num_left_cond_nr_running=200 num_left_cond_busy_cpu=2 num_right_cond=1 -num_right_cond_nr_running=300 +num_right_cond_nr_running=250 num_right_cond_busy_cpu=3 -[Level19] +[Level15] limit_max_freq=1700000 limit_min_cpu=4 num_down_cond=1 -num_down_cond_freq=1500000 +num_down_cond_freq=1000000 num_up_cond=0 num_left_cond=1 -num_left_cond_nr_running=300 +num_left_cond_nr_running=250 num_left_cond_busy_cpu=3 num_right_cond=0 @@ -279,15 +227,15 @@ pass_num_scenarios=52 name=AppLaunch support=yes -min_level=13 -max_level=15 +min_level=9 +max_level=11 [Scenario1] name=AppLaunchHome support=yes -min_level=13 -max_level=15 +min_level=9 +max_level=11 [Scenario2] name=BeautyShot @@ -305,8 +253,8 @@ support=no name=BrowserJavaScript support=yes -min_level=13 -max_level=15 +min_level=9 +max_level=11 [Scenario6] name=BrowserLoading @@ -464,8 +412,8 @@ support=no name=EmailScroll support=yes -min_level=13 -max_level=15 +min_level=9 +max_level=11 [Scenario45] name=ContactScroll @@ -475,29 +423,29 @@ support=no name=TizenStoreScroll support=yes -min_level=13 -max_level=15 +min_level=9 +max_level=11 [Scenario47] name=CallLogScroll support=yes -min_level=13 -max_level=15 +min_level=9 +max_level=11 [Scenario48] name=MyfilesScroll support=yes -min_level=13 -max_level=15 +min_level=9 +max_level=11 [Scenario49] name=MessageScroll support=yes -min_level=13 -max_level=15 +min_level=9 +max_level=11 [Scenario50] name=SIOP -- 2.7.4 From 1e2823dc0bf7309efe73207b7295a00e703c2fda Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Tue, 28 Mar 2017 20:17:49 +0900 Subject: [PATCH 14/15] pass-hal: tm2: Prevent attempt to turn off CPU0 This patch prevents the attempt to turn off CPU0 because TM2 uses the Exynos5433 SoC which doesn't permit to turn off the CPU0 due to the h/w design issue. Change-Id: I6795aad5ff80c1728db42bc808bac8806d5daa76 Signed-off-by: Chanwoo Choi --- src/cpu/cpu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 83bdde0..c837688 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -271,7 +271,6 @@ 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 ((cpu < TM2_CPU_MIN_NUM) || (cpu > TM2_CPU_MAX_NUM)) @@ -279,7 +278,16 @@ static int tm2_hotplug_set_online_state(char *res_name, int cpu, int on) if ((on != CPU_ONLINE_STATE_ON) && (on != CPU_ONLINE_STATE_OFF)) return -EINVAL; - /* TODO: Can we turn off CPU0? */ + /* + * 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, -- 2.7.4 From 114211745cd4bac6d6cb953d1d88f1ce7b75c454 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Wed, 26 Apr 2017 16:33:44 +0900 Subject: [PATCH 15/15] pass-hal: tm2: Add resource name for open and close function This patch just adds the new argument of h/w resource name when calling the open and close functions. The resource name will be used to identify the h/w resource. Change-Id: I4a96eb44dbea3afbc221472a5c51fd0dfc53ca59 Signed-off-by: Chanwoo Choi --- src/bus/bus.c | 4 ++-- src/cpu/cpu.c | 4 ++-- src/gpu/gpu.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bus/bus.c b/src/bus/bus.c index e4c7bbf..989b78e 100644 --- a/src/bus/bus.c +++ b/src/bus/bus.c @@ -172,7 +172,7 @@ static struct pass_resource_dvfs_ops tm2_bus_dvfs_ops = { .get_load_table = NULL, }; -static int tm2_bus_open(struct pass_resource_info *info, +static int tm2_bus_open(char *res_name, struct pass_resource_info *info, struct pass_resource_common **common) { struct pass_resource_bus *bus_res; @@ -193,7 +193,7 @@ static int tm2_bus_open(struct pass_resource_info *info, return 0; } -static int tm2_bus_close(struct pass_resource_common *common) +static int tm2_bus_close(char *res_name, struct pass_resource_common *common) { if (!common) return -EINVAL; diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index c837688..b3a7b77 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -370,7 +370,7 @@ static struct pass_resource_tmu_ops tm2_cpu_tmu_ops = { .get_policy = tm2_tmu_get_policy, }; -static int tm2_cpu_open(struct pass_resource_info *info, +static int tm2_cpu_open(char *res_name, struct pass_resource_info *info, struct pass_resource_common **common) { struct pass_resource_cpu *cpu_res; @@ -393,7 +393,7 @@ static int tm2_cpu_open(struct pass_resource_info *info, return 0; } -static int tm2_cpu_close(struct pass_resource_common *common) +static int tm2_cpu_close(char *res_name, struct pass_resource_common *common) { if (!common) return -EINVAL; diff --git a/src/gpu/gpu.c b/src/gpu/gpu.c index 3ef3c10..7954031 100644 --- a/src/gpu/gpu.c +++ b/src/gpu/gpu.c @@ -224,7 +224,7 @@ static struct pass_resource_tmu_ops tm2_gpu_tmu_ops = { .get_policy = tm2_tmu_get_policy, }; -static int tm2_gpu_open(struct pass_resource_info *info, +static int tm2_gpu_open(char *res_name, struct pass_resource_info *info, struct pass_resource_common **common) { struct pass_resource_gpu *gpu_res; @@ -246,7 +246,7 @@ static int tm2_gpu_open(struct pass_resource_info *info, return 0; } -static int tm2_gpu_close(struct pass_resource_common *common) +static int tm2_gpu_close(char *res_name, struct pass_resource_common *common) { if (!common) return -EINVAL; -- 2.7.4