summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com>2021-01-28 10:13:14 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-29 23:05:13 +0000
commite5febf9ec926bb00d00f2e81558617604eb2b455 (patch)
tree63d5748d307ab91233a31718507d0c72d5d4696c
parenta52e1af4c96223512b8c6aff6573fbf2e9fced58 (diff)
downloadchrome-ec-e5febf9ec926bb00d00f2e81558617604eb2b455.tar.gz
Zephyr: Add LID_ANGLE_UPDATE support
Add Lig Angle Update supports which is used to manage peripheral devices based on the measured lid angle. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Change-Id: I02a467293dec459a8c8ae330059688059b2336ac Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2657436 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/CMakeLists.txt3
-rw-r--r--zephyr/Kconfig.motionsense20
-rw-r--r--zephyr/shim/include/config_chip.h5
3 files changed, 23 insertions, 5 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index a23a862f57..978009573f 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -127,9 +127,10 @@ zephyr_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042
"${PLATFORM_EC}/common/keyboard_8042.c"
"${PLATFORM_EC}/common/keyboard_8042_sharedlib.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_LID_ANGLE
- "${PLATFORM_EC}/common/lid_angle.c"
"${PLATFORM_EC}/common/motion_lid.c"
"${PLATFORM_EC}/common/math_util.c")
+zephyr_sources_ifdef(CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE
+ "${PLATFORM_EC}/common/lid_angle.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_LID_SWITCH
"${PLATFORM_EC}/common/lid_switch.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE
diff --git a/zephyr/Kconfig.motionsense b/zephyr/Kconfig.motionsense
index 04903b361b..cade198d39 100644
--- a/zephyr/Kconfig.motionsense
+++ b/zephyr/Kconfig.motionsense
@@ -97,21 +97,32 @@ config PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT
Enable this to allow changing motion sensor count dynamically.
config PLATFORM_EC_LID_ANGLE
- bool "Lid Angle Sensor"
+ bool "Lid Angle"
help
Enable this to detect lid angle with two accelerometers. The andgle
calculation requires the information about which sensor is on the lid
- and which one is on the base. The calculated lid angle is used to
- decide start/stop other peripherals like stop/start keyboard scanning.
+ and which one is on the base. The measured lid angle can be used for
+ tablet mode detection(refer "Tablet Mode below") and enabling/disabling
+ peripheral devices(refer "Lid Angle Update" below).
# TODO(b/173507858): add more detail after .dts change
if PLATFORM_EC_LID_ANGLE
+config PLATFORM_EC_LID_ANGLE_UPDATE
+ bool "Lid Angle Update"
+ help
+ Enable this to allow using the lid angle measurement to determine if
+ peripheral devices should be enabled or disabled, like key scanning,
+ trackpad interrupt.
+
config PLATFORM_EC_TABLET_MODE
bool "Tablet Mode"
help
Enable this for a device which can be a tablet as well as a clamshell.
- Tablet mode detection is done with current lid angle.
+ Tablet mode detection is done either by using the lid angle measurement
+ or by the dedicated GMR sensor.
+
+if PLATFORM_EC_TABLET_MODE
config PLATFORM_EC_GMR_TABLET_MODE
bool "Giant Magnetoresistance(GMR) Tablet Mode"
@@ -121,6 +132,7 @@ config PLATFORM_EC_GMR_TABLET_MODE
the sensor and direct its mapping to gmr_tablet_switch_isr
in common/tablet_mode.c.
+endif # PLATFORM_EC_TABLET_MODE
endif # PLATFORM_EC_LID_ANGLE
rsource "Kconfig.sensor_devices"
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 5da5f63a72..745f41a609 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -743,6 +743,11 @@ enum battery_type {
#define CONFIG_LID_ANGLE
#endif
+#undef CONFIG_LID_ANGLE_UPDATE
+#ifdef CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE
+#define CONFIG_LID_ANGLE_UPDATE
+#endif
+
#undef CONFIG_TABLET_MODE
#ifdef CONFIG_PLATFORM_EC_TABLET_MODE
#define CONFIG_TABLET_MODE