summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/config_allowed.txt1
-rw-r--r--zephyr/CMakeLists.txt11
-rw-r--r--zephyr/Kconfig6
-rw-r--r--zephyr/Kconfig.motionsense1
-rw-r--r--zephyr/Kconfig.sensor_devices2
-rw-r--r--zephyr/shim/include/config_chip.h5
6 files changed, 19 insertions, 7 deletions
diff --git a/util/config_allowed.txt b/util/config_allowed.txt
index e2aabe243a..87173c7477 100644
--- a/util/config_allowed.txt
+++ b/util/config_allowed.txt
@@ -655,7 +655,6 @@ CONFIG_MAG_LSM6DSM_BMM150
CONFIG_MAG_LSM6DSM_LIS2MDL
CONFIG_MALLOC
CONFIG_MAPPED_STORAGE_BASE
-CONFIG_MATH_UTIL
CONFIG_MAX695X_SEVEN_SEGMENT_DISPLAY
CONFIG_MCDP28X0
CONFIG_MCHP_48MHZ_OUT
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index 1a7c84fd09..b8d1744c23 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -121,15 +121,13 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC "${PLATFORM_EC}/common/base32.c"
zephyr_library_sources_ifdef(CONFIG_HAS_TASK_POWERBTN
"${PLATFORM_EC}/common/power_button_x86.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCEL_BMA255
- "${PLATFORM_EC}/driver/accel_bma2x2.c"
- "${PLATFORM_EC}/common/math_util.c")
+ "${PLATFORM_EC}/driver/accel_bma2x2.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCEL_KX022
"${PLATFORM_EC}/driver/accel_kionix.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCEL_LIS2DW12
"${PLATFORM_EC}/driver/accel_lis2dw12.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_BMI
- "${PLATFORM_EC}/driver/accelgyro_bmi_common.c"
- "${PLATFORM_EC}/common/math_util.c")
+ "${PLATFORM_EC}/driver/accelgyro_bmi_common.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_BMI160
"${PLATFORM_EC}/driver/accelgyro_bmi160.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_BMI260
@@ -260,8 +258,7 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_PWM
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_ONOFF_STATES
"${PLATFORM_EC}/common/led_onoff_states.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LID_ANGLE
- "${PLATFORM_EC}/common/motion_lid.c"
- "${PLATFORM_EC}/common/math_util.c")
+ "${PLATFORM_EC}/common/motion_lid.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE
"${PLATFORM_EC}/common/lid_angle.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LID_SWITCH
@@ -445,3 +442,5 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_VSTORE
"${PLATFORM_EC}/common/vstore.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_RTC
"${PLATFORM_EC}/common/rtc.c")
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MATH_UTIL
+ "${PLATFORM_EC}/common/math_util.c")
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index d0ef3fc711..53e14a35e8 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -894,4 +894,10 @@ config PLATFORM_EC_AMD_STT
to temporarily boost above the sustainable power limit, while the
chassis skin temperatures are below limits.
+config PLATFORM_EC_MATH_UTIL
+ bool "Math utility"
+ help
+ Math utilities including bitmask manipulation, division rounding,
+ trigonometric function, etc.
+
endif # PLATFORM_EC
diff --git a/zephyr/Kconfig.motionsense b/zephyr/Kconfig.motionsense
index daf2bbcdf8..01a7eb1698 100644
--- a/zephyr/Kconfig.motionsense
+++ b/zephyr/Kconfig.motionsense
@@ -98,6 +98,7 @@ config PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT
config PLATFORM_EC_LID_ANGLE
bool "Lid Angle"
+ select PLATFORM_EC_MATH_UTIL
help
Enable this to detect lid angle with two accelerometers. The andgle
calculation requires the information about which sensor is on the lid
diff --git a/zephyr/Kconfig.sensor_devices b/zephyr/Kconfig.sensor_devices
index 94204b7b35..3ddf65148c 100644
--- a/zephyr/Kconfig.sensor_devices
+++ b/zephyr/Kconfig.sensor_devices
@@ -6,6 +6,7 @@ menu "Sensor Devices"
config PLATFORM_EC_ACCELGYRO_BMI
bool "Config used to include common accelgyro BMI features"
+ select PLATFORM_EC_MATH_UTIL
help
Do not set this directly in a .conf file. This value should be set
using an `select` statement in other BMI family of drivers such as
@@ -20,6 +21,7 @@ config PLATFORM_EC_ACCELGYRO_ICM
config PLATFORM_EC_ACCEL_BMA255
bool "BMA2X2 Accelerometer Family Driver"
+ select PLATFORM_EC_MATH_UTIL
help
The driver supports Bosch's a triaxial, low-g acceleration sensor.
It allows measurements of acceleration in three perpendicular axes.
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 5d3d53db4c..2d5b2b43f2 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -1485,6 +1485,11 @@
#endif /* CONFIG_PLATFORM_EC_MOTIONSENSE */
+#undef CONFIG_MATH_UTIL
+#ifdef CONFIG_PLATFORM_EC_MATH_UTIL
+#define CONFIG_MATH_UTIL
+#endif
+
#undef CONFIG_HOSTCMD_GET_UPTIME_INFO
#ifdef CONFIG_PLATFORM_EC_HOSTCMD_GET_UPTIME_INFO
#define CONFIG_HOSTCMD_GET_UPTIME_INFO