From f587852570770564e8a94b2c3f7ad7d97883c49a Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Mon, 13 Nov 2017 12:33:24 -0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/767610 Reviewed-by: Shawn N --- common/motion_sense.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'common/motion_sense.c') 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 @@ -441,6 +441,27 @@ static inline int motion_sense_init(struct motion_sensor_t *sensor) return ret; } +/* + * 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 * -- cgit v1.2.1