summaryrefslogtreecommitdiff
path: root/driver/als_tcs3400.h
diff options
context:
space:
mode:
authorNick Vaccaro <nvaccaro@google.com>2019-06-25 17:38:37 -0700
committerCommit Bot <commit-bot@chromium.org>2019-08-20 16:31:49 +0000
commit8aaeb9fd05ab185a7807f3650e491d2c3042637a (patch)
tree1ea559dd616d2f4e389ede9d33890540393ccb49 /driver/als_tcs3400.h
parent8b07b326496025530911f63b220fa987f1950f06 (diff)
downloadchrome-ec-8aaeb9fd05ab185a7807f3650e491d2c3042637a.tar.gz
driver/tcs3400: improve efficiency of auto-adjust
Adds an array which holds the number of atime increments needed at various lux levels and again settings to change delta from saturation by 1%. Using this table, the anti-saturation algorithm can get to the 90% band in most cases in a single adjustment vs the 10 to 15 adjustments previously needed when not using this table. Enabling CONFIG_TCS_USE_LUX_TABLES takes up 280 bytes in the ec.obj. BUG=b:124512628 BRANCH=master TEST=Flash and boot flapjack, verify that ALS and RGB sensors are still generating data. I used alslog patch and enabled ALS logging in EC console via "alslog 2047". Verify that under a constant light source, the adjustment mechanism correctly drives the ALS values such that they land in the sweet spot between 90 to <100% of saturation. Change-Id: I7cd0b8242e72233f50ff2751834f7bba367c6706 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1677764 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'driver/als_tcs3400.h')
-rw-r--r--driver/als_tcs3400.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/driver/als_tcs3400.h b/driver/als_tcs3400.h
index eace416c94..9681a39a56 100644
--- a/driver/als_tcs3400.h
+++ b/driver/als_tcs3400.h
@@ -97,6 +97,11 @@ enum tcs3400_mode {
#define TCS_CALIBRATION_ATIME TCS_MIN_ATIME
#define TCS_GAIN_UPSHIFT_ATIME TCS_MAX_ATIME
+/* Number of different ranges supported for atime adjustment support */
+#define TCS_MAX_ATIME_RANGES 13
+#define TCS_GAIN_TABLE_MAX_LUX 12999
+#define TCS_ATIME_GAIN_FACTOR 100 /* table values are 100x actual value */
+
#define TCS_MIN_AGAIN 0x00 /* 1x gain */
#define TCS_MAX_AGAIN 0x03 /* 64x gain */
#define TCS_CALIBRATION_AGAIN 0x02 /* 16x gain */