summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com>2021-03-29 18:33:56 -0700
committerCommit Bot <commit-bot@chromium.org>2021-04-01 17:59:51 +0000
commit83da34e9475b7983c820002fb9afe042066df93e (patch)
treefbeba3a065e9d224842b478088f0c1fbeccfdba7
parentabd9439d63e2a9e172b343d3990e9bb419d5eb66 (diff)
downloadchrome-ec-83da34e9475b7983c820002fb9afe042066df93e.tar.gz
Create a public header for bmi160
Create a separate public header for bmi160 so we can include it from Zephyr. BUG=b:173507858 BRANCH=none TEST=make BOARD=lazor -j4 Change-Id: Ib35d473b3f4e1a566ef35cd5e203b6acbf93319b Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2793047 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799919 Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--driver/accelgyro_bmi160.h22
-rw-r--r--include/driver/accelgyro_bmi160_public.h32
2 files changed, 33 insertions, 21 deletions
diff --git a/driver/accelgyro_bmi160.h b/driver/accelgyro_bmi160.h
index 9f8558e8b7..ee9e821022 100644
--- a/driver/accelgyro_bmi160.h
+++ b/driver/accelgyro_bmi160.h
@@ -9,20 +9,9 @@
#define __CROS_EC_ACCELGYRO_BMI160_H
#include "accelgyro.h"
+#include "driver/accelgyro_bmi160_public.h"
#include "mag_bmm150.h"
-/*
- * The addr field of motion_sensor support both SPI and I2C:
- * This is defined in include/i2c.h and is no longer an 8bit
- * address. The 7/10 bit address starts at bit 0 and leaves
- * room for a 10 bit address, although we don't currently
- * have any 10 bit slaves. I2C or SPI is indicated by a
- * more significant bit
- */
-
-/* I2C addresses */
-#define BMI160_ADDR0_FLAGS 0x68
-
#define BMI160_CHIP_ID 0x00
#define BMI160_CHIP_ID_MAJOR 0xd1
#define BMI168_CHIP_ID_MAJOR 0xd2
@@ -382,10 +371,6 @@
/* Root mean square noise of 100 Hz accelerometer, units: ug */
#define BMI160_ACCEL_RMS_NOISE_100HZ 1300
-extern const struct accelgyro_drv bmi160_drv;
-
-void bmi160_interrupt(enum gpio_signal signal);
-
#ifdef CONFIG_BMI_SEC_I2C
/* Functions to access the secondary device through the accel/gyro. */
int bmi160_sec_raw_read8(const int port, const uint16_t addr_flags,
@@ -394,9 +379,4 @@ int bmi160_sec_raw_write8(const int port, const uint16_t addr_flags,
const uint8_t reg, int data);
#endif
-#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
-extern struct i2c_stress_test_dev bmi160_i2c_stress_test_dev;
-#endif
-
-int bmi160_get_sensor_temp(int idx, int *temp_ptr);
#endif /* __CROS_EC_ACCELGYRO_BMI160_H */
diff --git a/include/driver/accelgyro_bmi160_public.h b/include/driver/accelgyro_bmi160_public.h
new file mode 100644
index 0000000000..fa5b030cbd
--- /dev/null
+++ b/include/driver/accelgyro_bmi160_public.h
@@ -0,0 +1,32 @@
+/* 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.
+ */
+
+/* BMI160 accelerometer and gyro for Chrome EC */
+
+#ifndef __CROS_EC_DRIVER_ACCELGYRO_BMI160_PUBLIC_H
+#define __CROS_EC_DRIVER_ACCELGYRO_BMI160_PUBLIC_H
+
+/*
+ * The addr field of motion_sensor support both SPI and I2C:
+ * This is defined in include/i2c.h and is no longer an 8bit
+ * address. The 7/10 bit address starts at bit 0 and leaves
+ * room for a 10 bit address, although we don't currently
+ * have any 10 bit slaves. I2C or SPI is indicated by a
+ * more significant bit
+ */
+
+/* I2C addresses */
+#define BMI160_ADDR0_FLAGS 0x68
+
+extern const struct accelgyro_drv bmi160_drv;
+
+void bmi160_interrupt(enum gpio_signal signal);
+int bmi160_get_sensor_temp(int idx, int *temp_ptr);
+
+#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL
+extern struct i2c_stress_test_dev bmi160_i2c_stress_test_dev;
+#endif
+
+#endif /* __CROS_EC_DRIVER_ACCELGYRO_BMI260_PUBLIC_H */