From 30bad729e2bce91bb8825ca43dd18d551715d00f Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 16 Jan 2024 22:10:33 +0100 Subject: [PATCH 1/7] dts: bindings: base: add zephyr,device-type property Add a base zephyr,device-type property for indicating the Zephyr-specific type of device represented by a given binding. Knowing the type of device will allow iterating through a devicetree nodes with the same type at build-time. Signed-off-by: Henrik Brix Andersen --- dts/bindings/base/base.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dts/bindings/base/base.yaml b/dts/bindings/base/base.yaml index b2e670fb5d81b..a89ddb309ab96 100644 --- a/dts/bindings/base/base.yaml +++ b/dts/bindings/base/base.yaml @@ -3,6 +3,10 @@ include: [pm.yaml] properties: + zephyr,device-type: + type: string + description: indicates the device type. + status: type: string description: indicates the operational status of a device From c150003aa599527520674c3d1c5cd2302a79e505 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 16 Jan 2024 22:13:15 +0100 Subject: [PATCH 2/7] scripts: dts: add special tooling for handling zephyr,device-type props Add special devicetree tooling to handle zephyr,device-type properties as the C-preprocessor does not allow for string-comparison. Signed-off-by: Henrik Brix Andersen --- doc/build/dts/macros.bnf | 38 ++++++++++++++++++++++++++++++++++++++ scripts/dts/gen_defines.py | 14 ++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/doc/build/dts/macros.bnf b/doc/build/dts/macros.bnf index f42f483887749..512ca7e5f93cd 100644 --- a/doc/build/dts/macros.bnf +++ b/doc/build/dts/macros.bnf @@ -22,6 +22,8 @@ node-macro = property-macro node-macro =/ pinctrl-macro ; A macro about the GPIO hog properties in a node. node-macro =/ gpiohogs-macro +; A macro about the zephyr,device-type property in a node. +node-macro =/ devicetype-macro ; EXISTS macro: node exists in the devicetree node-macro =/ %s"DT_N" path-id %s"_EXISTS" ; Bus macros: the plain BUS is a way to access a node's bus controller. @@ -222,6 +224,42 @@ gpiohogs-macro =/ %s"DT_N" path-id %s"_GPIO_HOGS_IDX_" DIGIT %s"_VAL_flags_EXIST ; #define DT_N__GPIO_HOGS_IDX_0_VAL_flags 0x30 gpiohogs-macro =/ %s"DT_N" path-id %s"_GPIO_HOGS_IDX_" DIGIT %s"_VAL_flags" +; -------------------------------------------------------------------- +; devicetype-macro: a macro related to zephyr,device-type properties +; +; The following examples assume something like this: +; +; node-1: gpio@... { +; compatible = "vnd,gpio"; +; }; +; +; node-2: adc@... { +; compatible = "vnd,adc"; +; }; +; +; Bindings fragment for the vnd,gpio compatible: +; +; zephyr,device-type: +; default: gpio-controller +; const: gpio-controller +; +; Bindings fragment for the vnd,adc compatible: +; +; zephyr,device-type: +; default: adc-controller +; const: adc-controller + +; The node contains a zephyr,device-type property. +; +; #define DT_N__ZEPHYR_DEVICE_TYPE_EXISTS 1 +; #define DT_N__ZEPHYR_DEVICE_TYPE_EXISTS 1 +devicetype-macro = %s"DT_N" path-id %s"_ZEPHYR_DEVICE_TYPE_EXISTS" +; The node contains a zephyr,device-type property with the given device type. +; +; #define DT_N__ZEPHYR_DEVICE_TYPE_gpio_controller 1 +; #define DT_N__ZEPHYR_DEVICE_TYPE_adc_controller 1 +devicetypes-macro =/ %s"DT_N" path-id %s"_ZEPHYR_DEVICE_TYPE_" device-type + ; -------------------------------------------------------------------- ; property-macro: a macro related to a node property ; diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index b23a4cb76fe2b..70f4744b4e937 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -354,6 +354,9 @@ def write_special_props(node): write_fixed_partitions(node) write_gpio_hogs(node) + # Macros that are special to Zephyr bindings. + write_zephyr_device_type(node) + def write_ranges(node): # ranges property: edtlib knows the right #address-cells and # #size-cells of parent and child, and can therefore pack the @@ -618,6 +621,17 @@ def write_gpio_hogs(node): for macro, val in macro2val.items(): out_dt_define(macro, val) +def write_zephyr_device_type(node): + # Write special macros for zephyr,device-type properties. + + if 'zephyr,device-type' in node.props: + macro = f"{node.z_path_id}_ZEPHYR_DEVICE_TYPE" + device_type = node.props['zephyr,device-type'].val_as_token + + out_comment("Zephyr device type:") + out_dt_define(f"{macro}_EXISTS", 1) + out_dt_define(f"{macro}_{device_type}", 1) + def write_vanilla_props(node): # Writes macros for any and all properties defined in the # "properties" section of the binding for the node. From 3d59bf55c25f230b879ec93ef4aea9c0920de73a Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 16 Jan 2024 22:15:58 +0100 Subject: [PATCH 3/7] dts: bindings: adc: set zephyr,device-type to adc-controller Set the zephyr,device-type for all ADC controllers to "adc-controller". Signed-off-by: Henrik Brix Andersen --- dts/bindings/adc/adc-controller.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dts/bindings/adc/adc-controller.yaml b/dts/bindings/adc/adc-controller.yaml index c52c913d52206..a26b492b1f3cb 100644 --- a/dts/bindings/adc/adc-controller.yaml +++ b/dts/bindings/adc/adc-controller.yaml @@ -7,6 +7,10 @@ include: base.yaml properties: + zephyr,device-type: + default: adc-controller + const: adc-controller + "#io-channel-cells": type: int required: true From fe0f25dfe09e0205b9422eeafd21097780b4e707 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 16 Jan 2024 22:16:53 +0100 Subject: [PATCH 4/7] dts: bindings: gpio: set zephyr,device-type to gpio-controller Set the zephyr,device-type for all GPIO controllers to "gpio-controller". Signed-off-by: Henrik Brix Andersen --- dts/bindings/gpio/gpio-controller.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dts/bindings/gpio/gpio-controller.yaml b/dts/bindings/gpio/gpio-controller.yaml index 38356a368c87f..fd72101b4aeb8 100644 --- a/dts/bindings/gpio/gpio-controller.yaml +++ b/dts/bindings/gpio/gpio-controller.yaml @@ -3,7 +3,12 @@ # Common fields for GPIO controllers +include: base.yaml + properties: + zephyr,device-type: + default: gpio-controller + const: gpio-controller "gpio-controller": type: boolean required: true From 39fdfcd01244e5c0d3ae9f4eb3e6e56ce919d0da Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 16 Jan 2024 22:18:00 +0100 Subject: [PATCH 5/7] devicetree: allow iterating devicetree nodes with identical device-types Allow iterating devicetree nodes with identical zephyr,device-type properties. Signed-off-by: Henrik Brix Andersen --- include/zephyr/devicetree.h | 1 + include/zephyr/devicetree/device_type.h | 145 ++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 include/zephyr/devicetree/device_type.h diff --git a/include/zephyr/devicetree.h b/include/zephyr/devicetree.h index b6a8756c9ca80..ec93ff3eeba9d 100644 --- a/include/zephyr/devicetree.h +++ b/include/zephyr/devicetree.h @@ -4523,6 +4523,7 @@ /** @endcond */ /* have these last so they have access to all previously defined macros */ +#include #include #include #include diff --git a/include/zephyr/devicetree/device_type.h b/include/zephyr/devicetree/device_type.h new file mode 100644 index 0000000000000..18332fd252b48 --- /dev/null +++ b/include/zephyr/devicetree/device_type.h @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024 Vestas Wind Systems A/S + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @file + * @brief Devicetree device type + */ + +#ifndef ZEPHYR_INCLUDE_DEVICETREE_DEVICE_TYPE_H_ +#define ZEPHYR_INCLUDE_DEVICETREE_DEVICE_TYPE_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup devicetree-device-type Devicetree device type + * @ingroup devicetree + * @{ + */ + +/** + * @brief Does a devicetree node have a zephyr,device-type property? + * + * Tests whether a devicetree node has a zephyr,device-type property defined. + * + * @param node_id node identifier + * @return 1 if the node has the zephyr,device-type property, 0 otherwise. + */ +#define DT_NODE_HAS_DEVICE_TYPE(node_id) DT_NODE_HAS_PROP(node_id, zephyr_device_type) + +/** + * @brief Does a devicetree node have a matching zephyr,device-type property? + * + * Tests whether a devicetree node has a zephyr,device-type property matching @p device_type. + * + * @param node_id node identifier + * @param device_type lowercase-and-underscores device type + * @return 1 if the node has a matching zephyr,device-type property, 0 otherwise. + */ +#define DT_NODE_IS_DEVICE_TYPE(node_id, device_type) \ + IS_ENABLED(DT_CAT3(node_id, _ZEPHYR_DEVICE_TYPE_, device_type)) + +/** + * @brief Does a devicetree node have a matching zephyr,device-type property and status `okay`? + * + * Tests whether a devicetree node has a zephyr,device-type property matching @p device_type and + * status `okay` (as usual, a missing status property is treated as status `okay`). + * + * @param node_id node identifier + * @param device_type lowercase-and-underscores device type + * @return 1 if the node has a matching zephyr,device-type property and status `okay`, 0 otherwise. + */ +#define DT_NODE_IS_DEVICE_TYPE_STATUS_OKAY(node_id, device_type) \ + UTIL_AND(DT_NODE_IS_DEVICE_TYPE(node_id, device_type), DT_NODE_HAS_STATUS(node_id, okay)) + +/** + * @cond INTERNAL_HIDDEN + */ + +#define DT_FOREACH_DEVICE_TYPE_NODE_INTERNAL(node_id, device_type, fn) \ + COND_CODE_1(DT_NODE_IS_DEVICE_TYPE(node_id, device_type), (fn(node_id)), ()) + +#define DT_FOREACH_DEVICE_TYPE_NODE_VARGS_INTERNAL(node_id, device_type, fn, ...) \ + COND_CODE_1(DT_NODE_IS_DEVICE_TYPE(node_id, device_type), (fn(node_id, __VA_ARGS__)), ()) + +/** + * INTERNAL_HIDDEN @endcond + */ + +/** + * @brief Invokes @p fn for every node in the tree with a ``zephyr,device-type`` property matching + * @p device_type. + * + * The macro @p fn must take one parameter, which will be a node identifier. The macro is expanded + * once for each node in the tree with a ``zephyr,device-type`` property matching @p + * device_type. The order that nodes are visited in is not specified. + * + * @param device_type lowercase-and-underscores device type + * @param fn macro to invoke + */ +#define DT_FOREACH_DEVICE_TYPE_NODE(device_type, fn) \ + DT_FOREACH_NODE_VARGS(DT_FOREACH_DEVICE_TYPE_NODE_INTERNAL, device_type, fn) + +/** + * @brief Invokes @p fn for every node in the tree with a ``zephyr,device-type`` property matching + * @p device_type with multiple arguments. + * + * The macro @p fn takes multiple arguments. The first should be the node identifier for the + * node. The macro is expanded once for each node in the tree with a ``zephyr,device-type`` property + * matching @p device_type. The order that nodes are visited in is not specified. + * + * @param device_type lowercase-and-underscores device type + * @param fn macro to invoke + */ +#define DT_FOREACH_DEVICE_TYPE_NODE_VARGS(device_type, fn, ...) \ + DT_FOREACH_NODE_VARGS(DT_FOREACH_DEVICE_TYPE_NODE_VARGS_INTERNAL, device_type, fn, \ + __VA_ARGS__) + +/** + * @brief Invokes @p fn for every node in the tree with a ``zephyr,device-type`` property matching + * @p device_type. + * + * The macro @p fn must take one parameter, which will be a node identifier. The macro is expanded + * once for each node in the tree with a ``zephyr,device-type`` property matching @p device_type and + * with status `okay` (as usual, a missing status property is treated as status `okay`). The order + * that nodes are visited in is not specified. + * + * @param device_type lowercase-and-underscores device type + * @param fn macro to invoke + */ +#define DT_FOREACH_DEVICE_TYPE_STATUS_OKAY_NODE(device_type, fn) \ + DT_FOREACH_STATUS_OKAY_NODE_VARGS(DT_FOREACH_DEVICE_TYPE_NODE_INTERNAL, device_type, fn) + +/** + * @brief Invokes @p fn for every node in the tree with a ``zephyr,device-type`` property matching + * @p device_type with multiple arguments. + * + * The macro @p fn takes multiple arguments. The first should be the node identifier for the + * node. The macro is expanded once for each node in the tree with a ``zephyr,device-type`` property + * matching @p device_type and with status `okay` (as usual, a missing status property is treated as + * status `okay`). The order that nodes are visited in is not specified. + * + * @param device_type lowercase-and-underscores device type + * @param fn macro to invoke + */ +#define DT_FOREACH_DEVICE_TYPE_STATUS_OKAY_NODE_VARGS(device_type, fn, ...) \ + DT_FOREACH_STATUS_OKAY_NODE_VARGS(DT_FOREACH_DEVICE_TYPE_NODE_VARGS_INTERNAL, device_type, \ + fn, __VA_ARGS__) + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* ZEPHYR_INCLUDE_DEVICETREE_DEVICE_TYPE_H_ */ From 176e7b0013e670794dfe9c14178433e06d7328ec Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 16 Jan 2024 22:19:58 +0100 Subject: [PATCH 6/7] tests: lib: devicetree: api: add tests for zephyr,device-type props Add tests for the handling of zephyr,device-type properties. Signed-off-by: Henrik Brix Andersen --- tests/lib/devicetree/api/app.overlay | 19 ++++++ .../dts/bindings/test-unique-device-type.yaml | 13 ++++ tests/lib/devicetree/api/src/main.c | 64 ++++++++++++++++++- 3 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 tests/lib/devicetree/api/dts/bindings/test-unique-device-type.yaml diff --git a/tests/lib/devicetree/api/app.overlay b/tests/lib/devicetree/api/app.overlay index 5ee7171d932f8..c96577bed950c 100644 --- a/tests/lib/devicetree/api/app.overlay +++ b/tests/lib/devicetree/api/app.overlay @@ -745,6 +745,25 @@ }; }; }; + + test_unique_device_type_reserved: test_unique_device_type_reserved { + compatible = "test-unique-device-type"; + status = "reserved"; + }; + + test_unique_device_type_disabled: test_unique_device_type_disabled { + compatible = "test-unique-device-type"; + status = "disabled"; + }; + + test_unique_device_type_no_status: test_unique_device_type_no_status { + compatible = "test-unique-device-type"; + }; + + test_unique_device_type_okay: test_unique_device_type_okay { + compatible = "test-unique-device-type"; + status = "okay"; + }; }; test_64 { diff --git a/tests/lib/devicetree/api/dts/bindings/test-unique-device-type.yaml b/tests/lib/devicetree/api/dts/bindings/test-unique-device-type.yaml new file mode 100644 index 0000000000000..06270526ac535 --- /dev/null +++ b/tests/lib/devicetree/api/dts/bindings/test-unique-device-type.yaml @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Vestas Wind Systems A/S +# SPDX-License-Identifier: Apache-2.0 + +description: Test node with unique zephyr,device-type + +compatible: "test-unique-device-type" + +include: base.yaml + +properties: + zephyr,device-type: + default: test-unique-device-type-string + const: test-unique-device-type-string diff --git a/tests/lib/devicetree/api/src/main.c b/tests/lib/devicetree/api/src/main.c index 5c0937dbc28e9..5d3666bf672c4 100644 --- a/tests/lib/devicetree/api/src/main.c +++ b/tests/lib/devicetree/api/src/main.c @@ -76,8 +76,11 @@ #define TEST_DMA_CTLR_1 DT_NODELABEL(test_dma1) #define TEST_DMA_CTLR_2 DT_NODELABEL(test_dma2) -#define TEST_IO_CHANNEL_CTLR_1 DT_NODELABEL(test_adc_1) -#define TEST_IO_CHANNEL_CTLR_2 DT_NODELABEL(test_adc_2) +#define TEST_ADC_1 DT_NODELABEL(test_adc_1) +#define TEST_ADC_2 DT_NODELABEL(test_adc_2) + +#define TEST_IO_CHANNEL_CTLR_1 TEST_ADC_1 +#define TEST_IO_CHANNEL_CTLR_2 TEST_ADC_2 #define TEST_RANGES_PCIE DT_NODELABEL(test_ranges_pcie) #define TEST_RANGES_OTHER DT_NODELABEL(test_ranges_other) @@ -2574,6 +2577,63 @@ ZTEST(devicetree_api, test_same_node) zassert_false(DT_SAME_NODE(TEST_DEADBEEF, TEST_ABCD1234), ""); } +ZTEST(devicetree_api, test_device_type) +{ +#undef MY_FN +#define MY_FN(node_id) 1 + + int num_unique = DT_FOREACH_DEVICE_TYPE_NODE(test_unique_device_type_string, MY_FN) 0; + int num_unique_ok = + DT_FOREACH_DEVICE_TYPE_STATUS_OKAY_NODE(test_unique_device_type_string, MY_FN) 0; +#undef MY_FN + +#undef MY_FN +#define MY_FN(node_id, multiplier) multiplier + + int num_unique_x_10 = + DT_FOREACH_DEVICE_TYPE_NODE_VARGS(test_unique_device_type_string, MY_FN, 10) 0; + int num_unique_ok_x_20 = + DT_FOREACH_DEVICE_TYPE_STATUS_OKAY_NODE_VARGS(test_unique_device_type_string, MY_FN, + 20) 0; +#undef MY_FN + + const int num_unique_expected = 4; + const int num_unique_ok_expected = 2; + + /* DT_NODE_HAS_DEVICE_TYPE */ + zassert_true(DT_NODE_HAS_DEVICE_TYPE(DT_NODELABEL(test_unique_device_type_reserved))); + zassert_true(DT_NODE_HAS_DEVICE_TYPE(DT_NODELABEL(test_unique_device_type_disabled))); + zassert_true(DT_NODE_HAS_DEVICE_TYPE(DT_NODELABEL(test_unique_device_type_no_status))); + zassert_true(DT_NODE_HAS_DEVICE_TYPE(DT_NODELABEL(test_unique_device_type_okay))); + zassert_false(DT_NODE_HAS_DEVICE_TYPE(ZEPHYR_USER)); + + /* DT_NODE_IS_DEVICE_TYPE */ + zassert_true(DT_NODE_IS_DEVICE_TYPE(TEST_ADC_1, adc_controller)); + zassert_true(DT_NODE_IS_DEVICE_TYPE(DT_NODELABEL(disabled_gpio), gpio_controller)); + zassert_true(DT_NODE_IS_DEVICE_TYPE(DT_NODELABEL(reserved_gpio), gpio_controller)); + zassert_true(DT_NODE_IS_DEVICE_TYPE(DT_NODELABEL(test_unique_device_type_okay), + test_unique_device_type_string)); + zassert_false(DT_NODE_IS_DEVICE_TYPE(TEST_ADC_1, gpio_controller)); + + /* DT_NODE_IS_DEVICE_TYPE_STATUS_OKAY */ + zassert_true(DT_NODE_IS_DEVICE_TYPE_STATUS_OKAY(TEST_ADC_1, adc_controller)); + zassert_true(DT_NODE_IS_DEVICE_TYPE_STATUS_OKAY(TEST_GPIO_1, gpio_controller)); + zassert_false(DT_NODE_IS_DEVICE_TYPE_STATUS_OKAY(DT_NODELABEL(disabled_gpio), + gpio_controller)); + zassert_false(DT_NODE_IS_DEVICE_TYPE_STATUS_OKAY(DT_NODELABEL(reserved_gpio), + gpio_controller)); + + /* DT_FOREACH_DEVICE_TYPE_NODE */ + zassert_true(num_unique == num_unique_expected); + + /* DT_FOREACH_DEVICE_TYPE_NODE_VARGS */ + zassert_true(num_unique_x_10 == num_unique_expected * 10); + + /* DT_FOREACH_DEVICE_TYPE_STATUS_OKAY_NODE */ + zassert_true(num_unique_ok == num_unique_ok_expected); + + /* DT_FOREACH_DEVICE_TYPE_STATUS_OKAY_NODE_VARGS */ + zassert_true(num_unique_ok_x_20 == num_unique_ok_expected * 20); +} + ZTEST(devicetree_api, test_pinctrl) { #undef DT_DRV_COMPAT From 466cd14fb6b6ac7aa83990faee58ebb9f7a7136c Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 16 Jan 2024 22:20:51 +0100 Subject: [PATCH 7/7] drivers: adc: shell: iterate all ADC controller devicetree nodes Iterate all ADC controller devicetree nodes instead of hardcoding a list of know compatibles. This makes the ADC shell work with out-of-tree ADC controller bindings/drivers. Signed-off-by: Henrik Brix Andersen --- drivers/adc/adc_shell.c | 69 +---------------------------------------- 1 file changed, 1 insertion(+), 68 deletions(-) diff --git a/drivers/adc/adc_shell.c b/drivers/adc/adc_shell.c index 0b6951d99000f..82eef8ee50ee7 100644 --- a/drivers/adc/adc_shell.c +++ b/drivers/adc/adc_shell.c @@ -11,7 +11,6 @@ #include #include - #define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL #include LOG_MODULE_REGISTER(adc_shell); @@ -74,73 +73,7 @@ static struct adc_hdl { struct adc_channel_cfg channel_config; uint8_t resolution; } adc_list[] = { - /* zephyr-keep-sorted-start */ - DT_FOREACH_STATUS_OKAY(adi_ad559x_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(atmel_sam0_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(atmel_sam_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(atmel_sam_afec, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(espressif_esp32_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(gd_gd32_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(infineon_cat1_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(infineon_xmc4xxx_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ite_it8xxx2_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(lltc_ltc2451, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11102, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11103, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11105, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11106, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11110, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11111, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11115, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11116, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11117, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11253, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(maxim_max11254, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(microchip_mcp3204, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(microchip_mcp3208, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(microchip_xec_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nordic_nrf_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nordic_nrf_saadc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nuvoton_npcx_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nuvoton_numaker_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nxp_kinetis_adc12, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nxp_kinetis_adc16, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nxp_lpc_lpadc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nxp_mcux_12b1msps_sar, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nxp_s32_adc_sar, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(nxp_vf610_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(raspberrypi_pico_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(renesas_smartbond_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(renesas_smartbond_sdadc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(silabs_gecko_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(silabs_gecko_iadc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(st_stm32_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(st_stm32f1_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(st_stm32f4_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(telink_b91_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads1013, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads1014, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads1015, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads1112, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads1113, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads1114, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads1115, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads1119, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads114s08, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_ads7052, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_cc13xx_cc26xx_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_cc32xx_adc, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_lmp90077, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_lmp90078, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_lmp90079, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_lmp90080, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_lmp90097, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_lmp90098, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_lmp90099, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_lmp90100, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(ti_tla2021, ADC_HDL_LIST_ENTRY) - DT_FOREACH_STATUS_OKAY(zephyr_adc_emul, ADC_HDL_LIST_ENTRY) - /* zephyr-keep-sorted-stop */ + DT_FOREACH_DEVICE_TYPE_STATUS_OKAY_NODE(adc_controller, ADC_HDL_LIST_ENTRY) }; static struct adc_hdl *get_adc(const char *device_label)