From 4e4c881df6fd42c988d23f19bf6c6cb179cfbf49 Mon Sep 17 00:00:00 2001 From: Hyeonseong Gil Date: Fri, 23 Mar 2018 17:01:26 +0900 Subject: [PATCH] [COMMON] thermal: gpu_cooling: Use g3d_cmu_cal_id from dt Change-Id: Ibbdd6813d9b4482497b0c4fa6b7020a9f8e42790 Signed-off-by: Hyeonseong Gil --- drivers/thermal/gpu_cooling.c | 26 ++++++++++++-------------- drivers/thermal/samsung/exynos_tmu.c | 6 ++++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/thermal/gpu_cooling.c b/drivers/thermal/gpu_cooling.c index 37b605d6d32f..8170e8c7606b 100644 --- a/drivers/thermal/gpu_cooling.c +++ b/drivers/thermal/gpu_cooling.c @@ -34,16 +34,6 @@ #include #include "samsung/exynos_tmu.h" -#if defined(CONFIG_SOC_EXYNOS8895) && defined(CONFIG_SOC_EMULATOR8895) -#include -#elif defined(CONFIG_SOC_EXYNOS8895) && !defined(CONFIG_SOC_EMULATOR8895) -#include -#elif defined(CONFIG_SOC_EXYNOS7872) -#include -#elif defined(CONFIG_SOC_EXYNOS9810) -#include -#endif - /** * struct power_table - frequency to power conversion * @frequency: frequency in KHz @@ -333,15 +323,23 @@ static int build_dyn_power_table(struct gpufreq_cooling_device *gpufreq_cdev, return 0; } -static int build_static_power_table(struct gpufreq_cooling_device *gpufreq_cdev) +static int build_static_power_table(struct device_node *np, struct gpufreq_cooling_device *gpufreq_cdev) { int i, j; - int ratio = cal_asv_get_ids_info(ACPM_DVFS_G3D); - int asv_group = cal_asv_get_grp(ACPM_DVFS_G3D); + int ratio = 0, asv_group = 0, cal_id = 0, ret = 0; void *gen_block; struct ect_gen_param_table *volt_temp_param, *asv_param; int ratio_table[16] = { 0, 25, 29, 35, 41, 48, 57, 67, 79, 94, 110, 130, 151, 162, 162, 162}; + ret = of_property_read_u32(np, "g3d_cmu_cal_id", &cal_id); + if (ret) { + pr_err("%s: Failed to get cal-id\n", __func__); + return -EINVAL; + } + + ratio = cal_asv_get_ids_info(cal_id); + asv_group = cal_asv_get_grp(cal_id); + if (asv_group < 0 || asv_group > 15) asv_group = 0; @@ -870,7 +868,7 @@ __gpufreq_cooling_register(struct device_node *np, if (ret) return ERR_PTR(ret); - ret = build_static_power_table(gpufreq_cdev); + ret = build_static_power_table(np, gpufreq_cdev); if (ret) return ERR_PTR(ret); } diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index afca16b4d2d2..e569971f2e09 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -176,6 +176,8 @@ #define EXYNOS_TMU_LPI_MODE_SHIFT (10) #define EXYNOS_TMU_LPI_MODE_MASK (1) +#define EXYNOS_GPU_THERMAL_ZONE_ID (2) + #define TOTAL_SENSORS 16 #define DEFAULT_BALANCE_OFFSET 20 @@ -1472,7 +1474,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) data->tzd->ops->set_mode(data->tzd, THERMAL_DEVICE_ENABLED); #ifdef CONFIG_MALI_DEBUG_KERNEL_SYSFS - if (data->id == 2) + if (data->id == EXYNOS_GPU_THERMAL_ZONE_ID) gpu_thermal_data = data; #endif @@ -1669,7 +1671,7 @@ static ssize_t ipc_dump2_read(struct file *file, char __user *user_buf, char buf[48]; ssize_t ret; - exynos_acpm_tmu_ipc_dump(2, data.dump); + exynos_acpm_tmu_ipc_dump(EXYNOS_GPU_THERMAL_ZONE_ID, data.dump); ret = snprintf(buf, sizeof(buf), "%3d %3d %3d %3d %3d %3d %3d\n", data.val[1], data.val[2], data.val[3], -- 2.20.1