summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2022-04-06 20:04:31 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-07 22:31:33 +0000
commit8c107049fc13db1f9adf7e341a999656d358a78e (patch)
tree9faf2c3a5edd467a564c106c0a1fbdff82ba2540
parent85c80f94a394f85fbfcfd80a09aec46256383af0 (diff)
downloadchrome-ec-8c107049fc13db1f9adf7e341a999656d358a78e.tar.gz
zephyr: herobrine: Enable TCS3400 Light sensor
BUG=b:204193571 TEST=zmake configure -b herobrine BRANCH=main Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I20e69d48ef7735ff3978518bb7dd682a93b7e9af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3575695 Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r--zephyr/projects/herobrine/motionsense.dts98
-rw-r--r--zephyr/projects/herobrine/prj_herobrine.conf7
2 files changed, 104 insertions, 1 deletions
diff --git a/zephyr/projects/herobrine/motionsense.dts b/zephyr/projects/herobrine/motionsense.dts
index ef8c1ec87e..1d36fcbf47 100644
--- a/zephyr/projects/herobrine/motionsense.dts
+++ b/zephyr/projects/herobrine/motionsense.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_herobrine.conf b/zephyr/projects/herobrine/prj_herobrine.conf
index f65a44406d..3c7eddbae6 100644
--- a/zephyr/projects/herobrine/prj_herobrine.conf
+++ b/zephyr/projects/herobrine/prj_herobrine.conf
@@ -4,3 +4,10 @@
# Herobrine-NPCX9 reference-board-specific Kconfig settings.
CONFIG_BOARD_HEROBRINE=y
+
+# Sensors
+CONFIG_PLATFORM_EC_ALS=y
+
+# Sensor Drivers
+CONFIG_PLATFORM_EC_ALS_TCS3400=y
+CONFIG_PLATFORM_EC_ALS_TCS3400_EMULATED_IRQ_EVENT=y