From 86be30f5c4220112c6303c176f12096151285515 Mon Sep 17 00:00:00 2001 From: Ching-Kang Yen Date: Tue, 31 Mar 2020 19:10:36 +0800 Subject: driver: Add BMI common code Add accelgyro_bmi_common.(c/h) for the code shared among the BMI. BRANCH=None BUG=b:146144827 TEST=make -j4 BOARD=ampton Then, flash the ec.bin into DUT, check sensor data is available on DUT by "ectool motionsense". TEST=make buildall -j Change-Id: Ia56ffb0896943b08640b3d6ca96324ac5e7d93a0 Signed-off-by: Ching-Kang Yen Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130146 Reviewed-by: Gwendal Grignou --- driver/mag_bmm150.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'driver/mag_bmm150.h') diff --git a/driver/mag_bmm150.h b/driver/mag_bmm150.h index 79c77e66d7..f97d2a8882 100644 --- a/driver/mag_bmm150.h +++ b/driver/mag_bmm150.h @@ -112,20 +112,21 @@ struct bmm150_private_data { struct mag_cal_t cal; struct bmm150_comp_registers comp; }; + +#ifdef CONFIG_MAG_BMI_BMM150 +#include "accelgyro_bmi_common.h" + #define BMM150_COMP_REG(_s) \ - (&BMI160_GET_DATA(_s)->compass.comp) + (&BMI_GET_DATA(_s)->compass.comp) #define BMM150_CAL(_s) \ - (&BMI160_GET_DATA(_s)->compass.cal) - -#ifdef CONFIG_MAG_BMI160_BMM150 -#include "accelgyro_bmi160.h" + (&BMI_GET_DATA(_s)->compass.cal) /* - * Behind a BMI160, the BMM150 is in forced mode. Be sure to choose a frequency - * comptible with BMI160. + * Behind a BMI, the BMM150 is in forced mode. Be sure to choose a frequency + * compatible with BMI. */ #define BMM150_MAG_MAX_FREQ(_preset) \ - BMI160_REG_TO_ODR(BMI160_ODR_TO_REG(__BMM150_MAG_MAX_FREQ(_preset))) + BMI_REG_TO_ODR(BMI_ODR_TO_REG(__BMM150_MAG_MAX_FREQ(_preset))) #else #define BMM150_MAG_MAX_FREQ(_preset) __BMM150_MAG_MAX_FREQ(_preset) #endif -- cgit v1.2.1