summaryrefslogtreecommitdiff
path: root/driver/als_opt3001.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2020-01-08 11:00:45 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-23 01:47:59 +0000
commita8ea3bfdbe928b9bcf2d3756a2fae16fe40132ae (patch)
tree3a301ef8fca831fc1935c83927b0a53cb49ff09f /driver/als_opt3001.c
parentba0611aceb681ff7988aaff96b324eb3c7d583b6 (diff)
downloadchrome-ec-a8ea3bfdbe928b9bcf2d3756a2fae16fe40132ae.tar.gz
driver/opt3100: Set min/max frequency that match the driver
Given we set integration time at 800ms, the host must be aware to not set an ODR over 1Hz. BUG=chromium:615059 BRANCH=nocturne TEST=Check new max_frequency is indeed 1Hz on nocturne. Change-Id: I44252073f59e00cdf4d13b4fa6d88448537c168e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991857 Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Diffstat (limited to 'driver/als_opt3001.c')
-rw-r--r--driver/als_opt3001.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/driver/als_opt3001.c b/driver/als_opt3001.c
index e6332184c0..8f1e2bc775 100644
--- a/driver/als_opt3001.c
+++ b/driver/als_opt3001.c
@@ -214,8 +214,8 @@ static int opt3001_set_data_rate(const struct motion_sensor_t *s,
* integrating over 800ms.
* Do not allow range higher than 1Hz.
*/
- if (rate > 1000)
- rate = 1000;
+ if (rate > OPT3001_LIGHT_MAX_FREQ)
+ rate = OPT3001_LIGHT_MAX_FREQ;
}
rv = opt3001_i2c_read(s->port, s->i2c_spi_addr_flags,
OPT3001_REG_CONFIGURE, &reg);