summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2019-10-01 10:42:28 -0600
committerCommit Bot <commit-bot@chromium.org>2019-12-19 02:35:16 +0000
commit267da3cfcd4afc309a99f292f8670eed2f141862 (patch)
treef790282d67dba522889e3e7e310484986ab62c07 /common/motion_sense.c
parent78c2dcc67c38f7a1b6c649088c3cfa5a7bbfc250 (diff)
downloadchrome-ec-267da3cfcd4afc309a99f292f8670eed2f141862.tar.gz
common: Add feature flag for online calibration
This change adds a feature flag for online calibration. BUG=b:138303429,chromium:1023858 BRANCH=None TEST=buildall since flag is not yet used Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I3036371a7499bf0eaf0846ff07eec6e6ee18a391 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834021 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org> Tested-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index ce8c3588ca..95ac60145f 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -1075,13 +1075,20 @@ static enum ec_status host_cmd_motion_sense(struct host_cmd_handler_args *args)
out->info.location = sensor->location;
out->info.chip = sensor->chip;
+ if (args->version < 3)
+ args->response_size = sizeof(out->info);
if (args->version >= 3) {
out->info_3.min_frequency = sensor->min_frequency;
out->info_3.max_frequency = sensor->max_frequency;
out->info_3.fifo_max_event_count = MAX_FIFO_EVENT_COUNT;
args->response_size = sizeof(out->info_3);
- } else {
- args->response_size = sizeof(out->info);
+ }
+ if (args->version >= 4) {
+ if (IS_ENABLED(CONFIG_ONLINE_CALIB) &&
+ sensor->drv->read_temp)
+ out->info_4.flags |=
+ MOTION_SENSE_CMD_INFO_FLAG_ONLINE_CALIB;
+ args->response_size = sizeof(out->info_4);
}
break;
@@ -1414,9 +1421,9 @@ static enum ec_status host_cmd_motion_sense(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_MOTION_SENSE_CMD,
- host_cmd_motion_sense,
- EC_VER_MASK(1) | EC_VER_MASK(2) | EC_VER_MASK(3));
+DECLARE_HOST_COMMAND(EC_CMD_MOTION_SENSE_CMD, host_cmd_motion_sense,
+ EC_VER_MASK(1) | EC_VER_MASK(2) | EC_VER_MASK(3) |
+ EC_VER_MASK(4));
/*****************************************************************************/
/* Console commands */