@@ -530,7 +530,7 @@ static void dma_rx_callback(const struct device *dma_dev, void *arg,
530530 goto rx_disable ;
531531 }
532532
533- ret = reload_dma (dev_data -> dev_dma_rx , stream -> dma_channel ,
533+ ret = reload_dma (stream -> dev_dma , stream -> dma_channel ,
534534 & stream -> dma_cfg ,
535535 (void * )LL_SPI_DMA_GetRegAddr (cfg -> i2s ),
536536 stream -> mem_block ,
@@ -614,7 +614,7 @@ static void dma_tx_callback(const struct device *dma_dev, void *arg,
614614 /* Assure cache coherency before DMA read operation */
615615 DCACHE_CLEAN (stream -> mem_block , mem_block_size );
616616
617- ret = reload_dma (dev_data -> dev_dma_tx , stream -> dma_channel ,
617+ ret = reload_dma (stream -> dev_dma , stream -> dma_channel ,
618618 & stream -> dma_cfg ,
619619 stream -> mem_block ,
620620 (void * )LL_SPI_DMA_GetRegAddr (cfg -> i2s ),
@@ -685,14 +685,12 @@ static int i2s_stm32_initialize(const struct device *dev)
685685 }
686686
687687 /* Get the binding to the DMA device */
688- dev_data -> dev_dma_tx = device_get_binding (dev_data -> tx .dma_name );
689- if (!dev_data -> dev_dma_tx ) {
690- LOG_ERR ("%s device not found" , dev_data -> tx .dma_name );
688+ if (!device_is_ready (dev_data -> tx .dev_dma )) {
689+ LOG_ERR ("%s device not ready" , dev_data -> tx .dev_dma -> name );
691690 return - ENODEV ;
692691 }
693- dev_data -> dev_dma_rx = device_get_binding (dev_data -> rx .dma_name );
694- if (!dev_data -> dev_dma_rx ) {
695- LOG_ERR ("%s device not found" , dev_data -> rx .dma_name );
692+ if (!device_is_ready (dev_data -> rx .dev_dma )) {
693+ LOG_ERR ("%s device not ready" , dev_data -> rx .dev_dma -> name );
696694 return - ENODEV ;
697695 }
698696
@@ -704,7 +702,6 @@ static int i2s_stm32_initialize(const struct device *dev)
704702static int rx_stream_start (struct stream * stream , const struct device * dev )
705703{
706704 const struct i2s_stm32_cfg * cfg = DEV_CFG (dev );
707- struct i2s_stm32_data * const dev_data = DEV_DATA (dev );
708705 int ret ;
709706
710707 ret = k_mem_slab_alloc (stream -> cfg .mem_slab , & stream -> mem_block ,
@@ -722,7 +719,7 @@ static int rx_stream_start(struct stream *stream, const struct device *dev)
722719 /* remember active RX DMA channel (used in callback) */
723720 active_dma_rx_channel [stream -> dma_channel ] = dev ;
724721
725- ret = start_dma (dev_data -> dev_dma_rx , stream -> dma_channel ,
722+ ret = start_dma (stream -> dev_dma , stream -> dma_channel ,
726723 & stream -> dma_cfg ,
727724 (void * )LL_SPI_DMA_GetRegAddr (cfg -> i2s ),
728725 stream -> src_addr_increment , stream -> mem_block ,
@@ -744,7 +741,6 @@ static int rx_stream_start(struct stream *stream, const struct device *dev)
744741static int tx_stream_start (struct stream * stream , const struct device * dev )
745742{
746743 const struct i2s_stm32_cfg * cfg = DEV_CFG (dev );
747- struct i2s_stm32_data * const dev_data = DEV_DATA (dev );
748744 size_t mem_block_size ;
749745 int ret ;
750746
@@ -767,7 +763,7 @@ static int tx_stream_start(struct stream *stream, const struct device *dev)
767763 /* remember active TX DMA channel (used in callback) */
768764 active_dma_tx_channel [stream -> dma_channel ] = dev ;
769765
770- ret = start_dma (dev_data -> dev_dma_tx , stream -> dma_channel ,
766+ ret = start_dma (stream -> dev_dma , stream -> dma_channel ,
771767 & stream -> dma_cfg ,
772768 stream -> mem_block , stream -> src_addr_increment ,
773769 (void * )LL_SPI_DMA_GetRegAddr (cfg -> i2s ),
@@ -789,13 +785,11 @@ static int tx_stream_start(struct stream *stream, const struct device *dev)
789785static void rx_stream_disable (struct stream * stream , const struct device * dev )
790786{
791787 const struct i2s_stm32_cfg * cfg = DEV_CFG (dev );
792- struct i2s_stm32_data * const dev_data = DEV_DATA (dev );
793- const struct device * dev_dma = dev_data -> dev_dma_rx ;
794788
795789 LL_I2S_DisableDMAReq_RX (cfg -> i2s );
796790 LL_I2S_DisableIT_ERR (cfg -> i2s );
797791
798- dma_stop (dev_dma , stream -> dma_channel );
792+ dma_stop (stream -> dev_dma , stream -> dma_channel );
799793 if (stream -> mem_block != NULL ) {
800794 k_mem_slab_free (stream -> cfg .mem_slab , & stream -> mem_block );
801795 stream -> mem_block = NULL ;
@@ -809,13 +803,11 @@ static void rx_stream_disable(struct stream *stream, const struct device *dev)
809803static void tx_stream_disable (struct stream * stream , const struct device * dev )
810804{
811805 const struct i2s_stm32_cfg * cfg = DEV_CFG (dev );
812- struct i2s_stm32_data * const dev_data = DEV_DATA (dev );
813- const struct device * dev_dma = dev_data -> dev_dma_tx ;
814806
815807 LL_I2S_DisableDMAReq_TX (cfg -> i2s );
816808 LL_I2S_DisableIT_ERR (cfg -> i2s );
817809
818- dma_stop (dev_dma , stream -> dma_channel );
810+ dma_stop (stream -> dev_dma , stream -> dma_channel );
819811 if (stream -> mem_block != NULL ) {
820812 k_mem_slab_free (stream -> cfg .mem_slab , & stream -> mem_block );
821813 stream -> mem_block = NULL ;
@@ -867,7 +859,7 @@ static const struct device *get_dev_from_tx_dma_channel(uint32_t dma_channel)
867859/* src_dev and dest_dev should be 'MEMORY' or 'PERIPHERAL'. */
868860#define I2S_DMA_CHANNEL_INIT (index , dir , dir_cap , src_dev , dest_dev ) \
869861.dir = { \
870- .dma_name = DT_DMAS_LABEL_BY_NAME( DT_NODELABEL(i2s##index), dir),\
862+ .dev_dma = DEVICE_DT_GET(DT_DMAS_CTLR_BY_NAME( DT_NODELABEL(i2s##index), dir) ),\
871863 .dma_channel = \
872864 DT_DMAS_CELL_BY_NAME(DT_NODELABEL(i2s##index), dir, channel),\
873865 .dma_cfg = { \
0 commit comments