From: Hyeonseong Gil Date: Wed, 19 Oct 2016 05:08:45 +0000 (+0900) Subject: [COMMON] thermal: samsung: Logging MCINFO MR4 status X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5668aa03df7cea924201e7a40308c9efdbb0506b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] thermal: samsung: Logging MCINFO MR4 status Change-Id: I04823d0c9a92af9a8c433ca847189687cdbd9298 Signed-off-by: Hyeonseong Gil --- 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; }