summaryrefslogtreecommitdiff
path: root/driver/als_tcs3400.c
diff options
context:
space:
mode:
authorHyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com>2021-03-20 11:51:05 -0700
committerCommit Bot <commit-bot@chromium.org>2021-03-24 02:10:56 +0000
commite0835c1209a7ce2911a1ebfdd6763c4907d2c2ff (patch)
treeaaffb82b6c21b00c4549b9c33459d786d14a6d57 /driver/als_tcs3400.c
parenta0e46cd164efca0f48ecff3d1d2ffe10309e3fd4 (diff)
downloadchrome-ec-e0835c1209a7ce2911a1ebfdd6763c4907d2c2ff.tar.gz
zephyr: DT: support TCS3400
This change is to support TCS3400 via DT. The change includes, using DT, - creating TCS3400 driver specific data - creating motion sensor entry for TCS3400 - creating the TCS3400 irq event to motion sense task BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I09cb7d69baa95c8450c7f5cc0149038aa23f3bc9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778822 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'driver/als_tcs3400.c')
-rw-r--r--driver/als_tcs3400.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/driver/als_tcs3400.c b/driver/als_tcs3400.c
index 93bd1f1d91..0626e679ee 100644
--- a/driver/als_tcs3400.c
+++ b/driver/als_tcs3400.c
@@ -18,6 +18,26 @@
#define CPRINTS(fmt, args...) cprints(CC_ACCEL, "%s "fmt, __func__, ## args)
+#if defined(CONFIG_ZEPHYR) && defined(CONFIG_ACCEL_INTERRUPTS)
+/*
+ * Get the mostion sensor ID of the TCS3400 sensor that
+ * generates the interrupt.
+ * The interrupt is converted to the event and transferred to motion
+ * sense task that actually handles the interrupt.
+ *
+ * Here, we use alias to get the motion sensor ID
+ *
+ * e.g) als_clear below is the label of a child node in /motionsense-sensors
+ * aliases {
+ * tcs3400-int = &als_clear;
+ * };
+ */
+#if DT_NODE_EXISTS(DT_ALIAS(tcs3400_int))
+#define CONFIG_ALS_TCS3400_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(SENSOR_ID(DT_ALIAS(tcs3400_int)))
+#endif
+#endif
+
STATIC_IF(CONFIG_ACCEL_FIFO) volatile uint32_t last_interrupt_timestamp;
#ifdef CONFIG_TCS_USE_LUX_TABLE