summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-06-20 12:58:01 -0700
committerCommit Bot <commit-bot@chromium.org>2019-07-24 22:51:28 +0000
commitfa1d673cfb32a89c5a067a06226dffb37ea2ed70 (patch)
tree050262f8c8b6a953e67a2c62d870bc5bf00af737 /driver
parentc30486beadfa9c2e9458586c6ebd5e977b85b014 (diff)
downloadchrome-ec-fa1d673cfb32a89c5a067a06226dffb37ea2ed70.tar.gz
driver: Add support for calibration mode
For TCS3400, performing calibration is not just a one-shot event: The RBG sensor stays in calibration mode: returns raw value in R, G, B space. When out of calibration, it returns light information in X, Y and Z space. BUG=b:124512628 BRANCH=hatch,flapjack TEST=unit test Change-Id: I6766907054c8e79a3cbcb629ef91a0967ea0780a Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1702543 Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Diffstat (limited to 'driver')
-rw-r--r--driver/accel_bma2x2.c5
-rw-r--r--driver/accelgyro_bmi160.c5
-rw-r--r--driver/als_si114x.c1
3 files changed, 8 insertions, 3 deletions
diff --git a/driver/accel_bma2x2.c b/driver/accel_bma2x2.c
index d828912232..9a63bdc1ba 100644
--- a/driver/accel_bma2x2.c
+++ b/driver/accel_bma2x2.c
@@ -188,11 +188,14 @@ static int read(const struct motion_sensor_t *s, intv3_t v)
return EC_SUCCESS;
}
-static int perform_calib(const struct motion_sensor_t *s)
+static int perform_calib(const struct motion_sensor_t *s, int enable)
{
int ret, val, status, rate, range, i;
timestamp_t deadline;
+ if (!enable)
+ return EC_SUCCESS;
+
ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMA2x2_OFFSET_CTRL_ADDR, &val);
if (ret)
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index 3be5f58a83..5fb79194d1 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -637,11 +637,14 @@ int get_scale(const struct motion_sensor_t *s,
return EC_SUCCESS;
}
-static int perform_calib(const struct motion_sensor_t *s)
+static int perform_calib(const struct motion_sensor_t *s, int enable)
{
int ret, val, en_flag, status, rate;
timestamp_t deadline;
+ if (!enable)
+ return EC_SUCCESS;
+
rate = get_data_rate(s);
/*
* Temporary set frequency to 100Hz to get enough data in a short
diff --git a/driver/als_si114x.c b/driver/als_si114x.c
index 5cfc19c6a8..2ac8f1ccbd 100644
--- a/driver/als_si114x.c
+++ b/driver/als_si114x.c
@@ -598,7 +598,6 @@ const struct accelgyro_drv si114x_drv = {
.get_data_rate = get_data_rate,
.set_offset = set_offset,
.get_offset = get_offset,
- .perform_calib = NULL,
#ifdef CONFIG_ACCEL_INTERRUPTS
.irq_handler = irq_handler,
#endif