diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2018-11-27 12:50:42 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-12-03 03:11:54 -0800 |
commit | 77b306b340ca428ba6785add204ccdce82185274 (patch) | |
tree | c7bb8333c3ebdfb13463285885c8c5ebbbbf4893 /include/motion_sense.h | |
parent | 45189f94d9684c88200c71bc781bfd983277a8aa (diff) | |
download | chrome-ec-77b306b340ca428ba6785add204ccdce82185274.tar.gz |
sensor: Adjust max_frequency based on EC performance
Put in max_frequency a value that the sensor AND the EC support.
BRANCH=none
BUG=b:118205424,b:118851581,chromium:615059
TEST=Compile. Check all max sensors frequencies have been altered with:
for i in $(grep -rh max_frequency board | cut -d '=' -f 2 | sort | \
uniq | grep FREQ | sed 's/FREQ.*//') ; do
echo -n $i ; git show | grep -q $i || break;
echo check
done
Check on nocturne accel max frequency is still correct.
Change-Id: I848396d9f150a2e94d430a8feeafc1087a6bf2c3
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1352063
Commit-Ready: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Reviewed-by: Jesse Schettler <jschettler@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r-- | include/motion_sense.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h index b7290e7bb4..2d81c9b003 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -51,6 +51,16 @@ enum sensor_config { #define MAX_FIFO_EVENT_COUNT 0 #endif +/* + * Define the frequency to use in max_frequency based on the maximal frequency + * the sensor support and what the EC can provide. + * Return a frequency the sensor supports. + * Trigger a compilation error when the EC way to slow for the sensor. + */ +#define MOTION_MAX_SENSOR_FREQUENCY(_max, _step) GENERIC_MIN( \ + (_max) / (CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ >= (_step)), \ + (_step) << __fls(CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ / (_step))) + struct motion_data_t { /* * data rate the sensor will measure, in mHz: 0 suspended. |