+/*
+ * 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>
#define DEVFREQ_GPU_MIN_FREQ_PATH_SUFFIX "/min_freq"
#define DEVFREQ_GPU_MAX_FREQ_PATH_SUFFIX "/max_freq"
-#define TMU_PATH_PREFIX "/sys/class/thermal/thermal_zone"
+#define TMU_PATH_PREFIX "/sys/class/thermal/"
#define TMU_TEMP_PATH_SUFFIX "/temp"
#define TMU_POLICY_PATH_SUFFIX "/policy"
-#define TM2_GPU_THERMAL_ZONE_NUM 2
-
static int tm2_dvfs_get_curr_governor(char *res_name, char *governor)
{
char path[PATH_MAX];
.get_load_table = NULL,
};
-static int tm2_tmu_get_temp(char *res_name)
+static int tm2_tmu_get_temp(char *res_thermal_name);
{
char path[PATH_MAX];
int temp;
if (!res_name)
return -EINVAL;
- snprintf(path, PATH_MAX, "%s%d%s",
+ snprintf(path, PATH_MAX, "%s%s%s",
TMU_PATH_PREFIX,
- TM2_GPU_THERMAL_ZONE_NUM,
+ res_thermal_name,
TMU_TEMP_PATH_SUFFIX);
ret = sysfs_read_int(path, &temp);
return temp;
}
-static int tm2_tmu_get_policy(char *res_name, char *policy)
+static int tm2_tmu_get_policy(char *res_thermal_name, char *policy)
{
char path[PATH_MAX];
int ret;
if ((!res_name) || (!policy))
return -EINVAL;
- snprintf(path, PATH_MAX, "%s%d%s",
+ snprintf(path, PATH_MAX, "%s%s%s",
TMU_PATH_PREFIX,
- TM2_GPU_THERMAL_ZONE_NUM,
+ res_thermal_name,
TMU_POLICY_PATH_SUFFIX);
ret = sysfs_read_str(path, policy, BUFF_MAX);
.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;
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;