summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorNick Vaccaro <nvaccaro@chromium.org>2017-04-25 19:09:03 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-05-18 21:05:23 -0700
commit9a0d0aa70d483be79c71a459dfd5f5e89da2638d (patch)
tree5e61d14a77ec938ce1508dbc61a271e0dfb15ee0 /common/motion_sense.c
parentd7eefeffb927cfd311d40c00ce817937eab4cb61 (diff)
downloadchrome-ec-9a0d0aa70d483be79c71a459dfd5f5e89da2638d.tar.gz
common: sensors: add extra sensor attributes
Adds min_frequency and max_frequency to struct motion_sensor_t. New attributes min_frequency and max_frequency are now returned in ectool's MOTIONSENSE_CMD_INFO response. Incremented ectool's MOTIONSENSE_CMD_INFO version to version 3. Add constants for MIN_FREQUENCY and MAX_FREQUENCY to each sensor's header file. BRANCH=none BUG=chromium:615059 TEST=build/boot and verify MOTIONSENSE_CMD_INFO response on kevin, make buildall -j passes. Change-Id: I66db9715c122ef6bb4665ad5d086a9ecc9c7c93a Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/482703 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 2b9d715343..a6792cf210 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -1020,10 +1020,23 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args)
else
#endif
out->info.type = sensor->type;
+
out->info.location = sensor->location;
out->info.chip = sensor->chip;
-
- args->response_size = sizeof(out->info);
+ if (args->version >= 3) {
+ out->info_3.min_frequency = sensor->min_frequency;
+ /*
+ * Make sure reported max frequency for this sensor
+ * doesn't exceed the max sensor frequency the EC is
+ * capable of supporting
+ */
+ out->info_3.max_frequency = MIN(sensor->max_frequency,
+ CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ);
+ 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);
+ }
break;
case MOTIONSENSE_CMD_EC_RATE:
@@ -1329,7 +1342,7 @@ static int host_cmd_motion_sense(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_MOTION_SENSE_CMD,
host_cmd_motion_sense,
- EC_VER_MASK(1) | EC_VER_MASK(2));
+ EC_VER_MASK(1) | EC_VER_MASK(2) | EC_VER_MASK(3));
/*****************************************************************************/
/* Console commands */