Line 194:
Line 194:
u32 debug_val = *(u32 *)LT_DEBUG;
u32 debug_val = *(u32 *)LT_DEBUG;
−
u32 state_flag = 0;
+
u32 pflags_val = 0;
// Check if the CMPT_RETSTAT0 flag is raised
// Check if the CMPT_RETSTAT0 flag is raised
if (debug_val & 0x04)
if (debug_val & 0x04)
−
state_flag = 0x100000;
+
pflags_val = 0x100000; // Set CMPT_RETSTAT0 power flag
// Check if the CMPT_RETSTAT1 flag is raised
// Check if the CMPT_RETSTAT1 flag is raised
if (debug_val & 0x08)
if (debug_val & 0x08)
−
state_flag |= 0x80000;
+
pflags_val |= 0x80000; // Set CMPT_RETSTAT1 power flag
u32 rtc_ctrl0 = *(u32 *)rtc_control0_buf;
u32 rtc_ctrl0 = *(u32 *)rtc_control0_buf;
Line 208:
Line 208:
// Check if the POFFLG_FPOFF flag is raised
// Check if the POFFLG_FPOFF flag is raised
if (rtc_ctrl0 & 0x04000000)
if (rtc_ctrl0 & 0x04000000)
−
state_flag |= 0x01000000;
+
pflags_val |= 0x01000000; // Set POFF_FORCED power flag
// Check if the POFFLG_4S flag is raised
// Check if the POFFLG_4S flag is raised
if (rtc_ctrl0 & 0x02000000)
if (rtc_ctrl0 & 0x02000000)
−
state_flag |= 0x00800000;
+
pflags_val |= 0x00800000; // Set POFF_4S power flag
// Check if the POFFLG_TMR flag is raised
// Check if the POFFLG_TMR flag is raised
if (rtc_ctrl0 & 0x01000000)
if (rtc_ctrl0 & 0x01000000)
−
state_flag |= 0x00400000;
+
pflags_val |= 0x00400000; // Set POFF_TMR power flag
// Check if the PONLG_TMR flag is raised
// Check if the PONLG_TMR flag is raised
if (rtc_ctrl0 & 0x00010000)
if (rtc_ctrl0 & 0x00010000)
−
state_flag |= 0x02000000;
+
pflags_val |= 0x02000000; // Set PON_TMR power flag
// Check if PONFLG_SYS is raised
// Check if PONFLG_SYS is raised
if (rtc_ctrl0 & 0x00020000)
if (rtc_ctrl0 & 0x00020000)
{
{
−
state_flag |= 0x04000000;
+
pflags_val |= 0x04000000; // Set PON_SMC power flag
// Read the SystemEventFlag from SMC
// Read the SystemEventFlag from SMC
Line 234:
Line 234:
// POWER button was pressed
// POWER button was pressed
if (sys_event & 0x00000040)
if (sys_event & 0x00000040)
−
state_flag |= 0x80000000;
+
pflags_val |= 0x80000000; // Set PON_POWER_BTN power flag
// EJECT button was pressed
// EJECT button was pressed
if (sys_event & 0x00000020)
if (sys_event & 0x00000020)
−
state_flag |= 0x40000000;
+
pflags_val |= 0x40000000; // Set PON_EJECT_BTN power flag
// Wake 1 signal is active
// Wake 1 signal is active
if (sys_event & 0x00000001)
if (sys_event & 0x00000001)
−
state_flag |= 0x08000000;
+
pflags_val |= 0x08000000; // Set PON_WAKEREQ1_EVENT power flag
// Wake 0 signal is active
// Wake 0 signal is active
if (sys_event & 0x00000002)
if (sys_event & 0x00000002)
−
state_flag |= 0x10000000;
+
pflags_val |= 0x10000000; // Set PON_WAKEREQ0_EVENT power flag
// BT interrupt request is active
// BT interrupt request is active
if (sys_event & 0x00000004)
if (sys_event & 0x00000004)
−
state_flag |= 0x20000000;
+
pflags_val |= 0x20000000; // Set PON_WAKEBT_EVENT power flag
// Timer signal is active
// Timer signal is active
if (sys_event & 0x00000008)
if (sys_event & 0x00000008)
−
state_flag |= 0x00020000;
+
pflags_val |= 0x00020000; // Set PON_SMC_TIMER power flag
}
}
Line 264:
Line 264:
// Check if SLEEP_EN is raised
// Check if SLEEP_EN is raised
if (rtc_ctrl1 & 0x00000100)
if (rtc_ctrl1 & 0x00000100)
−
state_flag |= 0x00200000;
+
pflags_val |= 0x00200000; // Set DDR_SREFRESH power flag
u32 mem_mode = 0;
u32 mem_mode = 0;
−
// SLEEP_EN is raised
+
// DDR_SREFRESH power flag is set
−
if (state_flag & 0x00200000)
+
if (pflags_val & 0x00200000)
mem_mode = 0x08;
mem_mode = 0x08;
−
// sys_event has 0x00000008 flag (timer signal) set
+
// PON_SMC_TIMER power flag is set
−
if (state_flag & 0x00020000)
+
if (pflags_val & 0x00020000)
{
{
// Pulse the CCIndicator
// Pulse the CCIndicator