From f2f0cc3beb72e4b1dd665e44bdcaa5742267901b Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Sat, 11 Feb 2017 10:17:42 +0800 Subject: [PATCH] dai: reset dai_pos at MMAP_PPOS command It reset dai_pos at prepare stage before, which will make it wrong when the prepare is called more than one time. Here move the reset to MMAP_POS command handling, which should happen at stream allocating stage only. Signed-off-by: Keyon Jie --- src/audio/dai.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/audio/dai.c b/src/audio/dai.c index ab0164c97..b015b2afc 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -351,11 +351,6 @@ static int dai_prepare(struct comp_dev *dev) return -EINVAL; } - dd->dai_pos_blks = 0; - - if (dd->dai_pos) - *dd->dai_pos = 0; - ret = dma_set_config(dd->dma, dd->chan, &dd->config); dev->state = COMP_STATE_PREPARE; return ret; @@ -435,6 +430,8 @@ static int dai_cmd(struct comp_dev *dev, int cmd, void *data) break; case COMP_CMD_IPC_MMAP_PPOS: dd->dai_pos = data; + if (dd->dai_pos) + *dd->dai_pos = 0; break; default: break;