Skip to content

Commit b30658d

Browse files
author
Marcin Maka
committed
comp: dai: dma channel acquired by stream tag
Some DMA types (HD/A for insstance) require to synchronize selection of the channel between the host and the dsp. Stream tag is a common setting for both host and dai atm, so it is not adjusted in dai comp. Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
1 parent b9246b0 commit b30658d

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

src/audio/dai.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
213213
dd->xrun = 0;
214214
dd->pointer_init = 0;
215215

216-
/* get DMA channel from DMAC1 */
217-
dd->chan = dma_channel_get(dd->dma, 0);
218-
if (dd->chan < 0){
219-
trace_dai_error("eDc");
220-
goto error;
221-
}
222-
223-
/* set up callback */
224-
dma_set_cb(dd->dma, dd->chan, DMA_IRQ_TYPE_BLOCK |
225-
DMA_IRQ_TYPE_LLIST, dai_dma_cb, dev);
226216
dev->state = COMP_STATE_READY;
227-
dev->is_dma_connected = 1;
228217
return dev;
229218

230219
error:
@@ -392,6 +381,18 @@ static int dai_params(struct comp_dev *dev)
392381
return -EINVAL;
393382
}
394383

384+
/* get DMA channel, once the stream_tag is known */
385+
dd->chan = dma_channel_get(dd->dma, dev->params.stream_tag);
386+
if (dd->chan < 0) {
387+
trace_dai_error("eDc");
388+
return -EINVAL;
389+
}
390+
391+
/* set up callback */
392+
dma_set_cb(dd->dma, dd->chan, DMA_IRQ_TYPE_BLOCK |
393+
DMA_IRQ_TYPE_LLIST, dai_dma_cb, dev);
394+
dev->is_dma_connected = 1;
395+
395396
/* for DAI, we should configure its frame_fmt from topology */
396397
dev->params.frame_fmt = dconfig->frame_fmt;
397398

0 commit comments

Comments
 (0)