summaryrefslogtreecommitdiff
path: root/driver/als_opt3001.h
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2015-07-15 13:58:25 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-21 01:34:27 +0000
commitcd0df39ba5a22f390b57cba584e6a919be5ae53b (patch)
treee3eeb13165aa6a3dd1558c6d32c0779b5869497c /driver/als_opt3001.h
parent26db470b39687b5abbbc8c5a5c8ac334a900fbae (diff)
downloadchrome-ec-cd0df39ba5a22f390b57cba584e6a919be5ae53b.tar.gz
Driver: OPT3001: Add TI OPT3001 light sensor driver
BUG=none BRANCH=none TEST=Added OPT3001 config to test the sensor in Kunimitsu. Able to read the als data from "als" console command. Varied the light intensity and the als reading are changing. Driver fits into the existing ALS framework. Change-Id: Idb2e6f9f50b6d0d6c8f64c11336efd3f2c76d498 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/286782 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'driver/als_opt3001.h')
-rw-r--r--driver/als_opt3001.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/driver/als_opt3001.h b/driver/als_opt3001.h
new file mode 100644
index 0000000000..b9c7714c0b
--- /dev/null
+++ b/driver/als_opt3001.h
@@ -0,0 +1,31 @@
+/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * TI OPT3001 light sensor driver
+ */
+
+#ifndef __CROS_EC_ALS_OPT3001_H
+#define __CROS_EC_ALS_OPT3001_H
+
+/* I2C interface */
+#define OPT3001_I2C_ADDR1 (0x44 << 1)
+#define OPT3001_I2C_ADDR2 (0x45 << 1)
+#define OPT3001_I2C_ADDR3 (0x46 << 1)
+#define OPT3001_I2C_ADDR4 (0x47 << 1)
+
+/* OPT3001 registers */
+#define OPT3001_REG_RESULT 0x00
+#define OPT3001_REG_CONFIGURE 0x01
+#define OPT3001_REG_INT_LIMIT_LSB 0x02
+#define OPT3001_REG_INT_LIMIT_MSB 0x03
+#define OPT3001_REG_MAN_ID 0x7E
+#define OPT3001_REG_DEV_ID 0x7F
+
+/* OPT3001 register values */
+#define OPT3001_MANUFACTURER_ID 0x5449
+#define OPT3001_DEVICE_ID 0x3001
+
+int opt3001_read_lux(int *lux, int af);
+
+#endif /* __CROS_EC_ALS_OPT3001_H */