diff options
author | Yuval Peress <peress@chromium.org> | 2020-02-05 14:25:02 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-03-11 08:45:42 +0000 |
commit | 6a0ad26931135a3811eedade595a7b1a80bb1931 (patch) | |
tree | 14f63e4bea2e0561aaeb5699658399df64db9e6f /common/motion_sense.c | |
parent | 2e94c27c3866debba24369adc1c31908f4d7d74a (diff) | |
download | chrome-ec-6a0ad26931135a3811eedade595a7b1a80bb1931.tar.gz |
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 <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2044702
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r-- | common/motion_sense.c | 17 |
1 files changed, 17 insertions, 0 deletions
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; |