devicetree: allow access to all nodes

Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-05-06 11:23:07 -07:00 committed by Kumar Gala
commit 7e0eed9235
171 changed files with 496 additions and 433 deletions

View file

@ -13,7 +13,7 @@
#include <logging/log.h>
LOG_MODULE_DECLARE(mpxxdtyy);
#if DT_ANY_INST_ON_BUS(i2s)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s)
#define NUM_RX_BLOCKS 4
#define PDM_BLOCK_MAX_SIZE_BYTES 512
@ -140,4 +140,4 @@ int mpxxdtyy_i2s_configure(struct device *dev, struct dmic_cfg *cfg)
data->state = DMIC_STATE_CONFIGURED;
return 0;
}
#endif /* DT_ANY_INST_ON_BUS(i2s) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) */

View file

@ -141,11 +141,11 @@ int sw_filter_lib_run(TPDMFilter_InitStruct *pdm_filter,
}
static const struct _dmic_ops mpxxdtyy_driver_api = {
#if DT_ANY_INST_ON_BUS(i2s)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s)
.configure = mpxxdtyy_i2s_configure,
.trigger = mpxxdtyy_i2s_trigger,
.read = mpxxdtyy_i2s_read,
#endif /* DT_ANY_INST_ON_BUS(i2s) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) */
};
static int mpxxdtyy_initialize(struct device *dev)

View file

@ -37,12 +37,12 @@ int sw_filter_lib_run(TPDMFilter_InitStruct *pdm_filter,
void *pdm_block, void *pcm_block,
size_t pdm_size, size_t pcm_size);
#if DT_ANY_INST_ON_BUS(i2s)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s)
int mpxxdtyy_i2s_read(struct device *dev, u8_t stream, void **buffer,
size_t *size, s32_t timeout);
int mpxxdtyy_i2s_trigger(struct device *dev, enum dmic_trigger cmd);
int mpxxdtyy_i2s_configure(struct device *dev, struct dmic_cfg *cfg);
#endif /* DT_ANY_INST_ON_BUS(i2s) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2s) */
#ifdef __cplusplus
}