From 2eb53a39662b905c65015bafb5f73ab2324d369c Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Tue, 3 Aug 2021 17:17:56 -0700 Subject: lid_angle: Create a common callback for lid angle changes Each board defines its own callback lid_angle_peripheral_enable(). The implementation is very similar. Create a common implementation and reduce the duplicated code. This CL removes the board callbacks which are identifical to the common callback. If it is slightly different, keep it and add the __override tag. The check of TEST_BUILD is unnecessary as the board callback is not linked in the test build. BRANCH=None BUG=b:194922043 TEST=Build all the images. Change-Id: I73d381730f35b80eff69399cdfc5fb54f839aee0 Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3069175 Reviewed-by: Aseda Aboagye --- board/cret/board.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'board/cret') diff --git a/board/cret/board.c b/board/cret/board.c index 91870d65ec..55c79f8778 100644 --- a/board/cret/board.c +++ b/board/cret/board.c @@ -526,9 +526,8 @@ uint16_t tcpc_get_alert_status(void) return status; } -#ifndef TEST_BUILD /* This callback disables keyboard when convertibles are fully open */ -void lid_angle_peripheral_enable(int enable) +__override void lid_angle_peripheral_enable(int enable) { int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); @@ -552,7 +551,6 @@ void lid_angle_peripheral_enable(int enable) keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); } } -#endif /* Keyboard scan setting */ static const struct ec_response_keybd_config cret_keybd = { @@ -601,4 +599,4 @@ static void board_extpower(void) gpio_set_level(GPIO_EC_ACOK_OTG, extpower_present); } -DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT); \ No newline at end of file +DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT); -- cgit v1.2.1