mirror of https://github.com/thesofproject/sof.git
host: host_copy: only copy when there is data and wait until finish
We don't copy when host_avail is 0(usually stream finished), at the same time, we need wait until the dma copy is finished before we can start next pulling copy. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
This commit is contained in:
parent
8cbf06c96b
commit
1ff623bdf5
|
@ -803,14 +803,26 @@ static int host_reset(struct comp_dev *dev)
|
|||
static int host_copy(struct comp_dev *dev)
|
||||
{
|
||||
struct host_data *hd = comp_get_drvdata(dev);
|
||||
int ret;
|
||||
|
||||
trace_host("CpS");
|
||||
if (dev->state != COMP_STATE_RUNNING)
|
||||
return 0;
|
||||
|
||||
trace_host("CpS");
|
||||
if (hd->host_avail == 0)
|
||||
return 0;
|
||||
|
||||
/* do DMA transfer */
|
||||
wait_init(&hd->complete);
|
||||
dma_set_config(hd->dma, hd->chan, &hd->config);
|
||||
dma_start(hd->dma, hd->chan);
|
||||
|
||||
/* wait for DMA to finish */
|
||||
hd->complete.timeout = PLATFORM_DMA_TIMEOUT;
|
||||
ret = wait_for_completion_timeout(&hd->complete);
|
||||
if (ret < 0)
|
||||
trace_comp_error("eHc");
|
||||
|
||||
return 0;
|
||||
}
|
||||
struct comp_driver comp_host = {
|
||||
|
|
Loading…
Reference in New Issue