pass-hal: tm2: Remove unncessary source code 48/141948/2
authorDongwoo Lee <dwoo08.lee@samsung.com>
Mon, 31 Jul 2017 07:21:15 +0000 (16:21 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Fri, 4 Aug 2017 00:54:22 +0000 (09:54 +0900)
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 <dwoo08.lee@samsung.com>
CMakeLists.txt
packaging/pass-hal-tm2.spec
src/bus/CMakeLists.txt [deleted file]
src/bus/bus.c [deleted file]
src/cpu/CMakeLists.txt [deleted file]
src/cpu/cpu.c [deleted file]
src/gpu/CMakeLists.txt [deleted file]
src/gpu/gpu.c [deleted file]
src/shared/sysfs.c [deleted file]
src/shared/sysfs.h [deleted file]

index a78b065..622008a 100644 (file)
@@ -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)
index 6905672..9f48068 100644 (file)
@@ -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 (file)
index 2bca621..0000000
+++ /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 (file)
index 2463bfc..0000000
+++ /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 <errno.h>
-#include <limits.h>
-#include <pass/hal.h>
-#include <pass/hal-log.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#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 (file)
index 3cd62b8..0000000
+++ /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 (file)
index 18f407e..0000000
+++ /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 <errno.h>
-#include <limits.h>
-#include <pass/hal.h>
-#include <pass/hal-log.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#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 (file)
index 4425ca0..0000000
+++ /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 (file)
index eaa0039..0000000
+++ /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 <errno.h>
-#include <limits.h>
-#include <pass/hal.h>
-#include <pass/hal-log.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#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 (file)
index 57a168b..0000000
+++ /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 <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#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 (file)
index 174804f..0000000
+++ /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);