summaryrefslogtreecommitdiff
path: root/driver/mag_lis2mdl.h
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@chromium.org>2018-10-01 14:26:17 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-10-19 15:07:41 -0700
commitb1753218caff75713e8a5ddf58344bf4cec21941 (patch)
tree869d5d3d9ce1815f967db05fdb8b7c53f4b73aeb /driver/mag_lis2mdl.h
parent58f4737ae117f0bd5e2a3a7ea35ef26791bdd146 (diff)
downloadchrome-ec-b1753218caff75713e8a5ddf58344bf4cec21941.tar.gz
driver/mag_lis2mdl: Add LIS2MDL magnetometer module
Add support for LIS2MDL magnetometer module in cascade mode to LSM6DSM accelerometer module. BRANCH=none BUG=b:115587004 TEST=Collect magnetometer readings through ectool motionsense Change-Id: I06d11777543f14a557ebe6524f7ede15440f1f1e Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1257504 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/mag_lis2mdl.h')
-rw-r--r--driver/mag_lis2mdl.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/driver/mag_lis2mdl.h b/driver/mag_lis2mdl.h
new file mode 100644
index 0000000000..ae7907c225
--- /dev/null
+++ b/driver/mag_lis2mdl.h
@@ -0,0 +1,36 @@
+/* Copyright 2018 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.
+ */
+
+/* LIS2MSL magnetometer module for Chrome EC */
+
+#ifndef __CROS_EC_MAG_LIS2MDL_H
+#define __CROS_EC_MAG_LIS2MDL_H
+
+#define LIS2MDL_I2C_ADDR(__x) (__x << 1)
+
+#define LIS2MDL_ADDR0 LIS2MDL_I2C_ADDR(0x1e)
+#define LIS2MDL_ADDR1 LIS2MDL_I2C_ADDR(0x1f)
+
+#define LIS2MDL_WHO_AM_I_REG 0x4f
+#define LIS2MDL_WHO_AM_I 0x40
+
+#define LIS2MDL_CFG_REG_A_ADDR 0x60
+#define LIS2MDL_SW_RESET 0x20
+#define LIS2MDL_ODR_100HZ 0xc
+#define LIS2MDL_CONT_MODE 0x0
+
+#define LIS2MDL_STATUS_REG 0x67
+#define LIS2MDL_OUT_REG 0x68
+
+#define LIS2MDL_RANGE 4915
+#define LIS2MDL_RESOLUTION 16
+
+#define LIS2MDL_ODR_MIN_VAL 10000
+#define LIS2MDL_ODR_MAX_VAL 100000
+
+extern const struct accelgyro_drv lis2mdl_drv;
+
+#endif /* __CROS_EC_MAG_LIS2MDL_H */
+