[COMMON] thermal: cpu_cooling: Use cal_id from cpufreq dt
authorHyeonseong Gil <hs.gil@samsung.com>
Fri, 16 Mar 2018 11:33:06 +0000 (20:33 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:22:26 +0000 (17:22 +0900)
Change-Id: I3ef9d9848b0c87173d2ab630e497ebb73cbf7cff
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/thermal/cpu_cooling.c

index 9d8bb4cc1ab729dd6dabf95a61da8aa5235886bd..715bf0b934ecb4820d95e38e4fb0df4118211e40 100644 (file)
 #include <soc/samsung/cal-if.h>
 #include <soc/samsung/ect_parser.h>
 
-#if defined(CONFIG_SOC_EXYNOS8895) && defined(CONFIG_SOC_EMULATOR8895)
-#include <dt-bindings/clock/emulator8895.h>
-#elif defined(CONFIG_SOC_EXYNOS8895) && !defined(CONFIG_SOC_EMULATOR8895)
-#include <dt-bindings/clock/exynos8895.h>
-#elif defined(CONFIG_SOC_EXYNOS7872)
-#include <dt-bindings/clock/exynos7872.h>
-#elif defined(CONFIG_SOC_EXYNOS9810)
-#include <dt-bindings/clock/exynos9810.h>
-#endif
-
 /*
  * Cooling state <-> CPUFreq frequency
  *
@@ -277,20 +267,24 @@ static int update_freq_table(struct cpufreq_cooling_device *cpufreq_cdev,
        return 0;
 }
 
-static int build_static_power_table(struct cpufreq_cooling_device *cpufreq_cdev)
+static int build_static_power_table(struct device_node *np, struct cpufreq_cooling_device *cpufreq_cdev)
 {
        int i, j;
-#if defined(CONFIG_SOC_EXYNOS9810)
-       int ratio = cal_asv_get_ids_info(ACPM_DVFS_CPUCL1);
-       int asv_group = cal_asv_get_grp(ACPM_DVFS_CPUCL1);
-#else
-       int ratio = cal_asv_get_ids_info(ACPM_DVFS_CPUCL0);
-       int asv_group = cal_asv_get_grp(ACPM_DVFS_CPUCL0);
-#endif
+       int ratio, asv_group, cal_id, ret = 0;
+
        void *gen_block;
        struct ect_gen_param_table *volt_temp_param, *asv_param;
        int ratio_table[16] = { 0, 18, 22, 27, 33, 40, 49, 60, 73, 89, 108, 131, 159, 194, 232, 250};
 
+       ret = of_property_read_u32(np, "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;
 
@@ -983,7 +977,7 @@ __cpufreq_cooling_register(struct device_node *np,
                        goto remove_ida;
                }
 
-               ret = build_static_power_table(cpufreq_cdev);
+               ret = build_static_power_table(np, cpufreq_cdev);
                if (ret) {
                        cdev = ERR_PTR(ret);
                        goto remove_ida;