From fa1d673cfb32a89c5a067a06226dffb37ea2ed70 Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Thu, 20 Jun 2019 12:58:01 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1702543 Reviewed-by: Nick Vaccaro --- include/accelgyro.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include/accelgyro.h') diff --git a/include/accelgyro.h b/include/accelgyro.h index 244b989de0..65a09b1965 100644 --- a/include/accelgyro.h +++ b/include/accelgyro.h @@ -106,7 +106,13 @@ struct accelgyro_drv { int (*get_scale)(const struct motion_sensor_t *s, uint16_t *scale, int16_t *temp); - int (*perform_calib)(const struct motion_sensor_t *s); + /** + * Request performing/entering calibration. + * Either a one shot mode (enable is not used), + * or enter/exit a calibration state. + */ + int (*perform_calib)(const struct motion_sensor_t *s, + int enable); #ifdef CONFIG_ACCEL_INTERRUPTS /** * handler for interrupts triggered by the sensor: it runs in task and -- cgit v1.2.1