From 5668aa03df7cea924201e7a40308c9efdbb0506b Mon Sep 17 00:00:00 2001 From: Hyeonseong Gil Date: Wed, 19 Oct 2016 14:08:45 +0900 Subject: [PATCH] [COMMON] thermal: samsung: Logging MCINFO MR4 status Change-Id: I04823d0c9a92af9a8c433ca847189687cdbd9298 Signed-off-by: Hyeonseong Gil --- drivers/thermal/samsung/exynos_tmu.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 655aadb8b587..628e6148e775 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include "exynos_tmu.h" @@ -703,10 +704,18 @@ static void exynos8895_tmu_control(struct platform_device *pdev, bool on) writel(global_avg_con, data->base + EXYNOS_TMU_REG_AVG_CON); } + +#define MCINFO_LOG_THRESHOLD (4) + static int exynos_get_temp(void *p, int *temp) { struct exynos_tmu_data *data = p; struct thermal_cooling_device *cdev; + unsigned int mcinfo_count; + unsigned int mcinfo_result[4] = {0, 0, 0, 0}; + unsigned int mcinfo_logging = 0; + unsigned int mcinfo_temp = 0; + unsigned int i; if (!data || !data->tmu_read) return -EINVAL; @@ -733,6 +742,21 @@ static int exynos_get_temp(void *p, int *temp) mutex_unlock(&thermal_suspend_lock); exynos_ss_thermal(data->pdata, *temp / 1000, data->tmu_name, 0); + + if (data->id == 0) { + mcinfo_count = get_mcinfo_base_count(); + get_refresh_rate(mcinfo_result); + + for (i = 0; i < mcinfo_count; i++) { + mcinfo_temp |= (mcinfo_result[i] & 0xf) << (8 * i); + + if (mcinfo_result[i] >= MCINFO_LOG_THRESHOLD) + mcinfo_logging = 1; + } + + if (mcinfo_logging == 1) + exynos_ss_thermal(NULL, mcinfo_temp, "MCINFO", 0); + } return 0; } -- 2.20.1