From: Jeonghoon Jang Date: Tue, 15 Jan 2019 07:42:00 +0000 (+0900) Subject: [RAMEN9610-11554][9610] soc: samsung: cal-if: Added cal_print_wakeup_reason. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=63c49b52a25f5fb4e0d352c435d46461b0ef03a1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [RAMEN9610-11554][9610] soc: samsung: cal-if: Added cal_print_wakeup_reason. Change-Id: I27f38d8896d07e7c368d35b77da7ae94fae51e1c Signed-off-by: Jeonghoon Jang --- diff --git a/drivers/soc/samsung/cal-if/exynos9610/cal_data.c b/drivers/soc/samsung/cal-if/exynos9610/cal_data.c index 33dd24a4e6b0..36992cf4e3e0 100644 --- a/drivers/soc/samsung/cal-if/exynos9610/cal_data.c +++ b/drivers/soc/samsung/cal-if/exynos9610/cal_data.c @@ -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; diff --git a/drivers/soc/samsung/cal-if/pmucal_common.h b/drivers/soc/samsung/cal-if/pmucal_common.h index 13ff91b82178..8ad0c1267be2 100644 --- a/drivers/soc/samsung/cal-if/pmucal_common.h +++ b/drivers/soc/samsung/cal-if/pmucal_common.h @@ -78,4 +78,8 @@ struct pmucal_seq { } #endif +struct cal_wkup_reason { + char name[20]; + u32 bit_field; +}; #endif diff --git a/drivers/soc/samsung/exynos-pm.c b/drivers/soc/samsung/exynos-pm.c index d59920a32015..80e536825c92 100644 --- a/drivers/soc/samsung/exynos-pm.c +++ b/drivers/soc/samsung/exynos-pm.c @@ -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