diff options
author | Yuval Peress <peress@chromium.org> | 2019-10-01 10:42:28 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-01-21 21:30:59 +0000 |
commit | 79bf88f3ae32fb95edac092dfb67910ec639c3d9 (patch) | |
tree | 2a5a78afe45bea60f7007e047c199c5401ae9966 | |
parent | 042c8774bf063eb01f5b836490b6e0961ea2e072 (diff) | |
download | chrome-ec-79bf88f3ae32fb95edac092dfb67910ec639c3d9.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>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1979585
Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
(cherry picked from commit e4b0cfefb5239da458efea5de50154a74ff74b6f)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2008969
Reviewed-by: Philip Chen <philipchen@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@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 29278ddebe..441eeff279 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 90ed0ae435..3df05c33bb 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -4746,11 +4746,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; } |