summaryrefslogtreecommitdiff
path: root/driver/als_opt3001.c
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2015-08-03 23:37:54 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-23 15:10:08 -0700
commitf9272713da615e51ea14f70872fec46fbd88e938 (patch)
tree7b12c57a3435a615718c9d3325dfc0671fc297b6 /driver/als_opt3001.c
parent806aae81f6bed5ab1a26e860eaa2b5b1349a1444 (diff)
downloadchrome-ec-f9272713da615e51ea14f70872fec46fbd88e938.tar.gz
i2c: Add i2ctest console command
Added i2ctest console command to test the reliability of the I2C. By reading/writing to the known registers this tests provides the number of successful read and writes. BUG=chrome-os-partner:57487 TEST=Enabled the i2ctest config on Reef and tested the i2c read/writes. BRANCH=none Change-Id: I9e27ff96f2b85422933bc590d112a083990e2dfb Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/290427 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver/als_opt3001.c')
-rw-r--r--driver/als_opt3001.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/driver/als_opt3001.c b/driver/als_opt3001.c
index 993803bd28..bbf61a1064 100644
--- a/driver/als_opt3001.c
+++ b/driver/als_opt3001.c
@@ -87,3 +87,15 @@ int opt3001_read_lux(int *lux, int af)
return EC_SUCCESS;
}
+
+#ifdef CONFIG_CMD_I2C_STRESS_TEST_ALS
+struct i2c_stress_test_dev opt3001_i2c_stress_test_dev = {
+ .reg_info = {
+ .read_reg = OPT3001_REG_DEV_ID,
+ .read_val = OPT3001_DEVICE_ID,
+ .write_reg = OPT3001_REG_INT_LIMIT_LSB,
+ },
+ .i2c_read_dev = &opt3001_i2c_read,
+ .i2c_write_dev = &opt3001_i2c_write,
+};
+#endif /* CONFIG_CMD_I2C_STRESS_TEST_ALS */