static wake_reason_t spm_output_wake_reason(struct wake_status *wakesta, struct pcm_desc *pcmdesc) { wake_reason_t wr; wr = __spm_output_wake_reason(wakesta, pcmdesc, true); #if 1 memcpy(&suspend_info[log_wakesta_cnt], wakesta, sizeof(struct wake_status)); suspend_info[log_wakesta_cnt].log_index = log_wakesta_index; log_wakesta_cnt++; log_wakesta_index++; if (10 <= log_wakesta_cnt) { log_wakesta_cnt = 0; spm_snapshot_golden_setting = 0; } #if 0 else { if (2 != spm_snapshot_golden_setting) { if ((0x90100000 == wakesta->event_reg) && (0x140001f == wakesta->debug_flag)) spm_snapshot_golden_setting = 1; } } #endif if (0xFFFFFFF0 <= log_wakesta_index) log_wakesta_index = 0; #endif spm_crit2("big core = %d, suspend dormant state = %d, chip = %d\n", SPM_CTRL_BIG_CPU, spm_dormant_sta, mt_get_chip_sw_ver()); if (0 != spm_ap_mdsrc_req_cnt) spm_crit2("warning: spm_ap_mdsrc_req_cnt = %d, r7[ap_mdsrc_req] = 0x%x\n", spm_ap_mdsrc_req_cnt, spm_read(SPM_POWER_ON_VAL1) & (1<<17)); if (wakesta->r12 & WAKE_SRC_EINT) mt_eint_print_status(); if (wakesta->r12 & WAKE_SRC_CLDMA_MD) exec_ccci_kern_func_by_md_id(0, ID_GET_MD_WAKEUP_SRC, NULL, 0); return wr; }
static wake_reason_t spm_output_wake_reason(const wake_status_t *wakesta, bool dpidle) { char str[200] = { 0 }; wake_reason_t wr = WR_NONE; if (wakesta->debug_reg != 0) { spm_error2("PCM ASSERT AND PC = %u (0x%x)(0x%x)\n", wakesta->debug_reg, wakesta->r13, wakesta->event_reg); return WR_PCM_ASSERT; } if (dpidle) { /* bypass wakeup event check */ spm_info("[DP] r12 = 0x%x, r13 = 0x%x, r7 = 0x%x (0x%x)\n", wakesta->r12, wakesta->r13, spm_read(SPM_PCM_REG7_DATA), spm_read(SPM_POWER_ON_VAL1)); return WR_WAKE_SRC; } if (wakesta->r12 & (1U << 0)) { if (!(wakesta->isr & ISR_TWAM) && !wakesta->cpu_wake) { strcat(str, "PCM_TIMER "); wr = WR_PCM_TIMER; } else { if (wakesta->isr & ISR_TWAM) { strcat(str, "TWAM "); wr = WR_WAKE_SRC; } if (wakesta->cpu_wake) { strcat(str, "CPU "); wr = WR_WAKE_SRC; } } } if (wakesta->r12 & WAKE_SRC_TS) { strcat(str, "TS "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_KP) { strcat(str, "KP "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_WDT) { strcat(str, "WDT "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_GPT) { strcat(str, "GPT "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_EINT) { strcat(str, "EINT "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_CONN_WDT) { strcat(str, "CONN_WDT "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_CCIF_MD) { strcat(str, "CCIF_MD "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_LOW_BAT) { strcat(str, "LOW_BAT "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_CONN) { strcat(str, "CONN "); wr = WR_WAKE_SRC; } if (wakesta->r12 & (1U << 13)) { strcat(str, "PCM_WDT "); wr = WR_PCM_WDT; } if (wakesta->r12 & WAKE_SRC_USB_CD) { strcat(str, "USB_CD "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_USB_PDN) { strcat(str, "USB_PDN "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_DBGSYS) { strcat(str, "DBGSYS "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_UART0) { strcat(str, "UART0 "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_AFE) { strcat(str, "AFE "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_THERM) { strcat(str, "THERM "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_CIRQ) { strcat(str, "CIRQ "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_SYSPWREQ) { strcat(str, "SYSPWREQ "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_MD_WDT) { strcat(str, "MD_WDT "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_CPU0_IRQ) { strcat(str, "CPU0_IRQ "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_CPU1_IRQ) { strcat(str, "CPU1_IRQ "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_CPU2_IRQ) { strcat(str, "CPU2_IRQ "); wr = WR_WAKE_SRC; } if (wakesta->r12 & WAKE_SRC_CPU3_IRQ) { strcat(str, "CPU3_IRQ "); wr = WR_WAKE_SRC; } if (wr == WR_NONE) { strcat(str, "UNKNOWN "); wr = WR_UNKNOWN; } spm_crit2("wake up by %s(0x%x)(0x%x)(%u)\n", str, wakesta->r12, wakesta->raw_sta, wakesta->timer_out); spm_crit2("event_reg = 0x%x, isr = 0x%x, r13 = 0x%x\n", wakesta->event_reg, wakesta->isr, wakesta->r13); if (wakesta->r12 & WAKE_SRC_EINT) mt_eint_print_status(); if (wakesta->r12 & WAKE_SRC_CCIF_MD) exec_ccci_kern_func_by_md_id(0, ID_GET_MD_WAKEUP_SRC, NULL, 0); return wr; }