[COMMON] thermal: samsung: support cold temperature control during CP call
authorEunseok Choi <es10.choi@samsung.com>
Thu, 4 May 2017 10:54:47 +0000 (19:54 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:18:47 +0000 (17:18 +0900)
Change-Id: I5e61e18ea0c77ca999ccfd3e4057707c0d30bb1d
Signed-off-by: Eunseok Choi <es10.choi@samsung.com>
drivers/thermal/samsung/exynos_tmu.c

index fe79a9b328f1daad41ec4a05dcb9a3fcfdce5a6a..c99b03f9b861ebc6c6a8ee3ff2de27547a415104 100644 (file)
@@ -53,6 +53,7 @@
 #include "../thermal_core.h"
 #ifdef CONFIG_EXYNOS_ACPM_THERMAL
 #include "exynos_acpm_tmu.h"
+#include "soc/samsung/exynos-pmu.h"
 #endif
 
 /* Exynos generic registers */
 #define DEFAULT_BALANCE_OFFSET 20
 
 #ifdef CONFIG_EXYNOS_ACPM_THERMAL
+#define PMUREG_AUD_STATUS                      0x4004
 static struct acpm_tmu_cap cap;
 static unsigned int num_of_devices, suspended_count;
+static bool cp_call_mode;
+static bool is_aud_on(void)
+{
+       unsigned int val;
+
+       exynos_pmu_read(PMUREG_AUD_STATUS, &val);
+
+       return ((val & 0xf) == 0xf);
+}
 #else
 static bool suspended;
 static DEFINE_MUTEX (thermal_suspend_lock);
@@ -2231,11 +2242,18 @@ static int exynos_tmu_suspend(struct device *dev)
        suspended_count++;
        disable_irq(data->irq);
 
-       exynos_tmu_control(pdev, false);
-
-       if (suspended_count == num_of_devices) {
-               exynos_acpm_tmu_set_suspend();
-               pr_info("%s: TMU suspend complete\n", __func__);
+       cp_call_mode = is_aud_on() && cap.acpm_irq;
+       if (cp_call_mode) {
+               if (suspended_count == num_of_devices) {
+                       exynos_acpm_tmu_set_cp_call();
+                       pr_info("%s: TMU suspend w/ AUD-on complete\n", __func__);
+               }
+       } else {
+               exynos_tmu_control(pdev, false);
+               if (suspended_count == num_of_devices) {
+                       exynos_acpm_tmu_set_suspend();
+                       pr_info("%s: TMU suspend complete\n", __func__);
+               }
        }
 #else
        exynos_tmu_control(to_platform_device(dev), false);
@@ -2254,8 +2272,10 @@ static int exynos_tmu_resume(struct device *dev)
        if (suspended_count == num_of_devices)
                exynos_acpm_tmu_set_resume();
 
-       exynos_tmu_initialize(pdev);
-       exynos_tmu_control(pdev, true);
+       if (!cp_call_mode) {
+               exynos_tmu_initialize(pdev);
+               exynos_tmu_control(pdev, true);
+       }
 
        exynos_acpm_tmu_set_read_temp(data->tzd->id, &temp);