From 8d3c321c27cc06eef438190651eac83be08012e9 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Thu, 24 Jun 2021 15:34:10 -0700 Subject: power: Reorder the power_chipset_init and the interrupt enable The previous order is: * power_chipset_init() * enabling/disabling the power signal interrupts There is a need that power_chipset_init() modifies the power signal interrupt enabling/disabling, like crrev.com/c/2977573. The power_chipset_init() checks if AP is ON or OFF; when AP is OFF, a power signal interrupt is disabled (default) to avoid the floating interrupt storm; but when AP is ON, the power signal interrupt is enabled. But the next action resets the interrupt to default. This CL reorders it to: * enabling/disabling the power signal interrupts * power_chipset_init() So the interrupt enable/disable status won't be overridden. BRANCH=None BUG=b:185551931 TEST=Tested on Coachz, reboot EC, sysjump to RW, perform `apreset` which executes a warm AP reboot. Change-Id: I1740fed1d37a312ac822b2a91e9ebd5502756a1f Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2986224 Reviewed-by: Denis Brockus --- power/common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'power') diff --git a/power/common.c b/power/common.c index 7fc6a8cfb3..6ecfff543d 100644 --- a/power/common.c +++ b/power/common.c @@ -722,9 +722,6 @@ static void power_common_init(void) /* Update input state */ power_update_signals(); - /* Call chipset-specific init to set initial state */ - power_set_state(power_chipset_init()); - /* Enable interrupts for input signals */ for (i = 0; i < POWER_SIGNAL_COUNT; i++, s++) if (s->flags & POWER_SIGNAL_DISABLE_AT_BOOT) @@ -732,6 +729,9 @@ static void power_common_init(void) else power_signal_enable_interrupt(s->gpio); + /* Call chipset-specific init to set initial state */ + power_set_state(power_chipset_init()); + /* * Update input state again since there is a small window * before GPIO is enabled. -- cgit v1.2.1