Skip to content

Commit bc0bb10

Browse files
zephyr: Use emul_dma for Virtual DAI on i.MX8MP
Add emul_dma configuration to enable Virtual DAI with memory-to-memory DMA for software-based audio pipelines on i.MX8MP. Signed-off-by: Suraj Sonawane <surajsonawane0215@gmail.com>
1 parent 36c15aa commit bc0bb10

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

app/boards/imx8mp_evk_mimx8ml8_adsp.overlay

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
};
1313
};
1414

15+
&emul_dma {
16+
status = "okay";
17+
};
18+
1519
&sdma3 {
1620
status = "okay";
1721
};

src/audio/dai-zephyr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,12 @@ __cold int dai_common_new(struct dai_data *dd, struct comp_dev *dev,
496496
dd->ipc_config = *dai_cfg;
497497

498498
/* request GP LP DMA with shared access privilege */
499+
#if CONFIG_DAI_VIRTUAL
500+
dir = SOF_DMA_DIR_MEM_TO_MEM;
501+
#else
499502
dir = dai_cfg->direction == SOF_IPC_STREAM_PLAYBACK ?
500503
SOF_DMA_DIR_MEM_TO_DEV : SOF_DMA_DIR_DEV_TO_MEM;
504+
#endif
501505

502506
dd->dma = sof_dma_get(dir, dd->dai->dma_caps, dd->dai->dma_dev, SOF_DMA_ACCESS_SHARED);
503507
if (!dd->dma) {

zephyr/include/sof/lib/dma.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct comp_dev;
9999
#define SOF_DMA_DEV_HS BIT(13) /**< connectable to ACP HS I2S */
100100
#define SOF_DMA_DEV_MICFIL BIT(14) /**< connectable to MICFIL fifo */
101101
#define SOF_DMA_DEV_SW BIT(15) /**< connectable to ACP SW */
102+
#define SOF_DMA_DEV_DAI_VIRTUAL BIT(16) /**< connectable to Virtual DAI */
102103

103104
/* DMA access privilege flag */
104105
#define SOF_DMA_ACCESS_EXCLUSIVE 1

zephyr/lib/dma.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ SHARED_DATA struct sof_dma dma[] = {
151151
},
152152
#endif
153153
#if defined(CONFIG_SOC_MIMX8ML8_ADSP)
154+
#if CONFIG_DAI_VIRTUAL
155+
{
156+
.plat_data = {
157+
.dir = SOF_DMA_DIR_MEM_TO_MEM,
158+
.devs = SOF_DMA_DEV_DAI_VIRTUAL,
159+
.channels = 32,
160+
.period_count = 2,
161+
},
162+
.z_dev = DEVICE_DT_GET(DT_NODELABEL(emul_dma)),
163+
},
164+
#endif /* CONFIG_DAI_VIRTUAL */
154165
{
155166
.plat_data = {
156167
.dir = SOF_DMA_DIR_MEM_TO_DEV | SOF_DMA_DIR_DEV_TO_MEM,

0 commit comments

Comments
 (0)