summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-01-31 10:04:20 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-02-14 05:27:21 -0800
commitf1fcc752c69ac041ec8dfd4d77f8d415f0112e4d (patch)
treea9bd1f25971ed0b113443aa236e23b10f3cf68bf
parent573b4bd9b49af15a57ca05f6bd515807a1d58424 (diff)
downloadchrome-ec-f1fcc752c69ac041ec8dfd4d77f8d415f0112e4d.tar.gz
driver: lis2dh: fix comments and include
Minor cleanup to lis2dh. BUG=none BRANCH=none TEST=Compile Change-Id: Ic34eaa1cb5807bc8df8694e2d06546d60d109a7a Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1449111 Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--driver/accel_lis2dh.c14
-rw-r--r--driver/accel_lis2dh.h8
2 files changed, 14 insertions, 8 deletions
diff --git a/driver/accel_lis2dh.c b/driver/accel_lis2dh.c
index 5f9b1b86b5..26a2bca8d4 100644
--- a/driver/accel_lis2dh.c
+++ b/driver/accel_lis2dh.c
@@ -51,8 +51,10 @@ static int set_range(const struct motion_sensor_t *s, int range, int rnd)
normalized_range = 2;
}
- /* Lock accel resource to prevent another task from attempting
- * to write accel parameters until we are done */
+ /*
+ * Lock accel resource to prevent another task from attempting
+ * to write accel parameters until we are done.
+ */
mutex_lock(s->mutex);
err = st_write_data_with_mask(s, LIS2DH_CTRL4_ADDR, LIS2DH_FS_MASK,
val);
@@ -194,8 +196,9 @@ static int init(const struct motion_sensor_t *s)
return EC_ERROR_ACCESS_DENIED;
mutex_lock(s->mutex);
- /* Device can be re-initialized after a reboot so any control
- * register must be restored to it's default
+ /*
+ * Device can be re-initialized after a reboot so any control
+ * register must be restored to it's default.
*/
/* Enable all accel axes data and clear old settings */
ret = st_raw_write8(s->port, s->addr, LIS2DH_CTRL1_ADDR,
@@ -237,8 +240,8 @@ static int init(const struct motion_sensor_t *s)
return sensor_init_done(s);
err_unlock:
- CPRINTF("[%T %s: MS Init type:0x%X Error]\n", s->name, s->type);
mutex_unlock(s->mutex);
+ CPRINTF("[%T %s: MS Init type:0x%X Error]\n", s->name, s->type);
return ret;
}
@@ -253,5 +256,4 @@ const struct accelgyro_drv lis2dh_drv = {
.get_data_rate = st_get_data_rate,
.set_offset = st_set_offset,
.get_offset = st_get_offset,
- .perform_calib = NULL,
};
diff --git a/driver/accel_lis2dh.h b/driver/accel_lis2dh.h
index 7523404986..824127b90c 100644
--- a/driver/accel_lis2dh.h
+++ b/driver/accel_lis2dh.h
@@ -8,9 +8,12 @@
#ifndef __CROS_EC_ACCEL_LIS2DH_H
#define __CROS_EC_ACCEL_LIS2DH_H
+#include "driver/stm_mems_common.h"
+
#define LIS2DH_I2C_ADDR(__x) (__x << 1)
-/* 7-bit address is 000110Xb. Where 'X' is determined
+/*
+ * 7-bit address is 000110Xb. Where 'X' is determined
* by the voltage on the ADDR pin
*/
#define LIS2DH_ADDR0 LIS2DH_I2C_ADDR(0x18)
@@ -102,7 +105,8 @@ enum lis2dh_odr {
/* FS reg value from Full Scale */
#define LIS2DH_FS_TO_REG(_fs) (__fls(_fs) - 1)
-/* Sensor resolution in number of bits
+/*
+ * Sensor resolution in number of bits
* lis2dh has variable precision (8/10/12 bits) depending Power Mode
* selected, here Only Normal Power mode supported (10 bits).
* But for lis2de, it has only one 8bit resolution.