diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2019-06-20 12:58:01 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-24 22:51:28 +0000 |
commit | fa1d673cfb32a89c5a067a06226dffb37ea2ed70 (patch) | |
tree | 050262f8c8b6a953e67a2c62d870bc5bf00af737 /include | |
parent | c30486beadfa9c2e9458586c6ebd5e977b85b014 (diff) | |
download | chrome-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 'include')
-rw-r--r-- | include/accelgyro.h | 8 | ||||
-rw-r--r-- | include/ec_commands.h | 12 |
2 files changed, 16 insertions, 4 deletions
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 diff --git a/include/ec_commands.h b/include/ec_commands.h index 3c0810504f..cdf7c67c5d 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2590,14 +2590,20 @@ struct ec_params_motion_sense { /* * Used for MOTIONSENSE_CMD_INFO, MOTIONSENSE_CMD_DATA - * and MOTIONSENSE_CMD_PERFORM_CALIB. */ struct __ec_todo_unpacked { uint8_t sensor_num; - } info, info_3, data, fifo_flush, perform_calib, - list_activities; + } info, info_3, data, fifo_flush, list_activities; /* + * Used for MOTIONSENSE_CMD_PERFORM_CALIB: + * Allow entering/exiting the calibration mode. + */ + struct __ec_todo_unpacked { + uint8_t sensor_num; + uint8_t enable; + } perform_calib; + /* * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR * and MOTIONSENSE_CMD_SENSOR_RANGE. */ |