Skip to content

Commit

Permalink
RD: change start_offset calculation (plus debug)
Browse files Browse the repository at this point in the history
  • Loading branch information
kv2019i committed Aug 28, 2024
1 parent 7b021f6 commit e35a0c1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/audio/copier/copier.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ static int copier_comp_trigger(struct comp_dev *dev, int cmd)
buffer = list_first_item(&dai_copier->bsource_list, struct comp_buffer, sink_list);
pipe_reg.stream_start_offset = posn.dai_posn +
latency * audio_stream_period_bytes(&buffer->stream, dev->frames);
comp_warn(dev, "start dai_posn %llu latency %u offset %llu",
posn.dai_posn, latency, pipe_reg.stream_start_offset);
pipe_reg.stream_end_offset = 0;
mailbox_sw_regs_write(cd->pipeline_reg_offset, &pipe_reg, sizeof(pipe_reg));
} else if (cmd == COMP_TRIGGER_PAUSE) {
Expand Down
28 changes: 25 additions & 3 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,19 @@ dai_dma_cb(struct dai_data *dd, struct comp_dev *dev, uint32_t bytes,
audio_stream_frame_bytes(&source_c->stream),
audio_stream_get_free_samples(&sink_c->stream) *
audio_stream_frame_bytes(&sink_c->stream));
} else {
}
#if 0
else {

/* update host position (in bytes offset) for drivers */
if (dd->total_data_processed < 2000) {
comp_warn(dev, "total_data_processed %llu->%llu",
dd->total_data_processed,
dd->total_data_processed + bytes);
}
dd->total_data_processed += bytes;
}

#endif
return dma_status;
}

Expand Down Expand Up @@ -442,9 +450,11 @@ dai_dma_multi_endpoint_cb(struct dai_data *dd, struct comp_dev *dev, uint32_t fr
audio_stream_consume(&dd->dma_buffer->stream, bytes);
}

#if 0
/* update host position (in bytes offset) for drivers */
dd->total_data_processed += bytes;

#endif

return dma_status;
}

Expand Down Expand Up @@ -1505,6 +1515,12 @@ int dai_zephyr_multi_endpoint_copy(struct dai_data **dd, struct comp_dev *dev,
}

dai_dma_position_update(dd[i], dev);
if (dd[i]->total_data_processed < 2000) {
comp_warn(dev, "total_data_processed %llu->%llu",
dd[i]->total_data_processed,
dd[i]->total_data_processed + copy_bytes);
}
dd[i]->total_data_processed += copy_bytes;
}

frame_bytes = audio_stream_frame_bytes(&multi_endpoint_buffer->stream);
Expand Down Expand Up @@ -1701,6 +1717,12 @@ int dai_common_copy(struct dai_data *dd, struct comp_dev *dev, pcm_converter_fun
}

dai_dma_position_update(dd, dev);
if (dd->total_data_processed < 2000) {
comp_warn(dev, "total_data_processed %llu->%llu",
dd->total_data_processed,
dd->total_data_processed + copy_bytes);
}
dd->total_data_processed += copy_bytes;

return ret;
}
Expand Down
3 changes: 3 additions & 0 deletions src/audio/pipeline/pipeline-graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ struct comp_dev *pipeline_get_dai_comp_latency(uint32_t pipeline_id, uint32_t *l
*latency += input_data / input_base_cfg.ibs -
output_data / output_base_cfg.obs;

printk("latency: input %u output %u ibs %d obs %d latency %u\n",
input_data, output_data, input_base_cfg.ibs, output_base_cfg.obs, *latency);

/* If the component doesn't have a sink buffer, it can be a dai. */
if (list_is_empty(&ipc_sink->cd->bsink_list))
return dev_comp_type(ipc_sink->cd) == SOF_COMP_DAI ? ipc_sink->cd : NULL;
Expand Down

0 comments on commit e35a0c1

Please sign in to comment.