summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/host/chipset.c1
-rw-r--r--board/samus/power_sequence.c3
-rw-r--r--board/samus_pd/board.c2
-rw-r--r--common/hooks.c2
-rw-r--r--core/cortex-m/ec.lds.S4
-rw-r--r--core/cortex-m0/ec.lds.S4
-rw-r--r--core/host/host_exe.lds4
-rw-r--r--core/minute-ia/ec.lds.S4
-rw-r--r--core/nds32/ec.lds.S4
-rw-r--r--core/riscv-rv32i/ec.lds.S4
-rw-r--r--include/hooks.h7
-rw-r--r--include/link_defs.h2
-rw-r--r--power/braswell.c3
-rw-r--r--power/intel_x86.c3
-rw-r--r--power/mt817x.c3
-rw-r--r--power/mt8183.c3
-rw-r--r--power/mt8192.c3
-rw-r--r--power/rk3288.c3
-rw-r--r--power/rk3399.c3
-rw-r--r--power/sc7180.c3
-rw-r--r--power/sdm845.c3
-rw-r--r--power/stoney.c3
22 files changed, 71 insertions, 0 deletions
diff --git a/board/host/chipset.c b/board/host/chipset.c
index 0b52432e72..3cb859eb29 100644
--- a/board/host/chipset.c
+++ b/board/host/chipset.c
@@ -71,5 +71,6 @@ test_mockable void chipset_task(void)
power_off_req = 0;
chipset_state = CHIPSET_STATE_SOFT_OFF;
hook_notify(HOOK_CHIPSET_SHUTDOWN);
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
}
}
diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c
index 20109fe803..5abfc5f39c 100644
--- a/board/samus/power_sequence.c
+++ b/board/samus/power_sequence.c
@@ -462,6 +462,9 @@ enum power_state power_handle_state(enum power_state state)
gpio_set_level(GPIO_TOUCHSCREEN_RESET_L, 0);
gpio_set_level(GPIO_LIGHTBAR_RESET_L, 0);
+ /* Call hooks after we remove power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
+
return power_get_pause_in_s5() ? POWER_S5 : POWER_S5G3;
case POWER_S5G3:
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index 69a67f6e44..cf388c2c7f 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -135,6 +135,7 @@ static void chipset_s3_to_s5(void)
{
ps = POWER_S5;
hook_notify(HOOK_CHIPSET_SHUTDOWN);
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
}
static void chipset_s0_to_s3(void)
@@ -234,6 +235,7 @@ static void board_init(void)
} else {
enable_sleep(SLEEP_MASK_AP_RUN);
hook_notify(HOOK_CHIPSET_SHUTDOWN);
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
ps = POWER_S5;
}
diff --git a/common/hooks.c b/common/hooks.c
index 2dd0289741..8c8e8b09fe 100644
--- a/common/hooks.c
+++ b/common/hooks.c
@@ -41,6 +41,8 @@ static const struct hook_ptrs hook_list[] = {
{__hooks_chipset_resume, __hooks_chipset_resume_end},
{__hooks_chipset_suspend, __hooks_chipset_suspend_end},
{__hooks_chipset_shutdown, __hooks_chipset_shutdown_end},
+ {__hooks_chipset_shutdown_complete,
+ __hooks_chipset_shutdown_complete_end},
{__hooks_chipset_reset, __hooks_chipset_reset_end},
{__hooks_ac_change, __hooks_ac_change_end},
{__hooks_lid_change, __hooks_lid_change_end},
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S
index 9aa1c987ba..1e620dc54d 100644
--- a/core/cortex-m/ec.lds.S
+++ b/core/cortex-m/ec.lds.S
@@ -192,6 +192,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN))
__hooks_chipset_shutdown_end = .;
+ __hooks_chipset_shutdown_complete = .;
+ KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE))
+ __hooks_chipset_shutdown_complete_end = .;
+
__hooks_chipset_reset = .;
KEEP(*(.rodata.HOOK_CHIPSET_RESET))
__hooks_chipset_reset_end = .;
diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S
index 0168896123..8a3a75b272 100644
--- a/core/cortex-m0/ec.lds.S
+++ b/core/cortex-m0/ec.lds.S
@@ -121,6 +121,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN))
__hooks_chipset_shutdown_end = .;
+ __hooks_chipset_shutdown_complete = .;
+ KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE))
+ __hooks_chipset_shutdown_complete_end = .;
+
__hooks_chipset_reset = .;
KEEP(*(.rodata.HOOK_CHIPSET_RESET))
__hooks_chipset_reset_end = .;
diff --git a/core/host/host_exe.lds b/core/host/host_exe.lds
index 99f55353e3..fbf7b56351 100644
--- a/core/host/host_exe.lds
+++ b/core/host/host_exe.lds
@@ -61,6 +61,10 @@ SECTIONS {
*(.rodata.HOOK_CHIPSET_SHUTDOWN)
__hooks_chipset_shutdown_end = .;
+ __hooks_chipset_shutdown_complete = .;
+ *(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE)
+ __hooks_chipset_shutdown_complete_end = .;
+
__hooks_chipset_reset = .;
*(.rodata.HOOK_CHIPSET_RESET)
__hooks_chipset_reset_end = .;
diff --git a/core/minute-ia/ec.lds.S b/core/minute-ia/ec.lds.S
index c2c5bbfac7..37d2d8da49 100644
--- a/core/minute-ia/ec.lds.S
+++ b/core/minute-ia/ec.lds.S
@@ -88,6 +88,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN))
__hooks_chipset_shutdown_end = .;
+ __hooks_chipset_shutdown_complete = .;
+ KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE))
+ __hooks_chipset_shutdown_complete_end = .;
+
__hooks_chipset_reset = .;
KEEP(*(.rodata.HOOK_CHIPSET_RESET))
__hooks_chipset_reset_end = .;
diff --git a/core/nds32/ec.lds.S b/core/nds32/ec.lds.S
index 96526e9a55..75c687655a 100644
--- a/core/nds32/ec.lds.S
+++ b/core/nds32/ec.lds.S
@@ -117,6 +117,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN))
__hooks_chipset_shutdown_end = .;
+ __hooks_chipset_shutdown_complete = .;
+ KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE))
+ __hooks_chipset_shutdown_complete_end = .;
+
__hooks_chipset_reset = .;
KEEP(*(.rodata.HOOK_CHIPSET_RESET))
__hooks_chipset_reset_end = .;
diff --git a/core/riscv-rv32i/ec.lds.S b/core/riscv-rv32i/ec.lds.S
index e6c47beb00..2741521f39 100644
--- a/core/riscv-rv32i/ec.lds.S
+++ b/core/riscv-rv32i/ec.lds.S
@@ -156,6 +156,10 @@ SECTIONS
KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN))
__hooks_chipset_shutdown_end = .;
+ __hooks_chipset_shutdown_complete = .;
+ KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE))
+ __hooks_chipset_shutdown_complete_end = .;
+
__hooks_chipset_reset = .;
KEEP(*(.rodata.HOOK_CHIPSET_RESET))
__hooks_chipset_reset_end = .;
diff --git a/include/hooks.h b/include/hooks.h
index 0860a58d84..bc157bacbd 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -127,6 +127,13 @@ enum hook_type {
HOOK_CHIPSET_SHUTDOWN,
/*
+ * System has already shut down. All the suspend rails are already off.
+ *
+ * Hook routines are called from the chipset task.
+ */
+ HOOK_CHIPSET_SHUTDOWN_COMPLETE,
+
+ /*
* System reset in S0. All rails are still up.
*
* Hook routines are called from the chipset task.
diff --git a/include/link_defs.h b/include/link_defs.h
index 45e9850015..4465843b50 100644
--- a/include/link_defs.h
+++ b/include/link_defs.h
@@ -42,6 +42,8 @@ extern const struct hook_data __hooks_chipset_suspend[];
extern const struct hook_data __hooks_chipset_suspend_end[];
extern const struct hook_data __hooks_chipset_shutdown[];
extern const struct hook_data __hooks_chipset_shutdown_end[];
+extern const struct hook_data __hooks_chipset_shutdown_complete[];
+extern const struct hook_data __hooks_chipset_shutdown_complete_end[];
extern const struct hook_data __hooks_chipset_reset[];
extern const struct hook_data __hooks_chipset_reset_end[];
extern const struct hook_data __hooks_ac_change[];
diff --git a/power/braswell.c b/power/braswell.c
index eac3c63534..288092c795 100644
--- a/power/braswell.c
+++ b/power/braswell.c
@@ -269,6 +269,9 @@ enum power_state power_handle_state(enum power_state state)
/*wireless_set_state(WIRELESS_OFF);*/
+ /* Call hooks after we remove power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
+
/* Start shutting down */
return power_get_pause_in_s5() ? POWER_S5 : POWER_S5G3;
diff --git a/power/intel_x86.c b/power/intel_x86.c
index d1f0b17d84..a4de71ff5f 100644
--- a/power/intel_x86.c
+++ b/power/intel_x86.c
@@ -559,6 +559,9 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state)
/* Disable wireless */
wireless_set_state(WIRELESS_OFF);
+ /* Call hooks after we remove power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
+
/* Always enter into S5 state. The S5 state is required to
* correctly handle global resets which have a bit of delay
* while the SLP_Sx_L signals are asserted then deasserted.
diff --git a/power/mt817x.c b/power/mt817x.c
index 368712965b..e7e23605f2 100644
--- a/power/mt817x.c
+++ b/power/mt817x.c
@@ -514,6 +514,9 @@ static void power_off(void)
powerled_set_state(POWERLED_STATE_OFF);
#endif
CPRINTS("power shutdown complete");
+
+ /* Call hooks after we drop power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
}
/**
diff --git a/power/mt8183.c b/power/mt8183.c
index 735e59830f..d8d5a8e1a3 100644
--- a/power/mt8183.c
+++ b/power/mt8183.c
@@ -486,6 +486,9 @@ enum power_state power_handle_state(enum power_state state)
gpio_disable_interrupt(GPIO_AP_EC_WATCHDOG_L);
power_seq_run(s3s5_power_seq, ARRAY_SIZE(s3s5_power_seq));
+ /* Call hooks after we remove power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
+
/* Start shutting down */
return POWER_S5;
diff --git a/power/mt8192.c b/power/mt8192.c
index 749424b2c9..43d5a5c23f 100644
--- a/power/mt8192.c
+++ b/power/mt8192.c
@@ -409,6 +409,9 @@ enum power_state power_handle_state(enum power_state state)
GPIO_SET_LEVEL(GPIO_EN_PP1800_U, 0);
GPIO_SET_LEVEL(GPIO_EN_PP3300_U, 0);
+ /* Call hooks after we remove power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
+
/* Start shutting down */
return POWER_S5;
diff --git a/power/rk3288.c b/power/rk3288.c
index a44df2ffbc..c647ab97b2 100644
--- a/power/rk3288.c
+++ b/power/rk3288.c
@@ -380,6 +380,9 @@ static void power_off(void)
powerled_set_state(POWERLED_STATE_OFF);
CPRINTS("power shutdown complete");
+
+ /* Call hooks after we drop power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
}
void chipset_reset(enum chipset_reset_reason reason)
diff --git a/power/rk3399.c b/power/rk3399.c
index 9f146fccf9..9db25f0b28 100644
--- a/power/rk3399.c
+++ b/power/rk3399.c
@@ -521,6 +521,9 @@ enum power_state power_handle_state(enum power_state state)
power_seq_run(s3s5_power_seq, ARRAY_SIZE(s3s5_power_seq));
+ /* Call hooks after we remove power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
+
/* Start shutting down */
return POWER_S5;
diff --git a/power/sc7180.c b/power/sc7180.c
index 2011f503e2..be2ee90f8b 100644
--- a/power/sc7180.c
+++ b/power/sc7180.c
@@ -496,6 +496,9 @@ static void power_off(void)
lid_opened = 0;
enable_sleep(SLEEP_MASK_AP_RUN);
CPRINTS("power shutdown complete");
+
+ /* Call hooks after we drop power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
}
/**
diff --git a/power/sdm845.c b/power/sdm845.c
index 79dde38f9f..1556dbb111 100644
--- a/power/sdm845.c
+++ b/power/sdm845.c
@@ -479,6 +479,9 @@ static void power_off(void)
lid_opened = 0;
enable_sleep(SLEEP_MASK_AP_RUN);
CPRINTS("power shutdown complete");
+
+ /* Call hooks after we drop power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
}
/**
diff --git a/power/stoney.c b/power/stoney.c
index 9bbfc75d33..1547957d01 100644
--- a/power/stoney.c
+++ b/power/stoney.c
@@ -272,6 +272,9 @@ enum power_state power_handle_state(enum power_state state)
/* Disable wireless */
wireless_set_state(WIRELESS_OFF);
+ /* Call hooks after we remove power rails */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN_COMPLETE);
+
return POWER_S5;
case POWER_S5G3: