mirror of https://github.com/thesofproject/sof.git
dai: dw-dma: adjust flow to more scheduler flexible
Adjusts dai and dw-dma configuration flows to be more scheduler flexible and not only working for DMA IRQ based schedulers. Note: due to the nature of timer scheduling we need to have restriction for dw-dma to support minimum 3 linked list items. Without such restriction we may not be able to clear done bits on time. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
parent
8ed568eadc
commit
181658671f
|
@ -456,6 +456,7 @@ static int dai_params(struct comp_dev *dev)
|
|||
static int dai_prepare(struct comp_dev *dev)
|
||||
{
|
||||
struct dai_data *dd = comp_get_drvdata(dev);
|
||||
struct dma_sg_config *config = &dd->config;
|
||||
int ret = 0;
|
||||
|
||||
trace_dai_with_ids(dev, "dai_prepare()");
|
||||
|
@ -477,7 +478,9 @@ static int dai_prepare(struct comp_dev *dev)
|
|||
/* write back buffer contents from cache */
|
||||
dcache_writeback_region(dd->dma_buffer->addr, dd->dma_buffer->size);
|
||||
|
||||
dd->cb_type = 0;
|
||||
/* set default callback type if irq disabled */
|
||||
if (config->irq_disabled)
|
||||
dd->cb_type = DMA_CB_TYPE_BLOCK;
|
||||
|
||||
/* dma reconfig not required if XRUN handling */
|
||||
if (dd->xrun) {
|
||||
|
|
|
@ -267,6 +267,9 @@
|
|||
/* number of tries to wait for reset */
|
||||
#define DW_DMA_CFG_TRIES 10000
|
||||
|
||||
/* min number of elems for config with irq disabled */
|
||||
#define DW_DMA_CFG_NO_IRQ_MIN_ELEMS 3
|
||||
|
||||
/* linked list item address */
|
||||
#define DW_DMA_LLI_ADDRESS(lli, dir) \
|
||||
(((dir) == DMA_DIR_MEM_TO_DEV) ? ((lli)->sar) : ((lli)->dar))
|
||||
|
@ -797,6 +800,16 @@ static int dw_dma_set_config(struct dma *dma, int channel,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (config->irq_disabled &&
|
||||
config->elem_array.count < DW_DMA_CFG_NO_IRQ_MIN_ELEMS) {
|
||||
trace_dwdma_error("dw-dma: %d channel %d not enough elems "
|
||||
"for config with irq disabled",
|
||||
dma->plat_data.id, channel,
|
||||
config->elem_array.count);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* do we need to realloc descriptors */
|
||||
if (config->elem_array.count != chan->desc_count) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue