From: Hyeonseong Gil Date: Fri, 16 Mar 2018 11:33:06 +0000 (+0900) Subject: [COMMON] thermal: cpu_cooling: Use cal_id from cpufreq dt X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=52517162ae5dbc7ce35af42c09a24dc17f38f7b9;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] thermal: cpu_cooling: Use cal_id from cpufreq dt Change-Id: I3ef9d9848b0c87173d2ab630e497ebb73cbf7cff Signed-off-by: Hyeonseong Gil --- diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 9d8bb4cc1ab7..715bf0b934ec 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -39,16 +39,6 @@ #include #include -#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 - /* * 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;