summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2020-12-10 21:38:48 -0800
committerCommit Bot <commit-bot@chromium.org>2021-02-13 00:53:02 +0000
commitdbeabc04cf7a2b66181be1f76ae50cf133a7b2ef (patch)
tree3a8b2c0c380b76bd3b1fa86aa480b536a980da03
parent41c4e3cfdf32acd68c80efc8cfec956864b055b5 (diff)
downloadchrome-ec-dbeabc04cf7a2b66181be1f76ae50cf133a7b2ef.tar.gz
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. Change-Id: Ibb9b2699e414cf80730d290aba981dcd4898f84f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586069 Reviewed-by: Scott Collyer <scollyer@chromium.org> (cherry picked from commit e2882f20fa28810e735e1a8f0750674e7940eb2d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2693917
-rw-r--r--board/kohaku/board.c7
-rw-r--r--driver/als_bh1730.h6
2 files changed, 9 insertions, 4 deletions
diff --git a/board/kohaku/board.c b/board/kohaku/board.c
index a1abf216fe..e7f9dddcea 100644
--- a/board/kohaku/board.c
+++ b/board/kohaku/board.c
@@ -322,12 +322,11 @@ struct motion_sensor_t motion_sensors[] = {
.i2c_spi_addr_flags = BH1730_I2C_ADDR_FLAGS,
.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,
- .ec_rate = 0,
+ .odr = BH1730_10000_MHZ,
},
},
},
diff --git a/driver/als_bh1730.h b/driver/als_bh1730.h
index d0205033e4..f49afac76f 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