summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2022-04-06 19:54:30 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-07 22:31:34 +0000
commitcf79770ff4aa19965c60fe9af5005d64141df61a (patch)
tree78c137e1c06a3f7efdb2a7bc817254cf573476ea
parent8c107049fc13db1f9adf7e341a999656d358a78e (diff)
downloadchrome-ec-cf79770ff4aa19965c60fe9af5005d64141df61a.tar.gz
zephyr: hoglin: Enable TCS3400 Light sensor
BUG=b:204193571 TEST=zmake configure -b hoglin BRANCH=main Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I6f28e205cb596915a4127a5b47bdfb7501891091 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3575696 Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r--zephyr/projects/herobrine/motionsense_hoglin.dts98
-rw-r--r--zephyr/projects/herobrine/prj_hoglin.conf8
2 files changed, 105 insertions, 1 deletions
diff --git a/zephyr/projects/herobrine/motionsense_hoglin.dts b/zephyr/projects/herobrine/motionsense_hoglin.dts
index 0d715711b2..3f67347e10 100644
--- a/zephyr/projects/herobrine/motionsense_hoglin.dts
+++ b/zephyr/projects/herobrine/motionsense_hoglin.dts
@@ -14,6 +14,7 @@
* its own <>_INT_EVENT.
*/
bmi260-int = &base_accel;
+ tcs3400-int = &als_clear;
};
/*
@@ -69,6 +70,66 @@
compatible = "cros-ec,drvdata-bmi260";
status = "okay";
};
+
+ tcs_clear_data: tcs3400-clear-drv-data {
+ compatible = "cros-ec,drvdata-tcs3400-clear";
+ status = "okay";
+
+ als-drv-data {
+ compatible = "cros-ec,accelgyro-als-drv-data";
+ als-cal {
+ scale = <1>;
+ uscale = <0>;
+ offset = <0>;
+ als-channel-scale {
+ compatible = "cros-ec,accelgyro-als-channel-scale";
+ k-channel-scale = <1>;
+ cover-scale = <1>;
+ };
+ };
+ };
+ };
+
+ tcs_rgb_data: tcs3400-rgb-drv-data {
+ compatible = "cros-ec,drvdata-tcs3400-rgb";
+ status = "okay";
+
+ /* node for rgb_calibration_t defined in accelgyro.h */
+ rgb_calibration {
+ compatible =
+ "cros-ec,accelgyro-rgb-calibration";
+
+ irt = <1>;
+
+ rgb-cal-x {
+ offset = <0>;
+ coeff = <0 0 0 1>;
+ als-channel-scale {
+ compatible = "cros-ec,accelgyro-als-channel-scale";
+ k-channel-scale = <1>;
+ cover-scale = <1>;
+ };
+ };
+ rgb-cal-y {
+ offset = <0>;
+ coeff = <0 0 0 1>;
+ als-channel-scale {
+ compatible = "cros-ec,accelgyro-als-channel-scale";
+ k-channel-scale = <1>;
+ cover-scale = <1>;
+ };
+ };
+ rgb-cal-z {
+ offset = <0>;
+ coeff = <0 0 0 1>;
+ als-channel-scale {
+ compatible = "cros-ec,accelgyro-als-channel-scale";
+ k-channel-scale = <1>;
+ cover-scale = <1>;
+ };
+ };
+ };
+ };
};
/*
@@ -141,17 +202,52 @@
rot-standard-ref = <&base_rot_ref>;
drv-data = <&bmi260_data>;
};
+
+ als_clear: base-als-clear {
+ compatible = "cros-ec,tcs3400-clear";
+ status = "okay";
+
+ label = "Clear Light";
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_CAMERA";
+ port = <&i2c_sensor>;
+ default-range = <0x10000>;
+ drv-data = <&tcs_clear_data>;
+ i2c-spi-addr-flags = "TCS3400_I2C_ADDR_FLAGS";
+ configs {
+ compatible =
+ "cros-ec,motionsense-sensor-config";
+ ec-s0 {
+ /* Run ALS sensor in S0 */
+ label = "SENSOR_CONFIG_EC_S0";
+ odr = <1000>;
+ };
+ };
+ };
+
+ base-als-rgb {
+ compatible = "cros-ec,tcs3400-rgb";
+ status = "okay";
+
+ label = "RGB Light";
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_CAMERA";
+ default-range = <0x10000>; /* scale = 1x, uscale = 0 */
+ drv-data = <&tcs_rgb_data>;
+ };
};
motionsense-sensor-info {
compatible = "cros-ec,motionsense-sensor-info";
+ /* list of entries for motion_als_sensors */
+ als-sensors = <&als_clear>;
/*
* list of GPIO interrupts that have to
* be enabled at initial stage
*/
sensor-irqs = <&int_accel_gyro>;
/* list of sensors in force mode */
- accel-force-mode-sensors = <&lid_accel>;
+ accel-force-mode-sensors = <&lid_accel &als_clear>;
};
};
diff --git a/zephyr/projects/herobrine/prj_hoglin.conf b/zephyr/projects/herobrine/prj_hoglin.conf
index b261c94169..f68d139b78 100644
--- a/zephyr/projects/herobrine/prj_hoglin.conf
+++ b/zephyr/projects/herobrine/prj_hoglin.conf
@@ -6,3 +6,11 @@
CONFIG_BOARD_HOGLIN=y
CONFIG_PLATFORM_EC_ACCEL_BMA255=n
CONFIG_PLATFORM_EC_ACCEL_BMA4XX=y
+
+# Sensors
+CONFIG_PLATFORM_EC_ALS=y
+
+# Sensor Drivers
+CONFIG_PLATFORM_EC_ALS_TCS3400=y
+CONFIG_PLATFORM_EC_ALS_TCS3400_EMULATED_IRQ_EVENT=y
+