host_event: Perform lpc_init_mask before keyboard/button init

keyboard/button init are responsible for checking if user requested
manual recovery. However, by this time, hook init is not run and hence
host event set operation for manual recovery is dropped. This change
adds a call to lpc_init_mask before keyboard/button init operations
are performed.

BUG=b:68189465
BRANCH=None
TEST=Verified that manual recovery works fine. Recovery using software
command works too:
reboot ap-off
hostevent set 0x4000
powerb

Change-Id: I15cb648d4b253a523293c7ab2cd3e8e08e31a763
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/735799
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Furquan Shaikh
2017-10-24 06:49:47 -07:00
committed by chrome-bot
parent 97a3729755
commit 708f6f1f21
3 changed files with 15 additions and 7 deletions

View File

@@ -144,7 +144,7 @@ uint32_t __attribute__((weak)) lpc_override_always_report_mask(void)
return LPC_HOST_EVENT_ALWAYS_REPORT_DEFAULT_MASK;
}
static void lpc_init_mask(void)
void lpc_init_mask(void)
{
/*
* First check if masks were stashed before sysjump. If no masks were
@@ -156,12 +156,6 @@ static void lpc_init_mask(void)
lpc_override_always_report_mask();
}
/*
* This hook is required to run before chip gets to initialize LPC because
* update host events will need the masks to be correctly restored.
*/
DECLARE_HOOK(HOOK_INIT, lpc_init_mask, HOOK_PRIO_INIT_LPC - 1);
#endif
/*

View File

@@ -16,6 +16,7 @@
#include "flash.h"
#include "gpio.h"
#include "hooks.h"
#include "lpc.h"
#include "keyboard_scan.h"
#ifdef CONFIG_MPU
#include "mpu.h"
@@ -150,6 +151,16 @@ test_mockable __keep int main(void)
#ifdef CONFIG_EEPROM
eeprom_init();
#endif
/*
* Keyboard scan init/Button init can set recovery events to
* indicate to host entry into recovery mode. Before this is
* done, lpc always report mask needs to be initialized
* correctly.
*/
#ifdef CONFIG_LPC
lpc_init_mask();
#endif
#ifdef HAS_TASK_KEYSCAN
keyboard_scan_init();
#endif

View File

@@ -149,4 +149,7 @@ void lpc_update_host_event_status(void);
*/
uint32_t lpc_override_always_report_mask(void);
/* Initialize LPC masks. */
void lpc_init_mask(void);
#endif /* __CROS_EC_LPC_H */