diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/build.mk | 3 | ||||
-rw-r--r-- | common/motion_sense.c | 21 | ||||
-rw-r--r-- | common/sensor_common.c | 25 |
3 files changed, 22 insertions, 27 deletions
diff --git a/common/build.mk b/common/build.mk index a792bca3ad..57eb0c9d82 100644 --- a/common/build.mk +++ b/common/build.mk @@ -124,7 +124,7 @@ common-$(HAS_TASK_HOSTCMD)+=host_command.o ec_features.o common-$(HAS_TASK_PDCMD)+=host_command_pd.o common-$(HAS_TASK_KEYSCAN)+=keyboard_scan.o common-$(HAS_TASK_LIGHTBAR)+=lb_common.o lightbar.o -common-$(HAS_TASK_MOTIONSENSE)+=motion_sense.o sensor_common.o +common-$(HAS_TASK_MOTIONSENSE)+=motion_sense.o common-$(HAS_TASK_TPM)+=tpm_registers.o ifeq ($(CONFIG_MALLOC),y) @@ -138,7 +138,6 @@ common-$(TEST_BUILD)+=test_util.o else common-y+=test_util.o endif -common-$(TEST_BUILD)+=sensor_common.o ifneq ($(CONFIG_RSA_OPTIMIZED),) $(out)/RW/common/rsa.o: CFLAGS+=-O3 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. diff --git a/common/sensor_common.c b/common/sensor_common.c deleted file mode 100644 index b80fd69366..0000000000 --- a/common/sensor_common.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright 2017 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. - */ - -/* Sensor common routines. */ - -#include "common.h" -#include "console.h" -#include "motion_sense.h" - -/* Console output macros */ -#define CPUTS(outstr) cputs(CC_MOTION_SENSE, outstr) -#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ## args) -#define CPRINTF(format, args...) cprintf(CC_MOTION_SENSE, format, ## args) - -void sensor_init_done(const struct motion_sensor_t *s, int range) -{ -#ifdef CONFIG_CONSOLE_VERBOSE - CPRINTS("%s: MS Done Init type:0x%X range:%d", - s->name, s->type, range); -#else - CPRINTS("%c%d InitDone r:%d", s->name[0], s->type, range); -#endif -} |