From 6a0ad26931135a3811eedade595a7b1a80bb1931 Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Wed, 5 Feb 2020 14:25:02 -0700 Subject: common: motion_sense: implement AP command to read dirty calibration BRANCH=None BUG=b:138303429,chromium:1023858 TEST=buildall Change-Id: I857dbc0975a239a6d8419015d8b9e34415b477cf Signed-off-by: Yuval Peress Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2044702 Reviewed-by: Gwendal Grignou Commit-Queue: Gwendal Grignou --- common/motion_sense.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'common/motion_sense.c') diff --git a/common/motion_sense.c b/common/motion_sense.c index 74537df5a1..572696ce80 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -21,6 +21,7 @@ #include "motion_sense.h" #include "motion_sense_fifo.h" #include "motion_lid.h" +#include "online_calibration.h" #include "power.h" #include "queue.h" #include "tablet_mode.h" @@ -1312,6 +1313,22 @@ static enum ec_status host_cmd_motion_sense(struct host_cmd_handler_args *args) return EC_RES_INVALID_PARAM; } break; + case MOTIONSENSE_CMD_ONLINE_CALIB_READ: + if (!IS_ENABLED(CONFIG_ONLINE_CALIB)) + return EC_RES_INVALID_PARAM; + sensor = host_sensor_id_to_real_sensor( + in->online_calib_read.sensor_num); + if (sensor == NULL) + return EC_RES_INVALID_PARAM; + + + args->response_size = + online_calibration_read( + (int)(sensor - motion_sensors), + out->online_calib_read.data) + ? sizeof(struct ec_response_online_calibration_data) + : 0; + break; #ifdef CONFIG_GESTURE_HOST_DETECTION case MOTIONSENSE_CMD_LIST_ACTIVITIES: { uint32_t enabled, disabled, mask, i; -- cgit v1.2.1