diff options
author | Yuval Peress <peress@chromium.org> | 2019-10-01 10:42:28 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-19 02:35:16 +0000 |
commit | 267da3cfcd4afc309a99f292f8670eed2f141862 (patch) | |
tree | f790282d67dba522889e3e7e310484986ab62c07 | |
parent | 78c2dcc67c38f7a1b6c649088c3cfa5a7bbfc250 (diff) | |
download | chrome-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>
-rw-r--r-- | common/motion_sense.c | 17 | ||||
-rw-r--r-- | include/ec_commands.h | 32 | ||||
-rw-r--r-- | util/ectool.c | 10 |
3 files changed, 51 insertions, 8 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 */ diff --git a/include/ec_commands.h b/include/ec_commands.h index 5244533610..9159c082cc 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2775,6 +2775,11 @@ struct ec_params_motion_sense { }; } __ec_todo_packed; +enum motion_sense_cmd_info_flags { + /* The sensor supports online calibration */ + MOTION_SENSE_CMD_INFO_FLAG_ONLINE_CALIB = BIT(0), +}; + struct ec_response_motion_sense { union { /* Used for MOTIONSENSE_CMD_DUMP */ @@ -2825,6 +2830,33 @@ struct ec_response_motion_sense { uint32_t fifo_max_event_count; } info_3; + /* Used for MOTIONSENSE_CMD_INFO version 4 */ + struct __ec_align4 { + /* Should be element of enum motionsensor_type. */ + uint8_t type; + + /* Should be element of enum motionsensor_location. */ + uint8_t location; + + /* Should be element of enum motionsensor_chip. */ + uint8_t chip; + + /* Minimum sensor sampling frequency */ + uint32_t min_frequency; + + /* Maximum sensor sampling frequency */ + uint32_t max_frequency; + + /* Max number of sensor events that could be in fifo */ + uint32_t fifo_max_event_count; + + /* + * Should be elements of + * enum motion_sense_cmd_info_flags + */ + uint32_t flags; + } info_4; + /* Used for MOTIONSENSE_CMD_DATA */ struct ec_response_motion_sensor_data data; diff --git a/util/ectool.c b/util/ectool.c index 78059039d5..fca417d6a3 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -4756,11 +4756,15 @@ static int cmd_motionsense(int argc, char **argv) if (version >= 3) { printf("Min Frequency: %d mHz\n", - resp->info_3.min_frequency); + resp->info_3.min_frequency); printf("Max Frequency: %d mHz\n", - resp->info_3.max_frequency); + resp->info_3.max_frequency); printf("FIFO Max Event Count: %d\n", - resp->info_3.fifo_max_event_count); + resp->info_3.fifo_max_event_count); + } + if (version >= 4) { + printf("Flags: %d\n", + resp->info_4.flags); } return 0; } |