[RAMEN9610-11554][9610] soc: samsung: cal-if: Added cal_print_wakeup_reason.
authorJeonghoon Jang <jnghn.jang@samsung.com>
Tue, 15 Jan 2019 07:42:00 +0000 (16:42 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:14 +0000 (20:23 +0300)
Change-Id: I27f38d8896d07e7c368d35b77da7ae94fae51e1c
Signed-off-by: Jeonghoon Jang <jnghn.jang@samsung.com>
drivers/soc/samsung/cal-if/exynos9610/cal_data.c
drivers/soc/samsung/cal-if/pmucal_common.h
drivers/soc/samsung/exynos-pm.c

index 33dd24a4e6b026f9137d92753ed521f3e3009ae5..36992cf4e3e02ffd339dba346d1961f8a263ffd9 100644 (file)
@@ -291,3 +291,46 @@ void exynos9610_cal_data_init(void)
 }
 
 void (*cal_data_init)(void) = exynos9610_cal_data_init;
+
+struct cal_wkup_reason wkup_reason[] = {
+       { "INT_MBOX_CP2AP_S", (1 << 29) },
+       { "APM_CPU", (1 << 27) },
+       { "INT_MBOX_GNSS2AP", (1 << 26) },
+       { "CP_ACTIVE", (1 << 25) },
+       { "INT_MBOX_CP2AP", (1 << 24) },
+       { "GNSS_ACTIVE", (1 << 23) },
+       { "GNSS_RESET_REQ", (1 << 22) },
+       { "GNSS_WAKEUP_REQ", (1 << 21) },
+       { "CP_RESET_REQ", (1 << 20) },
+       { "INT_MBOX_APM2AP", (1 << 19) },
+       { "INT_MBOX_SHUB2AP", (1 << 18) },
+       { "INT_MBOX_WLBT2AP", (1 << 17) },
+       { "USBDRD20", (1 << 16) },
+       { "CP_SCAN_DUMP_REQ", (1 << 15) },
+       { "TIMER", (1 << 14) },
+       { "USB_REWA", (1 << 13) },
+       { "CMGP_EINT", (1 << 12) },
+       { "MMC2", (1 << 11) },
+       { "MMC0", (1 << 9) },
+       { "WLBT_ACTIVE", (1 << 6) },
+       { "WLBT_RESET_REQ", (1 << 5) },
+       { "TRTC_TICK", (1 << 4) },
+       { "TRTC_ALARM", (1 << 3) },
+       { "RTC_TICK", (1 << 2) },
+       { "RTC_ALARM", (1 << 1) },
+       { "EINT", (1 << 0) },
+};
+
+char *exynos9610_cal_print_wakeup_reason(unsigned int wakeup_stat)
+{
+       int i;
+       char *ret = "UNKNOWN";
+
+       for (i = 0; i < ARRAY_SIZE(wkup_reason); i++) {
+               if (wakeup_stat & wkup_reason[i].bit_field)
+                       ret = wkup_reason[i].name;
+       }
+
+       return ret;
+}
+char *(*cal_print_wakeup_reason)(unsigned int wakeup_stat) = exynos9610_cal_print_wakeup_reason;
index 13ff91b82178252cdce89ea636b6d8b1754c0bc9..8ad0c1267be2b161a0c1f3ab8eaccc6c826f7792 100644 (file)
@@ -78,4 +78,8 @@ struct pmucal_seq {
 }
 #endif
 
+struct cal_wkup_reason {
+       char name[20];
+       u32 bit_field;
+};
 #endif
index d59920a320156e9bea100a4fb1c08de38258c22e..80e536825c92382e493eff5bbe45cfa77c519583 100644 (file)
@@ -128,6 +128,7 @@ static void exynos_show_wakeup_registers(unsigned int wakeup_stat)
                pr_info("0x%02x ", __raw_readl(EXYNOS_EINT_PEND(pm_info->eint_base, i)));
 }
 
+extern char *(*cal_print_wakeup_reason)(unsigned int wakeup_stat);
 static void exynos_show_wakeup_reason(bool sleep_abort)
 {
        unsigned int wakeup_stat;
@@ -151,13 +152,20 @@ static void exynos_show_wakeup_reason(bool sleep_abort)
        exynos_pmu_read(EXYNOS_PMU_WAKEUP_STAT, &wakeup_stat);
        exynos_show_wakeup_registers(wakeup_stat);
 
-       if (wakeup_stat & WAKEUP_STAT_RTC_ALARM)
-               pr_info("%s Resume caused by RTC alarm\n", EXYNOS_PM_PREFIX);
-       else if (wakeup_stat & WAKEUP_STAT_EINT)
-               exynos_show_wakeup_reason_eint();
-       else
-               pr_info("%s Resume caused by wakeup_stat 0x%08x\n",
-                       EXYNOS_PM_PREFIX, wakeup_stat);
+       if (cal_print_wakeup_reason) {
+               pr_info("%s Resume caused by %s\n", EXYNOS_PM_PREFIX,
+                               cal_print_wakeup_reason(wakeup_stat));
+               if (wakeup_stat & WAKEUP_STAT_EINT)
+                       exynos_show_wakeup_reason_eint();
+       } else {
+               if (wakeup_stat & WAKEUP_STAT_RTC_ALARM)
+                       pr_info("%s Resume caused by RTC alarm\n", EXYNOS_PM_PREFIX);
+               else if (wakeup_stat & WAKEUP_STAT_EINT)
+                       exynos_show_wakeup_reason_eint();
+               else
+                       pr_info("%s Resume caused by wakeup_stat 0x%08x\n",
+                               EXYNOS_PM_PREFIX, wakeup_stat);
+       }
 }
 
 #ifdef CONFIG_CPU_IDLE