summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2017-11-13 12:33:24 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-17 20:18:30 -0800
commitf587852570770564e8a94b2c3f7ad7d97883c49a (patch)
treea7d78650875c700c3449268ed05330a11bea5eb6 /common/motion_sense.c
parentab2ce0a0ef38a701a9cc6622ccb41ba55d6b4984 (diff)
downloadchrome-ec-f587852570770564e8a94b2c3f7ad7d97883c49a.tar.gz
motion_sense: Put set_range in common code
At the end of the sensor initialization, all _init sensor routines set the range to the default value from board.c file. Put all the code in a single place, move it from sensor_common.c to motion_sense.c. BUG=none BRANCH=none TEST=compile Change-Id: If89cf27c6438e0f215c193d68a480e027110174c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/767610 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 77ddd29e3c..4e3711842b 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -442,6 +442,27 @@ static inline int motion_sense_init(struct motion_sensor_t *sensor)
}
/*
+ * sensor_init_done
+ *
+ * Called by init routine of each sensors when successful.
+ */
+int sensor_init_done(const struct motion_sensor_t *s)
+{
+ int ret;
+
+ ret = s->drv->set_range(s, s->default_range, 0);
+ if (ret == EC_RES_SUCCESS) {
+#ifdef CONFIG_CONSOLE_VERBOSE
+ CPRINTS("%s: MS Done Init type:0x%X range:%d",
+ s->name, s->type, s->drv->get_range(s));
+#else
+ CPRINTS("%c%d InitDone r:%d", s->name[0], s->type,
+ s->drv->get_range(s));
+#endif
+ }
+ return ret;
+}
+/*
* motion_sense_switch_sensor_rate
*
* Suspend all sensors that are not needed.