From 07ee4665918bcc448d67fd1faa3746762069b08d Mon Sep 17 00:00:00 2001 From: Aaron Massey Date: Fri, 14 Apr 2023 15:38:56 -0600 Subject: [PATCH] emul: Migrate all emulation use to use DT_HAS_ Remove all enabling of CONFIG_EMUL_.* in favor of automatically enabling peripheral emulators based on the compatible string presence in the device tree and the one true CONFIG_EMUL. Zephyr has long since moved to a model of enabling drivers based on the presence of their associated IC's compatible string in the final devicetree overlay. There is no reason that emulators can't align in just the same way, and probably ought to to remove superfluous enabling of configs. Signed-off-by: Aaron Massey --- drivers/fuel_gauge/max17048/Kconfig | 2 ++ drivers/fuel_gauge/sbs_gauge/Kconfig.emul_sbs_gauge | 2 ++ drivers/sensor/akm09918c/Kconfig | 1 + drivers/sensor/bmi160/Kconfig | 2 ++ drivers/sensor/icm42688/Kconfig | 1 + subsys/emul/espi/Kconfig | 7 ++++--- tests/drivers/fuel_gauge/max17048/boards/native_posix.conf | 3 --- .../fuel_gauge/sbs_gauge/boards/emulated_board.conf | 3 --- tests/drivers/sensor/accel/boards/native_posix.conf | 1 - tests/drivers/sensor/akm09918c/prj.conf | 1 - tests/drivers/sensor/icm42688/prj.conf | 1 - tests/drivers/sensor/sbs_gauge/boards/native_posix.conf | 3 --- tests/drivers/sensor/sbs_gauge/boards/qemu_arc_hs.conf | 3 --- tests/drivers/sensor/sbs_gauge/boards/qemu_cortex_a9.conf | 3 --- tests/subsys/emul/prj.conf | 1 - 15 files changed, 12 insertions(+), 22 deletions(-) diff --git a/drivers/fuel_gauge/max17048/Kconfig b/drivers/fuel_gauge/max17048/Kconfig index 1866614fc7..bc4713497b 100644 --- a/drivers/fuel_gauge/max17048/Kconfig +++ b/drivers/fuel_gauge/max17048/Kconfig @@ -14,7 +14,9 @@ config MAX17048 config EMUL_MAX17048 bool "Emulate an MAX17048 fuel gague" + default y depends on EMUL + depends on MAX17048 help It provides readings which follow a simple sequence, thus allowing test code to check that things are working as expected. diff --git a/drivers/fuel_gauge/sbs_gauge/Kconfig.emul_sbs_gauge b/drivers/fuel_gauge/sbs_gauge/Kconfig.emul_sbs_gauge index fe9f668cf0..17e9692786 100644 --- a/drivers/fuel_gauge/sbs_gauge/Kconfig.emul_sbs_gauge +++ b/drivers/fuel_gauge/sbs_gauge/Kconfig.emul_sbs_gauge @@ -6,7 +6,9 @@ config EMUL_SBS_GAUGE bool "Emulate an SBS 1.1 compliant smart battery fuel gauge" + default y depends on EMUL + depends on SBS_GAUGE_NEW_API || SBS_GAUGE help It provides readings which follow a simple sequence, thus allowing test code to check that things are working as expected. diff --git a/drivers/sensor/akm09918c/Kconfig b/drivers/sensor/akm09918c/Kconfig index a09988a52c..2765d70a21 100644 --- a/drivers/sensor/akm09918c/Kconfig +++ b/drivers/sensor/akm09918c/Kconfig @@ -11,6 +11,7 @@ config AKM09918C config EMUL_AKM09918C bool "Emulator for AKM09918C" + default y depends on AKM09918C depends on EMUL help diff --git a/drivers/sensor/bmi160/Kconfig b/drivers/sensor/bmi160/Kconfig index afc022053c..064a0644e2 100644 --- a/drivers/sensor/bmi160/Kconfig +++ b/drivers/sensor/bmi160/Kconfig @@ -214,7 +214,9 @@ endchoice config EMUL_BMI160 bool "Emulate a Bosch BMI160 accelerometer" + default y depends on EMUL + depends on BMI160 help This is an emulator for the Bosch BMI160 accelerometer. diff --git a/drivers/sensor/icm42688/Kconfig b/drivers/sensor/icm42688/Kconfig index a4ee90efb7..5cdfb3cdc1 100644 --- a/drivers/sensor/icm42688/Kconfig +++ b/drivers/sensor/icm42688/Kconfig @@ -14,6 +14,7 @@ config ICM42688 config EMUL_ICM42688 bool "Emulator for the ICM42688" + default y depends on ICM42688 depends on EMUL help diff --git a/subsys/emul/espi/Kconfig b/subsys/emul/espi/Kconfig index 1c75d1bf30..11b9bb5015 100644 --- a/subsys/emul/espi/Kconfig +++ b/subsys/emul/espi/Kconfig @@ -6,9 +6,10 @@ config EMUL_ESPI_HOST bool "Emulate an eSPI host" help - This is an emulator of the generic eSPI host. The emulator supports - basic host operations - virtual wires and writing to port 80. It can be - extended. + This is an emulator of the generic eSPI host. The emulator supports basic host operations + - virtual wires and writing to port 80. It can be extended. Note: Because this emulator is + not tied to a particular DT node, it does not make use of the DT_HAS__ENABLED + macro. if EMUL_ESPI_HOST diff --git a/tests/drivers/fuel_gauge/max17048/boards/native_posix.conf b/tests/drivers/fuel_gauge/max17048/boards/native_posix.conf index 5b4680bc37..022a71dd0f 100644 --- a/tests/drivers/fuel_gauge/max17048/boards/native_posix.conf +++ b/tests/drivers/fuel_gauge/max17048/boards/native_posix.conf @@ -1,6 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_EMUL=y -CONFIG_EMUL_MAX17048=y -CONFIG_I2C=y -CONFIG_I2C_EMUL=y diff --git a/tests/drivers/fuel_gauge/sbs_gauge/boards/emulated_board.conf b/tests/drivers/fuel_gauge/sbs_gauge/boards/emulated_board.conf index 065b1009a4..f8452191db 100644 --- a/tests/drivers/fuel_gauge/sbs_gauge/boards/emulated_board.conf +++ b/tests/drivers/fuel_gauge/sbs_gauge/boards/emulated_board.conf @@ -2,6 +2,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_EMUL=y -CONFIG_EMUL_SBS_GAUGE=y -CONFIG_I2C=y -CONFIG_I2C_EMUL=y diff --git a/tests/drivers/sensor/accel/boards/native_posix.conf b/tests/drivers/sensor/accel/boards/native_posix.conf index c04fd29d79..70fd212912 100644 --- a/tests/drivers/sensor/accel/boards/native_posix.conf +++ b/tests/drivers/sensor/accel/boards/native_posix.conf @@ -4,6 +4,5 @@ CONFIG_EMUL=y CONFIG_I2C=y CONFIG_SPI=y -CONFIG_EMUL_BMI160=y CONFIG_SENSOR=y CONFIG_BMI160_TRIGGER_NONE=y diff --git a/tests/drivers/sensor/akm09918c/prj.conf b/tests/drivers/sensor/akm09918c/prj.conf index a43ed2f056..640be4b7c7 100644 --- a/tests/drivers/sensor/akm09918c/prj.conf +++ b/tests/drivers/sensor/akm09918c/prj.conf @@ -13,4 +13,3 @@ CONFIG_SENSOR=y # Enable emulation CONFIG_EMUL=y -CONFIG_EMUL_AKM09918C=y diff --git a/tests/drivers/sensor/icm42688/prj.conf b/tests/drivers/sensor/icm42688/prj.conf index 9423964812..39b8b60e46 100644 --- a/tests/drivers/sensor/icm42688/prj.conf +++ b/tests/drivers/sensor/icm42688/prj.conf @@ -12,4 +12,3 @@ CONFIG_SENSOR=y # Enable emulation CONFIG_EMUL=y -CONFIG_EMUL_ICM42688=y diff --git a/tests/drivers/sensor/sbs_gauge/boards/native_posix.conf b/tests/drivers/sensor/sbs_gauge/boards/native_posix.conf index 065b1009a4..f8452191db 100644 --- a/tests/drivers/sensor/sbs_gauge/boards/native_posix.conf +++ b/tests/drivers/sensor/sbs_gauge/boards/native_posix.conf @@ -2,6 +2,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_EMUL=y -CONFIG_EMUL_SBS_GAUGE=y -CONFIG_I2C=y -CONFIG_I2C_EMUL=y diff --git a/tests/drivers/sensor/sbs_gauge/boards/qemu_arc_hs.conf b/tests/drivers/sensor/sbs_gauge/boards/qemu_arc_hs.conf index 1ddb17feec..560961ed99 100644 --- a/tests/drivers/sensor/sbs_gauge/boards/qemu_arc_hs.conf +++ b/tests/drivers/sensor/sbs_gauge/boards/qemu_arc_hs.conf @@ -2,6 +2,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_EMUL=y -CONFIG_EMUL_SBS_GAUGE=y -CONFIG_I2C=y -CONFIG_I2C_EMUL=y diff --git a/tests/drivers/sensor/sbs_gauge/boards/qemu_cortex_a9.conf b/tests/drivers/sensor/sbs_gauge/boards/qemu_cortex_a9.conf index 065b1009a4..f8452191db 100644 --- a/tests/drivers/sensor/sbs_gauge/boards/qemu_cortex_a9.conf +++ b/tests/drivers/sensor/sbs_gauge/boards/qemu_cortex_a9.conf @@ -2,6 +2,3 @@ # SPDX-License-Identifier: Apache-2.0 CONFIG_EMUL=y -CONFIG_EMUL_SBS_GAUGE=y -CONFIG_I2C=y -CONFIG_I2C_EMUL=y diff --git a/tests/subsys/emul/prj.conf b/tests/subsys/emul/prj.conf index a3e9bb4279..452d3c4f15 100644 --- a/tests/subsys/emul/prj.conf +++ b/tests/subsys/emul/prj.conf @@ -5,5 +5,4 @@ CONFIG_ZTEST=y CONFIG_ZTEST_NEW_API=y CONFIG_SENSOR=y -CONFIG_EMUL_BMI160=y CONFIG_BMI160_TRIGGER_NONE=y