[Sound-open-firmware] [PATCH v3 02/27] dai: reset dai_pos at MMAP_PPOS command

Keyon Jie yang.jie at linux.intel.com
Sat Feb 11 03:17:42 CET 2017


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 <yang.jie at linux.intel.com>
---
 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 ab0164c..b015b2a 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;
-- 
2.7.4



More information about the Sound-open-firmware mailing list