dai: only get dma channel at first config

For dais, we don't support change dma channel dynamically, so only get
dma channel at first config, ignore that for  latter dai_config
invokings to avoid dma channel leaking.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This commit is contained in:
Keyon Jie 2019-01-02 16:59:28 +08:00 committed by Liam Girdwood
parent 0a57440a35
commit 4cc0556ce3
2 changed files with 7 additions and 2 deletions

View File

@ -256,6 +256,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
dd->dai_pos_blks = 0;
dd->xrun = 0;
dd->pointer_init = 0;
dd->chan = DMA_CHAN_INVALID;
dev->state = COMP_STATE_READY;
return dev;
@ -774,8 +775,10 @@ static int dai_config(struct comp_dev *dev, struct sof_ipc_dai_config *config)
return -EINVAL;
}
/* channel is ignored by GP dma get function */
dd->chan = dma_channel_get(dd->dma, channel);
if (dd->chan == DMA_CHAN_INVALID)
/* get dma channel at first config only */
dd->chan = dma_channel_get(dd->dma, channel);
if (dd->chan < 0) {
trace_dai_error_with_ids(dev, "dai_config() error: "
"dma_channel_get() failed");

View File

@ -89,6 +89,8 @@
#define DMA_RELOAD_END 0
#define DMA_RELOAD_LLI 0xFFFFFFFF
#define DMA_CHAN_INVALID 0xFFFFFFFF
struct dma;
/**