Components will now each have a 64bit position counter that will indicate the processing position in bytes for each component. This can be used by time stamping, trace and debug.
Signed-off-by: Liam Girdwood liam.r.girdwood@linux.intel.com --- src/audio/dai.c | 6 ++++++ src/audio/host.c | 6 ++++-- src/include/reef/audio/component.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/audio/dai.c b/src/audio/dai.c index 8f41026..f7868cd 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -95,6 +95,7 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next) dcache_writeback_region(dma_buffer->r_ptr, dd->period_bytes);
/* update host position(in bytes offset) for drivers */ + dev->position += copied_size; if (dd->dai_pos) { dd->dai_pos_blks += copied_size; *dd->dai_pos = dd->dai_pos_blks + @@ -111,6 +112,8 @@ static void dai_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next) /* recalc available buffer space */ comp_update_buffer_produce(dma_buffer, dd->period_bytes);
+ /* update positions */ + dev->position += dd->period_bytes; if (dd->dai_pos) { dd->dai_pos_blks += dd->period_bytes; *dd->dai_pos = dd->dai_pos_blks + @@ -396,6 +399,8 @@ static int dai_prepare(struct comp_dev *dev)
trace_dai("pre");
+ dev->position = 0; + if (list_is_empty(&dd->config.elem_list)) { trace_dai_error("wdm"); return -EINVAL; @@ -436,6 +441,7 @@ static int dai_reset(struct comp_dev *dev) *dd->dai_pos = 0; dd->dai_pos = NULL; dd->last_bytes = 0; + dev->position = 0;
return 0; } diff --git a/src/audio/host.c b/src/audio/host.c index 5ac2cf4..5cdc4da 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -143,6 +143,7 @@ static void host_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
/* new local period, update host buffer position blks */ hd->local_pos += local_elem->size; + dev->position += local_elem->size;
/* buffer overlap ? */ if (hd->local_pos >= hd->host_size) @@ -150,6 +151,7 @@ static void host_dma_cb(void *data, uint32_t type, struct dma_sg_elem *next)
/* send IPC message to driver if needed */ hd->report_pos += local_elem->size; + hd->posn.host_posn += local_elem->size; if (dev->params.host_period_bytes != 0 && hd->report_pos >= dev->params.host_period_bytes) { hd->report_pos = 0; @@ -486,8 +488,7 @@ static int host_prepare(struct comp_dev *dev) *hd->host_pos = 0; hd->report_pos = 0; hd->split_remaining = 0; - - //dev->preload = PLAT_HOST_PERIODS; + dev->position = 0;
dev->state = COMP_STATE_PREPARE; return 0; @@ -502,6 +503,7 @@ static int host_pointer_reset(struct comp_dev *dev) *hd->host_pos = 0; hd->local_pos = 0; hd->report_pos = 0; + dev->position = 0;
return 0; } diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h index 28ce144..3238e13 100644 --- a/src/include/reef/audio/component.h +++ b/src/include/reef/audio/component.h @@ -159,6 +159,7 @@ struct comp_dev { uint16_t state; /* COMP_STATE_ */ uint16_t is_endpoint; /* component is end point in pipeline */ spinlock_t lock; /* lock for this component */ + uint64_t position; /* component rendering position */ struct pipeline *pipeline; /* pipeline we belong to */
/* common runtime configuration for downstream/upstream */