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
parent e96ca54fd8
commit 7e0eed9235
171 changed files with 496 additions and 433 deletions

View file

@ -123,7 +123,7 @@ static int frdm_k64f_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));
#endif

View file

@ -34,7 +34,7 @@ static int frdm_k82f_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
/* Red, green, blue LEDs as PWM channels */
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));

View file

@ -31,7 +31,7 @@ static int hexiwear_k64_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
/* Red, green, blue LEDs as PWM channels */
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));

View file

@ -24,7 +24,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
/* USART0 RX, TX */
const u32_t port0_pin0_config = (
IOCON_PIO_FUNC1 |
@ -109,7 +109,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
/* PORT0 PIN25 is configured as FC4_RTS_SCL_SSEL1 */
pinmux_pin_set(port0, 25, IOCON_PIO_FUNC1 |
IOCON_PIO_I2CSLEW_I2C |
@ -130,7 +130,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm5)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm5), nxp_lpc_spi)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm5), nxp_lpc_spi)
/* PORT0 PIN18 is configured as FC5_TXD_SCL_MISO */
pinmux_pin_set(port0, 18, IOCON_PIO_FUNC1 |
IOCON_PIO_MODE_PULLUP |

View file

@ -96,7 +96,7 @@ static int lpcxpresso_55s16_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
/* USART0 RX, TX */
const u32_t port0_pin29_config = (
IOCON_PIO_FUNC1 |
@ -119,7 +119,7 @@ static int lpcxpresso_55s16_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
/* PORT1 PIN20 is configured as FC4_TXD_SCL_MISO_WS */
pinmux_pin_set(port1, 20, IOCON_PIO_FUNC5 |
IOCON_PIO_MODE_INACT |

View file

@ -24,7 +24,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm0)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
/* USART0 RX, TX */
const u32_t port0_pin29_config = (
IOCON_PIO_FUNC1 |
@ -90,7 +90,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
/* PORT1 PIN20 is configured as FC4_TXD_SCL_MISO_WS */
pinmux_pin_set(port1, 20, IOCON_PIO_FUNC5 |
IOCON_PIO_MODE_INACT |

View file

@ -35,7 +35,7 @@ static int twr_ke18f_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm0)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm0), nxp_kinetis_ftm_pwm)
/* Tri-color LED as PWM */
pinmux_pin_set(portb, 5, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portd, 15, PORT_PCR_MUX(kPORT_MuxAlt2));
@ -48,7 +48,7 @@ static int twr_ke18f_pinmux_init(struct device *dev)
#endif
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(ftm3)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm)
/* User LEDs as PWM */
pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portc, 11, PORT_PCR_MUX(kPORT_MuxAlt2));

View file

@ -386,10 +386,10 @@ enabled instance. Currently, this looks like this:
&my_dev_data_##inst, \
&my_dev_cfg_##inst, \
MY_DEV_INIT_LEVEL, MY_DEV_INIT_PRIORITY, \
&my_api_funcs)
&my_api_funcs);
/* Call the device creation macro for every compatible node: */
DT_INST_FOREACH(CREATE_MY_DEVICE);
DT_INST_FOREACH_STATUS_OKAY(CREATE_MY_DEVICE)
Notice the use of :c:func:`DT_INST_PROP` and :c:func:`DT_INST_FOREACH`.
These are helpers which rely on ``DT_DRV_COMPAT`` to choose devicetree nodes

View file

