diff options
author | Wai-Hong Tam <waihong@google.com> | 2021-08-03 17:17:56 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-05 00:13:33 +0000 |
commit | 2eb53a39662b905c65015bafb5f73ab2324d369c (patch) | |
tree | 6352433557cdb05c75b1eef449c9ecf844bfc3d0 /zephyr | |
parent | fc016f2dce16d0555deee69e00ea5a626eb27f21 (diff) | |
download | chrome-ec-2eb53a39662b905c65015bafb5f73ab2324d369c.tar.gz |
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 <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3069175
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/projects/asurada/hayato/CMakeLists.txt | 4 | ||||
-rw-r--r-- | zephyr/projects/asurada/hayato/src/sensors.c | 29 | ||||
-rw-r--r-- | zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt | 2 | ||||
-rw-r--r-- | zephyr/projects/herobrine/herobrine_npcx9/src/sensors.c | 29 | ||||
-rw-r--r-- | zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt | 2 | ||||
-rw-r--r-- | zephyr/projects/trogdor/herobrine_npcx7/src/sensors.c | 29 | ||||
-rw-r--r-- | zephyr/projects/trogdor/lazor/CMakeLists.txt | 2 | ||||
-rw-r--r-- | zephyr/projects/trogdor/lazor/src/sensors.c | 29 | ||||
-rw-r--r-- | zephyr/projects/trogdor/trogdor/CMakeLists.txt | 2 | ||||
-rw-r--r-- | zephyr/projects/trogdor/trogdor/src/sensors.c | 29 | ||||
-rw-r--r-- | zephyr/projects/volteer/delbin/CMakeLists.txt | 4 | ||||
-rw-r--r-- | zephyr/projects/volteer/delbin/src/sensors.c | 28 | ||||
-rw-r--r-- | zephyr/projects/volteer/volteer/CMakeLists.txt | 4 | ||||
-rw-r--r-- | zephyr/projects/volteer/volteer/src/sensors.c | 29 |
14 files changed, 0 insertions, 222 deletions
diff --git a/zephyr/projects/asurada/hayato/CMakeLists.txt b/zephyr/projects/asurada/hayato/CMakeLists.txt index c4703e4024..f6d4eba58f 100644 --- a/zephyr/projects/asurada/hayato/CMakeLists.txt +++ b/zephyr/projects/asurada/hayato/CMakeLists.txt @@ -27,7 +27,3 @@ zephyr_library_sources( zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/i2c.c") - -# Board specific sensor implementation -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE - "src/sensors.c") diff --git a/zephyr/projects/asurada/hayato/src/sensors.c b/zephyr/projects/asurada/hayato/src/sensors.c deleted file mode 100644 index 6207461976..0000000000 --- a/zephyr/projects/asurada/hayato/src/sensors.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "chipset.h" -#include "common.h" -#include "keyboard_scan.h" - -/* Hayato board specific sensor implementation */ - -#ifdef CONFIG_LID_ANGLE_UPDATE -void lid_angle_peripheral_enable(int enable) -{ - int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - } else { - /* - * Ensure that the chipset is off before disabling the keyboard. - * When the chipset is on, the EC keeps the keyboard enabled and - * the AP decides whether to ignore input devices or not. - */ - if (!chipset_in_s0) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - } -} -#endif diff --git a/zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt b/zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt index 9dcd46db31..23b3a2c245 100644 --- a/zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt +++ b/zephyr/projects/herobrine/herobrine_npcx9/CMakeLists.txt @@ -15,8 +15,6 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "src/usb_pd_policy.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON "src/led.c") -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE - "src/sensors.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/i2c.c") diff --git a/zephyr/projects/herobrine/herobrine_npcx9/src/sensors.c b/zephyr/projects/herobrine/herobrine_npcx9/src/sensors.c deleted file mode 100644 index dd9ce10a16..0000000000 --- a/zephyr/projects/herobrine/herobrine_npcx9/src/sensors.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "chipset.h" -#include "common.h" -#include "keyboard_scan.h" - -/* Herobrine-NPCX9 board specific sensor implementation */ - -#ifdef CONFIG_LID_ANGLE_UPDATE -void lid_angle_peripheral_enable(int enable) -{ - int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - } else { - /* - * Ensure that the chipset is off before disabling the keyboard. - * When the chipset is on, the EC keeps the keyboard enabled and - * the AP decides whether to ignore input devices or not. - */ - if (!chipset_in_s0) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - } -} -#endif diff --git a/zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt b/zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt index 61f8c8ef7b..245e2b6689 100644 --- a/zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt +++ b/zephyr/projects/trogdor/herobrine_npcx7/CMakeLists.txt @@ -29,7 +29,5 @@ zephyr_library_sources( "${PLATFORM_EC_BOARD}/usbc_config.c") # Board specific implementation -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE - "src/sensors.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/i2c.c") diff --git a/zephyr/projects/trogdor/herobrine_npcx7/src/sensors.c b/zephyr/projects/trogdor/herobrine_npcx7/src/sensors.c deleted file mode 100644 index 87eb6757d6..0000000000 --- a/zephyr/projects/trogdor/herobrine_npcx7/src/sensors.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "chipset.h" -#include "common.h" -#include "keyboard_scan.h" - -/* Herobrine-NPCX7 board specific sensor implementation */ - -#ifdef CONFIG_LID_ANGLE_UPDATE -void lid_angle_peripheral_enable(int enable) -{ - int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - } else { - /* - * Ensure that the chipset is off before disabling the keyboard. - * When the chipset is on, the EC keeps the keyboard enabled and - * the AP decides whether to ignore input devices or not. - */ - if (!chipset_in_s0) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - } -} -#endif diff --git a/zephyr/projects/trogdor/lazor/CMakeLists.txt b/zephyr/projects/trogdor/lazor/CMakeLists.txt index 40a6b47d67..3c8372cebf 100644 --- a/zephyr/projects/trogdor/lazor/CMakeLists.txt +++ b/zephyr/projects/trogdor/lazor/CMakeLists.txt @@ -31,7 +31,5 @@ zephyr_library_sources( "${PLATFORM_EC_BOARD}/usbc_config.c") # Board specific implementation -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE - "src/sensors.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/i2c.c") diff --git a/zephyr/projects/trogdor/lazor/src/sensors.c b/zephyr/projects/trogdor/lazor/src/sensors.c deleted file mode 100644 index becf1f8829..0000000000 --- a/zephyr/projects/trogdor/lazor/src/sensors.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "chipset.h" -#include "common.h" -#include "keyboard_scan.h" - -/* Lazor board specific sensor implementation */ - -#ifdef CONFIG_LID_ANGLE_UPDATE -void lid_angle_peripheral_enable(int enable) -{ - int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - } else { - /* - * Ensure that the chipset is off before disabling the keyboard. - * When the chipset is on, the EC keeps the keyboard enabled and - * the AP decides whether to ignore input devices or not. - */ - if (!chipset_in_s0) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - } -} -#endif diff --git a/zephyr/projects/trogdor/trogdor/CMakeLists.txt b/zephyr/projects/trogdor/trogdor/CMakeLists.txt index 3edae376a2..d470dd8409 100644 --- a/zephyr/projects/trogdor/trogdor/CMakeLists.txt +++ b/zephyr/projects/trogdor/trogdor/CMakeLists.txt @@ -29,7 +29,5 @@ zephyr_library_sources( "${PLATFORM_EC_BOARD}/usbc_config.c") # Board specific implementation -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE - "src/sensors.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/i2c.c") diff --git a/zephyr/projects/trogdor/trogdor/src/sensors.c b/zephyr/projects/trogdor/trogdor/src/sensors.c deleted file mode 100644 index 6d32e250cd..0000000000 --- a/zephyr/projects/trogdor/trogdor/src/sensors.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "chipset.h" -#include "common.h" -#include "keyboard_scan.h" - -/* Trogdor board specific sensor implementation */ - -#ifdef CONFIG_LID_ANGLE_UPDATE -void lid_angle_peripheral_enable(int enable) -{ - int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - } else { - /* - * Ensure that the chipset is off before disabling the keyboard. - * When the chipset is on, the EC keeps the keyboard enabled and - * the AP decides whether to ignore input devices or not. - */ - if (!chipset_in_s0) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - } -} -#endif diff --git a/zephyr/projects/volteer/delbin/CMakeLists.txt b/zephyr/projects/volteer/delbin/CMakeLists.txt index 441c730634..0303ee7c62 100644 --- a/zephyr/projects/volteer/delbin/CMakeLists.txt +++ b/zephyr/projects/volteer/delbin/CMakeLists.txt @@ -21,7 +21,3 @@ zephyr_library_include_directories( # Include selected EC source for the baseboard zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ "${PLATFORM_EC_BASEBOARD}/power.c") - -# Board specific sensor implementation -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE - "src/sensors.c") diff --git a/zephyr/projects/volteer/delbin/src/sensors.c b/zephyr/projects/volteer/delbin/src/sensors.c deleted file mode 100644 index 8a052837f8..0000000000 --- a/zephyr/projects/volteer/delbin/src/sensors.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "chipset.h" -#include "common.h" -#include "keyboard_scan.h" -#include "lid_angle.h" - -/* Delbin board specific sensor implementation */ - -void lid_angle_peripheral_enable(int enable) -{ - int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - } else { - /* - * Ensure that the chipset is off before disabling the keyboard. - * When the chipset is on, the EC keeps the keyboard enabled and - * the AP decides whether to ignore input devices or not. - */ - if (!chipset_in_s0) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - } -} diff --git a/zephyr/projects/volteer/volteer/CMakeLists.txt b/zephyr/projects/volteer/volteer/CMakeLists.txt index c749cfc340..8c01874b1b 100644 --- a/zephyr/projects/volteer/volteer/CMakeLists.txt +++ b/zephyr/projects/volteer/volteer/CMakeLists.txt @@ -43,7 +43,3 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON "${PLATFORM_EC_BOARD}/led.c") zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "${PLATFORM_EC_BOARD}/usbc_config.c") - -# Board specific sensor implementation -zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE - "src/sensors.c") diff --git a/zephyr/projects/volteer/volteer/src/sensors.c b/zephyr/projects/volteer/volteer/src/sensors.c deleted file mode 100644 index eb4e547c54..0000000000 --- a/zephyr/projects/volteer/volteer/src/sensors.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2021 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "chipset.h" -#include "common.h" -#include "keyboard_scan.h" - -/* Volteer board specific sensor implementation */ - -#ifdef CONFIG_LID_ANGLE_UPDATE -void lid_angle_peripheral_enable(int enable) -{ - int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON); - - if (enable) { - keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); - } else { - /* - * Ensure that the chipset is off before disabling the keyboard. - * When the chipset is on, the EC keeps the keyboard enabled and - * the AP decides whether to ignore input devices or not. - */ - if (!chipset_in_s0) - keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); - } -} -#endif |