From 9b5f06772b839ed5fbd0891af0f09ae780410732 Mon Sep 17 00:00:00 2001 From: Hyeonseong Gil Date: Wed, 13 Jul 2016 17:45:29 +0900 Subject: [PATCH] [COMMON] thermal: samsung: Parse power coeff from ECT Change-Id: I08b54b3392b220a4ef1cc6de8d7b97ecbed5581e Signed-off-by: Hyeonseong Gil --- drivers/thermal/samsung/exynos_tmu.c | 29 ++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index e2a53cf9d274..f5e545923276 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -42,6 +42,7 @@ #include #include #include +#include #include "exynos_tmu.h" #include "../thermal_core.h" @@ -1175,6 +1176,8 @@ static int exynos_cpufreq_cooling_register(struct exynos_tmu_data *data) int cpu, ret; const char *governor_name; u32 power_coefficient = 0; + void *gen_block; + struct ect_gen_param_table *pwr_coeff; np = of_find_node_by_name(NULL, "thermal-zones"); if (!np) @@ -1203,7 +1206,17 @@ static int exynos_cpufreq_cooling_register(struct exynos_tmu_data *data) if (!of_property_read_string(child, "governor", &governor_name)) { if (!strncasecmp(governor_name, "power_allocator", THERMAL_NAME_LENGTH)) { - of_property_read_u32(cool_np, "dynamic-power-coefficient", &power_coefficient); + gen_block = ect_get_block("GEN"); + if (gen_block == NULL) { + pr_err("%s: Failed to get gen block from ECT\n", __func__); + return -EINVAL; + } + pwr_coeff = ect_gen_param_get_table(gen_block, "DTM_PWR_Coeff"); + if (pwr_coeff == NULL) { + pr_err("%s: Failed to get power coeff from ECT\n", __func__); + return -EINVAL; + } + power_coefficient = pwr_coeff->parameter[data->id]; } } @@ -1224,6 +1237,8 @@ static int exynos_gpufreq_cooling_register(struct exynos_tmu_data *data) int ret; const char *governor_name; u32 power_coefficient = 0; + void *gen_block; + struct ect_gen_param_table *pwr_coeff; np = of_find_node_by_name(NULL, "thermal-zones"); if (!np) @@ -1248,7 +1263,17 @@ static int exynos_gpufreq_cooling_register(struct exynos_tmu_data *data) if (!of_property_read_string(child, "governor", &governor_name)) { if (!strncasecmp(governor_name, "power_allocator", THERMAL_NAME_LENGTH)) { - of_property_read_u32(cool_np, "dynamic-power-coefficient", &power_coefficient); + gen_block = ect_get_block("GEN"); + if (gen_block == NULL) { + pr_err("%s: Failed to get gen block from ECT\n", __func__); + return -EINVAL; + } + pwr_coeff = ect_gen_param_get_table(gen_block, "DTM_PWR_Coeff"); + if (pwr_coeff == NULL) { + pr_err("%s: Failed to get power coeff from ECT\n", __func__); + return -EINVAL; + } + power_coefficient = pwr_coeff->parameter[data->id]; } } -- 2.20.1