From 1d3c523e1345fcee45863557ab754ebbe06a625c Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Thu, 10 Dec 2020 21:38:48 -0800 Subject: kohaku: Set base light sensor information correctly BH1370 light sensor only support 10Hz frequency. Set parameters properly. Sensor only used on kohaku. BUG=b:172343923 BRANCH=hatch TEST=Check on Kohaku the light parameters are correct. Conflicts: board/kohaku/board.c: Make change in caroline board. Change-Id: Ibb9b2699e414cf80730d290aba981dcd4898f84f Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586069 Reviewed-by: Scott Collyer (cherry picked from commit e2882f20fa28810e735e1a8f0750674e7940eb2d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200806 Reviewed-by: Stefan Reinauer --- board/caroline/board.c | 6 +++--- driver/als_bh1730.h | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/board/caroline/board.c b/board/caroline/board.c index 27f5989250..ccc3e7cf28 100644 --- a/board/caroline/board.c +++ b/board/caroline/board.c @@ -589,11 +589,11 @@ struct motion_sensor_t motion_sensors[] = { .addr = BH1730_I2C_ADDR, .rot_standard_ref = NULL, .default_range = 65535, - .min_frequency = 10, - .max_frequency = 10, + .min_frequency = BH1730_MIN_FREQ, + .max_frequency = BH1730_MAX_FREQ, .config = { [SENSOR_CONFIG_EC_S0] = { - .odr = 100000, + .odr = BH1730_10000_MHZ, .ec_rate = 0, }, }, diff --git a/driver/als_bh1730.h b/driver/als_bh1730.h index 3cd8757822..0847062afb 100644 --- a/driver/als_bh1730.h +++ b/driver/als_bh1730.h @@ -58,6 +58,12 @@ /* default Itime is about 10Hz */ #define BH1730_10000_MHZ (10*1000) +#define BH1730_MAX_FREQ BH1730_10000_MHZ +/* + * 10Hz is too fast for the AP: allow the AP query data less often, the EC will + * downsample. + */ +#define BH1730_MIN_FREQ (BH1730_MAX_FREQ / 100) /* * Use default lux calculation formula parameters if board specific @@ -88,4 +94,3 @@ struct bh1730_drv_data_t { extern const struct accelgyro_drv bh1730_drv; #endif /* __CROS_EC_ALS_BH1730_H */ - -- cgit v1.2.1