drivers: i2s: Convert drivers to new DT device macros

Convert i2s drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT{_INST}_DEFINE
    DEVICE_GET -> DEVICE_DT_INST_GET
    DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-12-16 07:02:14 -06:00 committed by Anas Nashif
commit 8e55cfab96
3 changed files with 12 additions and 12 deletions

View file

@ -624,8 +624,8 @@ static const struct i2s_driver_api i2s_litex_driver_api = {
.fifo_depth = DT_PROP(DT_NODELABEL(i2s_##dir), fifo_depth), \
.irq_config = i2s_litex_irq_config_func_##dir \
}; \
DEVICE_AND_API_INIT(i2s_##dir, DT_LABEL(DT_NODELABEL(i2s_##dir)), \
i2s_litex_initialize, &i2s_litex_data_##dir, \
DEVICE_DT_DEFINE(DT_NODELABEL(i2s_##dir), i2s_litex_initialize, \
device_pm_control_nop, &i2s_litex_data_##dir, \
&i2s_litex_cfg_##dir, POST_KERNEL, \
CONFIG_I2S_INIT_PRIORITY, \
&i2s_litex_driver_api); \
@ -636,7 +636,7 @@ static const struct i2s_driver_api i2s_litex_driver_api = {
DT_IRQ(DT_NODELABEL(i2s_##dir), \
priority), \
i2s_litex_isr_##dir, \
DEVICE_GET(i2s_##dir), 0); \
DEVICE_DT_GET(DT_NODELABEL(i2s_##dir)), 0);\
irq_enable(DT_IRQN(DT_NODELABEL(i2s_##dir))); \
}

View file

@ -898,7 +898,7 @@ static const struct device *get_dev_from_tx_dma_channel(uint32_t dma_channel)
}
#define I2S_INIT(index, clk_sel) \
DEVICE_DECLARE(i2s_stm32_##index); \
DEVICE_DT_DECLARE(DT_NODELABEL(i2s##index)); \
\
static const struct soc_gpio_pinctrl i2s_pins_##index[] = \
ST_STM32_DT_INST_PINCTRL(index, 0);\
@ -926,9 +926,9 @@ static struct i2s_stm32_data i2s_stm32_data_##index = { \
UTIL_AND(DT_DMAS_HAS_NAME(DT_NODELABEL(i2s##index), tx), \
I2S_DMA_CHANNEL_INIT(index, tx, TX, MEMORY, PERIPHERAL)),\
}; \
DEVICE_AND_API_INIT(i2s_stm32_##index, \
DT_LABEL(DT_NODELABEL(i2s##index)), \
&i2s_stm32_initialize, &i2s_stm32_data_##index, \
DEVICE_DT_DEFINE(DT_NODELABEL(i2s##index), \
&i2s_stm32_initialize, device_pm_control_nop, \
&i2s_stm32_data_##index, \
&i2s_stm32_config_##index, POST_KERNEL, \
CONFIG_I2S_INIT_PRIORITY, &i2s_stm32_driver_api); \
\
@ -936,7 +936,7 @@ static void i2s_stm32_irq_config_func_##index(const struct device *dev) \
{ \
IRQ_CONNECT(DT_IRQN(DT_NODELABEL(i2s##index)), \
DT_IRQ(DT_NODELABEL(i2s##index), priority), \
i2s_stm32_isr, DEVICE_GET(i2s_stm32_##index), 0); \
i2s_stm32_isr, DEVICE_DT_GET(DT_NODELABEL(i2s##index)), 0);\
irq_enable(DT_IRQN(DT_NODELABEL(i2s##index))); \
}

View file

@ -962,17 +962,17 @@ static const struct i2s_driver_api i2s_sam_driver_api = {
/* I2S0 */
DEVICE_DECLARE(i2s0_sam);
DEVICE_DT_INST_DECLARE(0);
static const struct device *get_dev_from_dma_channel(uint32_t dma_channel)
{
return &DEVICE_NAME_GET(i2s0_sam);
return &DEVICE_DT_NAME_GET(DT_DRV_INST(0));
}
static void i2s0_sam_irq_config(void)
{
IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), i2s_sam_isr,
DEVICE_GET(i2s0_sam), 0);
DEVICE_DT_INST_GET(0), 0);
}
static const struct soc_gpio_pin i2s0_pins[] = ATMEL_SAM_DT_PINS(0);
@ -1026,6 +1026,6 @@ static struct i2s_sam_dev_data i2s0_sam_data = {
},
};
DEVICE_AND_API_INIT(i2s0_sam, DT_INST_LABEL(0), &i2s_sam_initialize,
DEVICE_DT_INST_DEFINE(0, &i2s_sam_initialize, device_pm_control_nop,
&i2s0_sam_data, &i2s0_sam_config, POST_KERNEL,
CONFIG_I2S_INIT_PRIORITY, &i2s_sam_driver_api);