@ -1116,55 +1116,55 @@ static const struct adc_driver_api lmp90xxx_adc_api = {
/*
* LMP90077: 16 bit, 2 diff/4 se (4 channels), 0 currents
*/
#if DT_HAS_COMPAT(ti_lmp90077)
#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90077)
LMP90XXX_DEVICE(90077, 0, 16, 4);
#endif
/*
* LMP90078: 16 bit, 2 diff/4 se (4 channels), 2 currents
*/
#if DT_HAS_COMPAT(ti_lmp90078)
#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90078)
LMP90XXX_DEVICE(90078, 0, 16, 4);
#endif
/*
* LMP90079: 16 bit, 4 diff/7 se (7 channels), 0 currents, has VIN3-5
*/
#if DT_HAS_COMPAT(ti_lmp90079)
#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90079)
LMP90XXX_DEVICE(90079, 0, 16, 7);
#endif
/*
* LMP90080: 16 bit, 4 diff/7 se (7 channels), 2 currents, has VIN3-5
*/
#if DT_HAS_COMPAT(ti_lmp90080)
#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90080)
LMP90XXX_DEVICE(90080, 0, 16, 7);
#endif
/*
* LMP90097: 24 bit, 2 diff/4 se (4 channels), 0 currents
*/
#if DT_HAS_COMPAT(ti_lmp90097)
#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90097)
LMP90XXX_DEVICE(90097, 0, 24, 4);
#endif
/*
* LMP90098: 24 bit, 2 diff/4 se (4 channels), 2 currents
*/
#if DT_HAS_COMPAT(ti_lmp90098)
#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90098)
LMP90XXX_DEVICE(90098, 0, 24, 4);
#endif
/*
* LMP90099: 24 bit, 4 diff/7 se (7 channels), 0 currents, has VIN3-5
*/
#if DT_HAS_COMPAT(ti_lmp90099)
#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90099)
LMP90XXX_DEVICE(90099, 0, 24, 7);
#endif
/*
* LMP90100: 24 bit, 4 diff/7 se (7 channels), 2 currents, has VIN3-5
*/
#if DT_HAS_COMPAT(ti_lmp90100)
#if DT_HAS_COMPAT_STATUS_OKAY(ti_lmp90100)
LMP90XXX_DEVICE(90100, 0, 24, 7);
#endif

View file

@ -365,8 +365,9 @@ static const struct adc_driver_api mcp320x_adc_api = {
#define CALL_WITH_ARG(arg, expr) expr(arg);
#define INST_DT_MCP320X_FOREACH(t, inst_expr) \
UTIL_LISTIFY(DT_NUM_INST(microchip_mcp##t), CALL_WITH_ARG, inst_expr)
#define INST_DT_MCP320X_FOREACH(t, inst_expr) \
UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(microchip_mcp##t), \
CALL_WITH_ARG, inst_expr)
INST_DT_MCP320X_FOREACH(3204, MCP3204_DEVICE);
INST_DT_MCP320X_FOREACH(3208, MCP3208_DEVICE);

View file

@ -299,4 +299,4 @@ static const struct adc_driver_api mcux_adc12_driver_api = {
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(ACD12_MCUX_INIT)
DT_INST_FOREACH_STATUS_OKAY(ACD12_MCUX_INIT)

View file

@ -304,4 +304,4 @@ static const struct adc_driver_api mcux_adc16_driver_api = {
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(ACD16_MCUX_INIT)
DT_INST_FOREACH_STATUS_OKAY(ACD16_MCUX_INIT)

View file

@ -296,4 +296,4 @@ static const struct adc_driver_api adc_nrfx_driver_api = {
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&adc_nrfx_driver_api);
DT_INST_FOREACH(ADC_INIT)
DT_INST_FOREACH_STATUS_OKAY(ADC_INIT)

View file

@ -439,4 +439,4 @@ static const struct adc_driver_api adc_nrfx_driver_api = {
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&adc_nrfx_driver_api);
DT_INST_FOREACH(SAADC_INIT)
DT_INST_FOREACH_STATUS_OKAY(SAADC_INIT)

View file

@ -617,4 +617,4 @@ do { \
ADC_SAM0_CONFIGURE(n); \
}
DT_INST_FOREACH(ADC_SAM0_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(ADC_SAM0_DEVICE)

View file

@ -379,4 +379,4 @@ static void adc_sam_isr(void *arg)
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(ADC_SAM_INIT)
DT_INST_FOREACH_STATUS_OKAY(ADC_SAM_INIT)

View file

@ -10,21 +10,21 @@
#include <ctype.h>
#include <sys/util.h>
#if DT_HAS_COMPAT(atmel_sam_afec)
#if DT_HAS_COMPAT_STATUS_OKAY(atmel_sam_afec)
#define DT_DRV_COMPAT atmel_sam_afec
#elif DT_HAS_COMPAT(atmel_sam0_adc)
#elif DT_HAS_COMPAT_STATUS_OKAY(atmel_sam0_adc)
#define DT_DRV_COMPAT atmel_sam0_adc
#elif DT_HAS_COMPAT(microchip_xec_adc)
#elif DT_HAS_COMPAT_STATUS_OKAY(microchip_xec_adc)
#define DT_DRV_COMPAT microchip_xec_adc
#elif DT_HAS_COMPAT(nordic_nrf_adc)
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_adc)
#define DT_DRV_COMPAT nordic_nrf_adc
#elif DT_HAS_COMPAT(nordic_nrf_saadc)
#elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_saadc)
#define DT_DRV_COMPAT nordic_nrf_saadc
#elif DT_HAS_COMPAT(nxp_kinetis_adc12)
#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_adc12)
#define DT_DRV_COMPAT nxp_kinetis_adc12
#elif DT_HAS_COMPAT(nxp_kinetis_adc16)
#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_kinetis_adc16)
#define DT_DRV_COMPAT nxp_kinetis_adc16
#elif DT_HAS_COMPAT(st_stm32_adc)
#elif DT_HAS_COMPAT_STATUS_OKAY(st_stm32_adc)
#define DT_DRV_COMPAT st_stm32_adc
#else
#error No known devicetree compatible match for ADC shell

View file

@ -738,4 +738,4 @@ static void adc_stm32_cfg_func_##index(void) \
irq_enable(DT_INST_IRQN(index)); \
}
DT_INST_FOREACH(STM32_ADC_INIT)
DT_INST_FOREACH_STATUS_OKAY(STM32_ADC_INIT)

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
}

View file

@ -21,9 +21,9 @@ LOG_MODULE_DECLARE(can_driver, CONFIG_CAN_LOG_LEVEL);
#define CAN_INIT_TIMEOUT (10 * sys_clock_hw_cycles_per_sec() / MSEC_PER_SEC)
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can1)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(can1), st_stm32_can) && \
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can) && \
DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can2)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(can2), st_stm32_can)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can)
#error Simultaneous use of CAN_1 and CAN_2 not supported yet
#endif
@ -1048,7 +1048,7 @@ static const struct can_driver_api can_api_funcs = {
};
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can1)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(can1), st_stm32_can)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can1), st_stm32_can)
static void config_can_1_irq(CAN_TypeDef *can);
@ -1138,7 +1138,7 @@ NET_DEVICE_INIT(socket_can_stm32_1, SOCKET_CAN_NAME_1, socket_can_init_1,
#endif /* DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can1)) */
#if DT_HAS_NODE_STATUS_OKAY(DT_NODELABEL(can2)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(can2), st_stm32_can)
DT_NODE_HAS_COMPAT_STATUS_OKAY(DT_NODELABEL(can2), st_stm32_can)
static void config_can_2_irq(CAN_TypeDef *can);

View file

@ -79,4 +79,4 @@ static const struct clock_control_driver_api mcux_pcc_api = {
CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \
&mcux_pcc_api);
DT_INST_FOREACH(MCUX_PCC_INIT)
DT_INST_FOREACH_STATUS_OKAY(MCUX_PCC_INIT)

View file

@ -72,4 +72,4 @@ static const struct clock_control_driver_api rv32m1_pcc_api = {
CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, \
&rv32m1_pcc_api);
DT_INST_FOREACH(RV32M1_PCC_INIT)
DT_INST_FOREACH_STATUS_OKAY(RV32M1_PCC_INIT)

View file

@ -178,4 +178,4 @@ static int imx_epit_config_func_##idx(struct device *dev) \
return 0; \
}
DT_INST_FOREACH(COUNTER_IMX_EPIT_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(COUNTER_IMX_EPIT_DEVICE)

View file

@ -347,4 +347,4 @@ static int counter_xec_init(struct device *dev)
irq_enable(DT_INST_IRQN(inst)); \
}
DT_INST_FOREACH(COUNTER_XEC_INIT)
DT_INST_FOREACH_STATUS_OKAY(COUNTER_XEC_INIT)

