Skip to content

Commit 4ba4aa8

Browse files
authored
Merge pull request #124 from tlauda/topic/issue-19
dai: do not initialize pointer every trigger start
2 parents 748aad9 + 6009e78 commit 4ba4aa8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/audio/dai.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct dai_data {
6464
uint32_t period_bytes;
6565
completion_t complete;
6666
int xrun; /* true if we are doing xrun recovery */
67+
int pointer_init; /* true if buffer pointer was initialized */
6768

6869
uint32_t last_bytes; /* the last bytes(<period size) it copies. */
6970
uint32_t dai_pos_blks; /* position in bytes (nearest block) */
@@ -211,6 +212,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
211212
dd->dai_pos_blks = 0;
212213
dd->last_bytes = 0;
213214
dd->xrun = 0;
215+
dd->pointer_init = 0;
214216

215217
/* get DMA channel from DMAC1 */
216218
dd->chan = dma_channel_get(dd->dma, 0);
@@ -454,6 +456,8 @@ static int dai_prepare(struct comp_dev *dev)
454456
/* write back buffer contents from cache */
455457
dcache_writeback_region(dma_buffer->addr, dma_buffer->size);
456458

459+
dd->pointer_init = 0;
460+
457461
/* dma reconfig not required if XRUN handling */
458462
if (dd->xrun) {
459463
/* after prepare, we have recovered from xrun */
@@ -492,6 +496,7 @@ static int dai_reset(struct comp_dev *dev)
492496
dd->wallclock = 0;
493497
dev->position = 0;
494498
dd->xrun = 0;
499+
dd->pointer_init = 0;
495500
comp_set_state(dev, COMP_TRIGGER_RESET);
496501

497502
return 0;
@@ -526,6 +531,8 @@ static void dai_pointer_init(struct comp_dev *dev)
526531
break;
527532
}
528533
}
534+
535+
dd->pointer_init = 1;
529536
}
530537

531538
/* used to pass standard and bespoke command (with data) to component */
@@ -545,7 +552,8 @@ static int dai_comp_trigger(struct comp_dev *dev, int cmd)
545552

546553
switch (cmd) {
547554
case COMP_TRIGGER_START:
548-
dai_pointer_init(dev);
555+
if (!dd->pointer_init)
556+
dai_pointer_init(dev);
549557
/* only start the DAI if we are not XRUN handling */
550558
if (dd->xrun == 0) {
551559
/* start the DAI */

0 commit comments

Comments
 (0)