summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@google.com>2022-01-25 12:07:06 -0700
committerCommit Bot <commit-bot@chromium.org>2022-02-02 01:33:09 +0000
commit013552982b5859e7296e37d1bc4da39b26655b2d (patch)
tree99fd5faf55127b4169ebd7c3671668528193d2ca
parent36b80516b10a7e4cce52b07de97633a899672e37 (diff)
downloadchrome-ec-013552982b5859e7296e37d1bc4da39b26655b2d.tar.gz
zephyr: Use DT for ALS_COUNT
Move the definition of ALS_COUNT to use device tree instead of Kconfig BRANCH=none BUG=b:173507858 TEST=zmake testall Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Id59ec8bc4afc09478265f649ce3bdb723819e48e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3415386 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/Kconfig.motionsense12
-rw-r--r--zephyr/projects/volteer/volteer/prj.conf1
-rw-r--r--zephyr/shim/include/config_chip.h8
-rw-r--r--zephyr/shim/include/motionsense_sensors_defs.h4
4 files changed, 7 insertions, 18 deletions
diff --git a/zephyr/Kconfig.motionsense b/zephyr/Kconfig.motionsense
index 96f69d4848..1e935d859e 100644
--- a/zephyr/Kconfig.motionsense
+++ b/zephyr/Kconfig.motionsense
@@ -79,18 +79,6 @@ config PLATFORM_EC_ALS
Number of ALS entries reserved in EC memmap are defined by EC_ALS_ENTRIES
in ec_commands.h.
-if PLATFORM_EC_ALS
-
-config PLATFORM_EC_ALS_COUNT
- int "Number of ALS devices"
- default 1
- help
- This sets the number of ALS devices. This should be less than or equal to
- EC_ALS_ENTRIES in ec_commands.h
- TODO(b/173507858) move this to device tree
-
-endif # PLATFORM_EC_ALS
-
config PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT
bool "Dynamic Motion Sensor Count"
help
diff --git a/zephyr/projects/volteer/volteer/prj.conf b/zephyr/projects/volteer/volteer/prj.conf
index 77f39a20e6..2e8e56faab 100644
--- a/zephyr/projects/volteer/volteer/prj.conf
+++ b/zephyr/projects/volteer/volteer/prj.conf
@@ -77,7 +77,6 @@ CONFIG_PLATFORM_EC_MOTIONSENSE=y
CONFIG_PLATFORM_EC_ACCEL_FIFO=y
CONFIG_PLATFORM_EC_ACCEL_INTERRUPTS=y
CONFIG_PLATFORM_EC_ALS=y
-CONFIG_PLATFORM_EC_ALS_COUNT=1
CONFIG_PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT=y
CONFIG_PLATFORM_EC_GMR_TABLET_MODE=y
CONFIG_PLATFORM_EC_LID_ANGLE=y
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 4721772b35..a10c27e887 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -9,6 +9,10 @@
#include <devicetree.h>
#include <autoconf.h>
+#define SENSOR_NODE DT_PATH(motionsense_sensor)
+#define SENSOR_INFO_NODE DT_PATH(motionsense_sensor_info)
+#define SENSOR_ALT_NODE DT_PATH(motionsense_sensor_alt)
+
/*
* The battery enum is used in various drivers and these assume that it is
* always available (defined in board.h). With Zephyr we don't include board.h
@@ -1606,9 +1610,9 @@
#undef CONFIG_ALS
#undef CONFIG_ALS_COUNT
-#ifdef CONFIG_PLATFORM_EC_ALS
+#if DT_NODE_HAS_PROP(SENSOR_INFO_NODE, als_sensors)
#define CONFIG_ALS
-#define ALS_COUNT CONFIG_PLATFORM_EC_ALS_COUNT
+#define ALS_COUNT DT_PROP_LEN(SENSOR_INFO_NODE, als_sensors)
#else
#define ALS_COUNT 0
#endif
diff --git a/zephyr/shim/include/motionsense_sensors_defs.h b/zephyr/shim/include/motionsense_sensors_defs.h
index ec2180566e..5c11a5240b 100644
--- a/zephyr/shim/include/motionsense_sensors_defs.h
+++ b/zephyr/shim/include/motionsense_sensors_defs.h
@@ -8,9 +8,7 @@
#include <devicetree.h>
-#define SENSOR_NODE DT_PATH(motionsense_sensor)
-#define SENSOR_INFO_NODE DT_PATH(motionsense_sensor_info)
-#define SENSOR_ALT_NODE DT_PATH(motionsense_sensor_alt)
+#include "common.h"
#define SENSOR_ID(id) DT_CAT(SENSOR_, id)