View file

@ -234,4 +234,4 @@ static const struct counter_driver_api mcux_gpt_driver_api = {
return mcux_gpt_init(dev); \
} \
DT_INST_FOREACH(GPT_DEVICE_INIT_MCUX)
DT_INST_FOREACH_STATUS_OKAY(GPT_DEVICE_INIT_MCUX)

View file

@ -204,7 +204,7 @@ static const struct counter_driver_api mcux_lptmr_driver_api = {
* This driver is single-instance. If the devicetree contains multiple
* instances, this will fail and the driver needs to be revisited.
*/
BUILD_ASSERT(DT_NUM_INST(DT_DRV_COMPAT) <= 1,
BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1,
"unsupported lptmr instance");
#if DT_HAS_NODE_STATUS_OKAY(DT_DRV_INST(0))

View file

@ -457,4 +457,4 @@ static const struct counter_driver_api counter_sam0_tc32_driver_api = {
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(COUNTER_SAM0_TC32_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(COUNTER_SAM0_TC32_DEVICE)

View file

@ -217,4 +217,4 @@ static int dtmr_cmsdk_apb_init(struct device *dev)
irq_enable(DT_INST_IRQN(inst)); \
}
DT_INST_FOREACH(DTIMER_CMSDK_INIT)
DT_INST_FOREACH_STATUS_OKAY(DTIMER_CMSDK_INIT)

View file

@ -204,4 +204,4 @@ static int tmr_cmsdk_apb_init(struct device *dev)
irq_enable(DT_INST_IRQN(inst)); \
}
DT_INST_FOREACH(TIMER_CMSDK_INIT)
DT_INST_FOREACH_STATUS_OKAY(TIMER_CMSDK_INIT)

View file

@ -110,4 +110,4 @@ static const struct dac_driver_api mcux_dac_driver_api = {
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\
&mcux_dac_driver_api);
DT_INST_FOREACH(MCUX_DAC_INIT)
DT_INST_FOREACH_STATUS_OKAY(MCUX_DAC_INIT)

View file

@ -113,4 +113,4 @@ static const struct dac_driver_api mcux_dac32_driver_api = {
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\
&mcux_dac32_driver_api);
DT_INST_FOREACH(MCUX_DAC32_INIT)
DT_INST_FOREACH_STATUS_OKAY(MCUX_DAC32_INIT)

View file

@ -148,4 +148,4 @@ DEVICE_AND_API_INIT(dac_##index, DT_INST_LABEL(index), \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&api_stm32_driver_api);
DT_INST_FOREACH(STM32_DAC_INIT)
DT_INST_FOREACH_STATUS_OKAY(STM32_DAC_INIT)

View file

@ -425,4 +425,4 @@ static const struct dma_driver_api dw_dma_driver_api = {
irq_enable(DT_INST_IRQN(inst)); \
}
DT_INST_FOREACH(DW_DMAC_INIT)
DT_INST_FOREACH_STATUS_OKAY(DW_DMAC_INIT)

View file

@ -212,4 +212,4 @@ DEVICE_AND_API_INIT(dmamux_##index, DT_INST_LABEL(index), \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,\
&dma_funcs);
DT_INST_FOREACH(DMAMUX_INIT)
DT_INST_FOREACH_STATUS_OKAY(DMAMUX_INIT)

View file

@ -602,7 +602,8 @@ static const struct eeprom_driver_api eeprom_at2x_api = {
#define CALL_WITH_ARG(arg, expr) expr(arg);
#define INST_DT_AT2X_FOREACH(t, inst_expr) \
UTIL_LISTIFY(DT_NUM_INST(atmel_at##t), CALL_WITH_ARG, inst_expr)
UTIL_LISTIFY(DT_NUM_INST_STATUS_OKAY(atmel_at##t), \
CALL_WITH_ARG, inst_expr)
#ifdef CONFIG_EEPROM_AT24
INST_DT_AT2X_FOREACH(24, EEPROM_AT24_DEVICE);

View file

@ -312,4 +312,4 @@ static const struct gpio_driver_api api_funcs = {
\
GPIO_CC32XX_DEVICE_INIT(n);
DT_INST_FOREACH(GPIO_CC32XX_INIT)
DT_INST_FOREACH_STATUS_OKAY(GPIO_CC32XX_INIT)

View file

@ -306,4 +306,4 @@ static int gpio_cmsdk_ahb_init(struct device *dev)
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(CMSDK_AHB_GPIO_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(CMSDK_AHB_GPIO_DEVICE)

View file

@ -360,4 +360,4 @@ static int gpio_gecko_port##idx##_init(struct device *dev) \
return 0; \
}
DT_INST_FOREACH(GPIO_PORT_INIT)
DT_INST_FOREACH_STATUS_OKAY(GPIO_PORT_INIT)

View file

@ -217,4 +217,4 @@ static const struct gpio_driver_api gpio_ht16k33_api = {
CONFIG_GPIO_HT16K33_INIT_PRIORITY, \
&gpio_ht16k33_api);
DT_INST_FOREACH(GPIO_HT16K33_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(GPIO_HT16K33_DEVICE)

View file

@ -277,4 +277,4 @@ static const struct gpio_driver_api imx_gpio_driver_api = {
return 0; \
}
DT_INST_FOREACH(GPIO_IMX_INIT)
DT_INST_FOREACH_STATUS_OKAY(GPIO_IMX_INIT)

View file

@ -602,4 +602,4 @@ DEVICE_AND_API_INIT(gpio_intel_apl_##n, \
&gpio_intel_apl_api);
/* "sub" devices. no more than GPIO_INTEL_APL_NR_SUBDEVS of these! */
DT_INST_FOREACH(GPIO_INTEL_APL_DEV_CFG_DATA)
DT_INST_FOREACH_STATUS_OKAY(GPIO_INTEL_APL_DEV_CFG_DATA)

View file

@ -239,4 +239,4 @@ static const struct gpio_driver_api gpio_litex_driver_api = {
&gpio_litex_driver_api \
);
DT_INST_FOREACH(GPIO_LITEX_INIT)
DT_INST_FOREACH_STATUS_OKAY(GPIO_LITEX_INIT)

View file

@ -185,4 +185,4 @@ BUILD_ASSERT(CONFIG_GPIO_LMP90XXX_INIT_PRIORITY >
CONFIG_GPIO_LMP90XXX_INIT_PRIORITY, \
&gpio_lmp90xxx_api);
DT_INST_FOREACH(GPIO_LMP90XXX_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(GPIO_LMP90XXX_DEVICE)

View file

@ -440,4 +440,4 @@ static int mcp23s17_init(struct device *dev)
CONFIG_GPIO_MCP23S17_INIT_PRIORITY, \
&api_table);
DT_INST_FOREACH(MCP23S17_INIT)
DT_INST_FOREACH_STATUS_OKAY(MCP23S17_INIT)

View file

@ -318,4 +318,4 @@ static const struct gpio_driver_api gpio_mcux_driver_api = {
return 0; \
}
DT_INST_FOREACH(GPIO_DEVICE_INIT_MCUX)
DT_INST_FOREACH_STATUS_OKAY(GPIO_DEVICE_INIT_MCUX)

View file

@ -264,4 +264,4 @@ static const struct gpio_driver_api mcux_igpio_driver_api = {
return 0; \
}
DT_INST_FOREACH(MCUX_IGPIO_INIT)
DT_INST_FOREACH_STATUS_OKAY(MCUX_IGPIO_INIT)

View file

@ -516,4 +516,4 @@ DEVICE_AND_API_INIT(gpio_pca95xx_##inst, \
POST_KERNEL, CONFIG_GPIO_PCA95XX_INIT_PRIORITY, \
&gpio_pca95xx_drv_api_funcs);
DT_INST_FOREACH(GPIO_PCA95XX_DEVICE_INSTANCE)
DT_INST_FOREACH_STATUS_OKAY(GPIO_PCA95XX_DEVICE_INSTANCE)

View file

@ -363,4 +363,4 @@ static const struct gpio_driver_api gpio_rv32m1_driver_api = {
return 0; \
}
DT_INST_FOREACH(GPIO_RV32M1_INIT)
DT_INST_FOREACH_STATUS_OKAY(GPIO_RV32M1_INIT)

View file

@ -357,4 +357,4 @@ int gpio_sam_init(struct device *dev)
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(GPIO_SAM_INIT)
DT_INST_FOREACH_STATUS_OKAY(GPIO_SAM_INIT)

View file

@ -287,4 +287,4 @@ static const struct gpio_driver_api gpio_stellaris_driver_api = {
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(STELLARIS_GPIO_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(STELLARIS_GPIO_DEVICE)

View file

@ -184,4 +184,4 @@ DEVICE_AND_API_INIT(i2c_gpio_##_num, DT_INST_LABEL(_num), \
&i2c_gpio_dev_cfg_##_num, \
PRE_KERNEL_2, CONFIG_I2C_INIT_PRIORITY, &api);
DT_INST_FOREACH(DEFINE_I2C_GPIO)
DT_INST_FOREACH_STATUS_OKAY(DEFINE_I2C_GPIO)

View file

@ -387,4 +387,4 @@ static const struct i2c_driver_api i2c_imx_driver_api = {
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(I2C_IMX_INIT)
DT_INST_FOREACH_STATUS_OKAY(I2C_IMX_INIT)

View file

@ -136,4 +136,4 @@ static const struct i2c_driver_api i2c_litex_driver_api = {
&i2c_litex_driver_api \
);
DT_INST_FOREACH(I2C_LITEX_INIT)
DT_INST_FOREACH_STATUS_OKAY(I2C_LITEX_INIT)

View file

@ -429,4 +429,4 @@ static int i2c_xec_init(struct device *dev)
POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \
&i2c_xec_driver_api);
DT_INST_FOREACH(I2C_XEC_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(I2C_XEC_DEVICE)

View file

@ -232,4 +232,4 @@ static const struct i2c_driver_api i2c_mcux_driver_api = {
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(I2C_DEVICE_INIT_MCUX)
DT_INST_FOREACH_STATUS_OKAY(I2C_DEVICE_INIT_MCUX)

View file

@ -225,4 +225,4 @@ static const struct i2c_driver_api mcux_flexcomm_driver_api = {
irq_enable(DT_INST_IRQN(id)); \
} \
DT_INST_FOREACH(I2C_MCUX_FLEXCOMM_DEVICE);
DT_INST_FOREACH_STATUS_OKAY(I2C_MCUX_FLEXCOMM_DEVICE)

View file

@ -254,4 +254,4 @@ static const struct i2c_driver_api mcux_lpi2c_driver_api = {
irq_enable(DT_INST_IRQN(n)); \
}
DT_INST_FOREACH(I2C_MCUX_LPI2C_INIT)
DT_INST_FOREACH_STATUS_OKAY(I2C_MCUX_LPI2C_INIT)

View file

@ -296,4 +296,4 @@ static const struct i2c_driver_api rv32m1_lpi2c_driver_api = {
irq_enable(DT_INST_IRQN(id)); \
} \
DT_INST_FOREACH(RV32M1_LPI2C_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(RV32M1_LPI2C_DEVICE)

View file

@ -804,4 +804,4 @@ static const struct i2c_sam0_dev_config i2c_sam0_dev_config_##n = { \
&i2c_sam0_driver_api); \
I2C_SAM0_IRQ_HANDLER(n)
DT_INST_FOREACH(I2C_SAM0_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(I2C_SAM0_DEVICE)

View file

@ -369,4 +369,4 @@ static const struct i2c_driver_api i2c_sam_twi_driver_api = {
POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \
&i2c_sam_twi_driver_api);
DT_INST_FOREACH(I2C_TWI_SAM_INIT)
DT_INST_FOREACH_STATUS_OKAY(I2C_TWI_SAM_INIT)

View file

@ -356,4 +356,4 @@ static const struct i2c_driver_api i2c_sam_twihs_driver_api = {
POST_KERNEL, CONFIG_I2C_INIT_PRIORITY, \
&i2c_sam_twihs_driver_api);
DT_INST_FOREACH(I2C_TWIHS_SAM_INIT)
DT_INST_FOREACH_STATUS_OKAY(I2C_TWIHS_SAM_INIT)

View file

@ -122,4 +122,4 @@ DEVICE_AND_API_INIT(i2c_sbcon_##_num, DT_INST_LABEL(_num), \
&i2c_sbcon_dev_cfg_##_num, \
PRE_KERNEL_2, CONFIG_I2C_INIT_PRIORITY, &api);
DT_INST_FOREACH(DEFINE_I2C_SBCON)
DT_INST_FOREACH_STATUS_OKAY(DEFINE_I2C_SBCON)

View file

@ -338,4 +338,4 @@ static struct i2c_driver_api i2c_sifive_api = {
CONFIG_I2C_INIT_PRIORITY, \
&i2c_sifive_api);
DT_INST_FOREACH(I2C_SIFIVE_INIT)
DT_INST_FOREACH_STATUS_OKAY(I2C_SIFIVE_INIT)

View file

@ -229,4 +229,4 @@ static int i2c_eeprom_slave_init(struct device *dev)
CONFIG_I2C_SLAVE_INIT_PRIORITY, \
&api_funcs);
DT_INST_FOREACH(I2C_EEPROM_INIT)
DT_INST_FOREACH_STATUS_OKAY(I2C_EEPROM_INIT)

View file

@ -930,4 +930,4 @@ static struct ieee802154_radio_api rf2xx_radio_api = {
(IEEE802154_RF2XX_RAW_DEVICE_INIT(inst);), \
(IEEE802154_RF2XX_NET_DEVICE_INIT(inst);))
DT_INST_FOREACH(IEEE802154_RF2XX_INIT)
DT_INST_FOREACH_STATUS_OKAY(IEEE802154_RF2XX_INIT)

View file

@ -152,4 +152,4 @@ static const struct irq_next_level_api cavs_apis = {
DT_INST_IRQ(n, sense)); \
}
DT_INST_FOREACH(CAVS_ICTL_INIT)
DT_INST_FOREACH_STATUS_OKAY(CAVS_ICTL_INIT)

View file

@ -501,6 +501,6 @@ static const struct led_driver_api ht16k33_leds_api = {
#define HT16K33_INSTANTIATE(id) \
COND_CODE_1(DT_INST_NODE_HAS_PROP(id, irq_gpios), \
(HT16K33_DEVICE_WITH_IRQ(id)), \
(HT16K33_DEVICE(id)))
(HT16K33_DEVICE(id)));
DT_INST_FOREACH(HT16K33_INSTANTIATE);
DT_INST_FOREACH_STATUS_OKAY(HT16K33_INSTANTIATE)

View file

@ -240,4 +240,4 @@ static const struct led_strip_driver_api ws2812_gpio_api = {
CONFIG_LED_STRIP_INIT_PRIORITY, \
&ws2812_gpio_api);
DT_INST_FOREACH(WS2812_GPIO_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(WS2812_GPIO_DEVICE)

View file

@ -230,4 +230,4 @@ static const struct led_strip_driver_api ws2812_spi_api = {
CONFIG_LED_STRIP_INIT_PRIORITY, \
&ws2812_spi_api);
DT_INST_FOREACH(WS2812_SPI_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(WS2812_SPI_DEVICE)

View file

@ -78,4 +78,4 @@ static const struct pinmux_driver_api pinmux_rv32m1_driver_api = {
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
&pinmux_rv32m1_driver_api);
DT_INST_FOREACH(PINMUX_RV32M1_INIT)
DT_INST_FOREACH_STATUS_OKAY(PINMUX_RV32M1_INIT)

View file

@ -172,7 +172,7 @@ static const struct pwm_driver_api imx_pwm_driver_api = {
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&imx_pwm_driver_api);
#if DT_HAS_COMPAT(fsl_imx7d_pwm)
#if DT_HAS_COMPAT_STATUS_OKAY(fsl_imx7d_pwm)
#define DT_DRV_COMPAT fsl_imx7d_pwm
DT_INST_FOREACH(PWM_IMX_INIT)
DT_INST_FOREACH_STATUS_OKAY(PWM_IMX_INIT)
#endif

View file

@ -113,4 +113,4 @@ static const struct pwm_driver_api pwm_litex_driver_api = {
&pwm_litex_driver_api \
);
DT_INST_FOREACH(PWM_LITEX_INIT)
DT_INST_FOREACH_STATUS_OKAY(PWM_LITEX_INIT)

View file

@ -396,4 +396,4 @@ static struct pwm_driver_api pwm_xec_api = {
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&pwm_xec_api);
DT_INST_FOREACH(XEC_INST_INIT)
DT_INST_FOREACH_STATUS_OKAY(XEC_INST_INIT)

View file

@ -171,4 +171,4 @@ static const struct pwm_driver_api pwm_mcux_driver_api = {
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\
&pwm_mcux_driver_api);
DT_INST_FOREACH(PWM_DEVICE_INIT_MCUX)
DT_INST_FOREACH_STATUS_OKAY(PWM_DEVICE_INIT_MCUX)

View file

@ -172,4 +172,4 @@ static const struct pwm_driver_api mcux_ftm_driver_api = {
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&mcux_ftm_driver_api);
DT_INST_FOREACH(FTM_DEVICE);
DT_INST_FOREACH_STATUS_OKAY(FTM_DEVICE)

View file

@ -201,4 +201,4 @@ static const struct pwm_driver_api mcux_tpm_driver_api = {
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&mcux_tpm_driver_api);
DT_INST_FOREACH(TPM_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(TPM_DEVICE)

View file

@ -200,4 +200,4 @@ static const struct pwm_driver_api rv32m1_tpm_driver_api = {
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&rv32m1_tpm_driver_api);
DT_INST_FOREACH(TPM_DEVICE)
DT_INST_FOREACH_STATUS_OKAY(TPM_DEVICE)

View file

@ -113,4 +113,4 @@ static const struct pwm_driver_api sam_pwm_driver_api = {
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
&sam_pwm_driver_api);
DT_INST_FOREACH(SAM_INST_INIT)
DT_INST_FOREACH_STATUS_OKAY(SAM_INST_INIT)

View file

@ -238,4 +238,4 @@ static const struct pwm_driver_api pwm_sifive_api = {
CONFIG_PWM_SIFIVE_INIT_PRIORITY, \
&pwm_sifive_api);
DT_INST_FOREACH(PWM_SIFIVE_INIT)
DT_INST_FOREACH_STATUS_OKAY(PWM_SIFIVE_INIT)

View file

@ -275,4 +275,4 @@ static int pwm_stm32_init(struct device *dev)
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\
&pwm_stm32_drv_api_funcs);
DT_INST_FOREACH(PWM_DEVICE_INIT_STM32)
DT_INST_FOREACH_STATUS_OKAY(PWM_DEVICE_INIT_STM32)

View file

@ -22,12 +22,12 @@
#define DT_DRV_COMPAT bosch_bme280
#define BME280_BUS_SPI DT_ANY_INST_ON_BUS(spi)
#define BME280_BUS_I2C DT_ANY_INST_ON_BUS(i2c)
#define BME280_BUS_SPI DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
#define BME280_BUS_I2C DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
LOG_MODULE_REGISTER(BME280, CONFIG_SENSOR_LOG_LEVEL);
#if DT_NUM_INST(DT_DRV_COMPAT) == 0
#if DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 0
#warning "BME280 driver enabled without any devices"
#endif
@ -595,7 +595,7 @@ done:
&bme280_config_##inst, \
POST_KERNEL, \
CONFIG_SENSOR_INIT_PRIORITY, \
&bme280_api_funcs)
&bme280_api_funcs);
/*
* Instantiation macros used when a device is on a SPI bus.
@ -676,4 +676,4 @@ done:
(BME280_DEFINE_SPI(inst)), \
(BME280_DEFINE_I2C(inst)))
DT_INST_FOREACH(BME280_DEFINE);
DT_INST_FOREACH_STATUS_OKAY(BME280_DEFINE)

View file

@ -630,4 +630,4 @@ static const struct sensor_driver_api bq274xx_battery_driver_api = {
CONFIG_SENSOR_INIT_PRIORITY, \
&bq274xx_battery_driver_api);
DT_INST_FOREACH(BQ274XX_INIT)
DT_INST_FOREACH_STATUS_OKAY(BQ274XX_INIT)

View file

@ -16,9 +16,9 @@
#include <logging/log.h>
#include <drivers/sensor.h>
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
#include <drivers/spi.h>
#elif DT_ANY_INST_ON_BUS(i2c)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
#include <drivers/i2c.h>
#endif
@ -222,9 +222,9 @@ static int iis2dlpc_init_interface(struct device *dev)
return -EINVAL;
}
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
iis2dlpc_spi_init(dev);
#elif DT_ANY_INST_ON_BUS(i2c)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
iis2dlpc_i2c_init(dev);
#else
#error "BUS MACRO NOT DEFINED IN DTS"

View file

@ -16,7 +16,7 @@
#include "iis2dlpc.h"
#if DT_ANY_INST_ON_BUS(i2c)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
static u16_t iis2dlpc_i2c_slave_addr = DT_INST_REG_ADDR(0);
@ -50,4 +50,4 @@ int iis2dlpc_i2c_init(struct device *dev)
return 0;
}
#endif /* DT_ANY_INST_ON_BUS(i2c) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */

View file

@ -15,7 +15,7 @@
#include "iis2dlpc.h"
#include <logging/log.h>
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
#define IIS2DLPC_SPI_READ (1 << 7)
@ -125,4 +125,4 @@ int iis2dlpc_spi_init(struct device *dev)
return 0;
}
#endif /* DT_ANY_INST_ON_BUS(spi) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */

View file

@ -263,7 +263,7 @@ static const struct iis2mdc_config iis2mdc_dev_config = {
.drdy_pin = DT_INST_GPIO_PIN(0, drdy_gpios),
.drdy_flags = DT_INST_GPIO_FLAGS(0, drdy_gpios),
#endif /* CONFIG_IIS2MDC_TRIGGER */
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
.bus_init = iis2mdc_spi_init,
.spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency),
.spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL |
@ -278,7 +278,7 @@ static const struct iis2mdc_config iis2mdc_dev_config = {
#else
.spi_conf.cs = NULL,
#endif
#elif DT_ANY_INST_ON_BUS(i2c)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
.bus_init = iis2mdc_i2c_init,
.i2c_slv_addr = DT_INST_REG_ADDR(0),
#else

View file

@ -35,15 +35,15 @@ struct iis2mdc_config {
gpio_pin_t drdy_pin;
gpio_dt_flags_t drdy_flags;
#endif /* CONFIG_IIS2MDC_TRIGGER */
#if DT_ANY_INST_ON_BUS(i2c)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
u16_t i2c_slv_addr;
#elif DT_ANY_INST_ON_BUS(spi)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
struct spi_config spi_conf;
#if DT_INST_SPI_DEV_HAS_CS_GPIOS(0)
const char *gpio_cs_port;
u8_t cs_gpio;
#endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */
#endif /* DT_ANY_INST_ON_BUS(spi) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */
};
/* Sensor data */
@ -55,9 +55,9 @@ struct iis2mdc_data {
stmdev_ctx_t *ctx;
#if DT_ANY_INST_ON_BUS(i2c)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
stmdev_ctx_t ctx_i2c;
#elif DT_ANY_INST_ON_BUS(spi)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
stmdev_ctx_t ctx_spi;
#endif

View file

@ -16,7 +16,7 @@
#include "iis2mdc.h"
#if DT_ANY_INST_ON_BUS(i2c)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
#define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL
LOG_MODULE_DECLARE(IIS2MDC);
@ -53,4 +53,4 @@ int iis2mdc_i2c_init(struct device *dev)
return 0;
}
#endif /* DT_ANY_INST_ON_BUS(i2c) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */

View file

@ -14,7 +14,7 @@
#include "iis2mdc.h"
#include <logging/log.h>
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
#define IIS2MDC_SPI_READ (1 << 7)
@ -133,4 +133,4 @@ int iis2mdc_spi_init(struct device *dev)
return 0;
}
#endif /* DT_ANY_INST_ON_BUS(spi) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */

View file

@ -232,7 +232,7 @@ static const struct iis3dhhc_config iis3dhhc_config = {
.int_flags = DT_INST_GPIO_FLAGS_BY_IDX(0, irq_gpios, 1),
#endif /* CONFIG_IIS3DHHC_DRDY_INT1 */
#endif /* CONFIG_IIS3DHHC_TRIGGER */
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
.bus_init = iis3dhhc_spi_init,
.spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency),
.spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL |

View file

@ -32,7 +32,7 @@ struct iis3dhhc_config {
u8_t int_pin;
u8_t int_flags;
#endif
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
struct spi_config spi_conf;
#if DT_INST_SPI_DEV_HAS_CS_GPIOS(0)
const char *gpio_cs_port;
@ -47,7 +47,7 @@ struct iis3dhhc_data {
stmdev_ctx_t *ctx;
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
stmdev_ctx_t ctx_spi;
#endif

View file

@ -14,7 +14,7 @@
#include "iis3dhhc.h"
#include <logging/log.h>
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
#define IIS3DHHC_SPI_READ (1 << 7)
@ -124,4 +124,4 @@ int iis3dhhc_spi_init(struct device *dev)
return 0;
}
#endif /* DT_ANY_INST_ON_BUS(spi) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */

View file

@ -752,7 +752,7 @@ static struct ism330dhcx_data ism330dhcx_data;
static const struct ism330dhcx_config ism330dhcx_config = {
.bus_name = DT_INST_BUS_LABEL(0),
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
.bus_init = ism330dhcx_spi_init,
.spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency),
.spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL |
@ -767,7 +767,7 @@ static const struct ism330dhcx_config ism330dhcx_config = {
#else
.spi_conf.cs = NULL,
#endif
#elif DT_ANY_INST_ON_BUS(i2c)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
.bus_init = ism330dhcx_i2c_init,
.i2c_slv_addr = DT_INST_REG_ADDR(0),
#else

View file

@ -100,15 +100,15 @@ struct ism330dhcx_config {
u8_t int_gpio_flags;
u8_t int_pin;
#endif /* CONFIG_ISM330DHCX_TRIGGER */
#if DT_ANY_INST_ON_BUS(i2c)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
u16_t i2c_slv_addr;
#elif DT_ANY_INST_ON_BUS(spi)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
struct spi_config spi_conf;
#if DT_INST_SPI_DEV_HAS_CS_GPIOS(0)
const char *gpio_cs_port;
u8_t cs_gpio;
#endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */
#endif /* DT_ANY_INST_ON_BUS(i2c) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */
};
union samples {
@ -159,9 +159,9 @@ struct ism330dhcx_data {
stmdev_ctx_t *ctx;
#if DT_ANY_INST_ON_BUS(i2c)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
stmdev_ctx_t ctx_i2c;
#elif DT_ANY_INST_ON_BUS(spi)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
stmdev_ctx_t ctx_spi;
#endif

View file

@ -16,7 +16,7 @@
#include "ism330dhcx.h"
#if DT_ANY_INST_ON_BUS(i2c)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
LOG_MODULE_DECLARE(ISM330DHCX, CONFIG_SENSOR_LOG_LEVEL);
@ -52,4 +52,4 @@ int ism330dhcx_i2c_init(struct device *dev)
return 0;
}
#endif /* DT_ANY_INST_ON_BUS(i2c) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c) */

View file

@ -14,7 +14,7 @@
#include "ism330dhcx.h"
#include <logging/log.h>
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
#define ISM330DHCX_SPI_READ (1 << 7)
@ -125,4 +125,4 @@ int ism330dhcx_spi_init(struct device *dev)
return 0;
}
#endif /* DT_ANY_INST_ON_BUS(spi) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */

View file

@ -350,7 +350,7 @@ static struct lis2dh_data lis2dh_data;
static const struct lis2dh_config lis2dh_config = {
.bus_name = DT_INST_BUS_LABEL(0),
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
.bus_init = lis2dh_spi_init,
.spi_conf.frequency = DT_INST_PROP(0, spi_max_frequency),
.spi_conf.operation = (SPI_OP_MODE_MASTER | SPI_MODE_CPOL |
@ -364,7 +364,7 @@ static const struct lis2dh_config lis2dh_config = {
#else
.spi_conf.cs = NULL,
#endif
#elif DT_ANY_INST_ON_BUS(i2c)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
.bus_init = lis2dh_i2c_init,
.i2c_slv_addr = DT_INST_REG_ADDR(0),
#else

View file

@ -21,7 +21,7 @@
#define LIS2DH_REG_WAI 0x0f
#define LIS2DH_CHIP_ID 0x33
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
#include <drivers/spi.h>
#define LIS2DH_SPI_READ_BIT BIT(7)
@ -31,7 +31,7 @@
/* LIS2DH supports only SPI mode 0, word size 8 bits, MSB first */
#define LIS2DH_SPI_CFG SPI_WORD_SET(8)
#elif DT_ANY_INST_ON_BUS(i2c)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
#include <drivers/i2c.h>
#else
#error "define bus type (I2C/SPI)"
@ -200,15 +200,15 @@ union lis2dh_sample {
struct lis2dh_config {
char *bus_name;
int (*bus_init)(struct device *dev);
#if DT_ANY_INST_ON_BUS(i2c)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(i2c)
u16_t i2c_slv_addr;
#elif DT_ANY_INST_ON_BUS(spi)
#elif DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
struct spi_config spi_conf;
#if DT_INST_SPI_DEV_HAS_CS_GPIOS(0)
const char *gpio_cs_port;
u8_t cs_gpio;
#endif /* DT_INST_SPI_DEV_HAS_CS_GPIOS(0) */
#endif /* DT_ANY_INST_ON_BUS(spi) */
#endif /* DT_ANY_INST_ON_BUS_STATUS_OKAY(spi) */
};
@ -259,7 +259,7 @@ struct lis2dh_data {
#endif /* DT_SPI_DEV_HAS_CS_GPIOS(DT_INST(0, st_lis2mdl)) */
};
#if DT_ANY_INST_ON_BUS(spi)
#if DT_ANY_INST_ON_BUS_STATUS_OKAY(spi)
int lis2dh_spi_access(struct lis2dh_data *ctx, u8_t cmd,
void *data, size_t length);
#endif

Some files were not shown because too many files have changed in this diff Show more