Skip to content

Commit 755ea15

Browse files
committed
debug: hack for FW initiated xrun debugging
Signed-off-by: Keyon Jie <[email protected]>
1 parent 6ec9033 commit 755ea15

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎src/audio/dai.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,18 @@ static int dai_copy(struct comp_dev *dev)
661661
{
662662
struct dai_data *dd = comp_get_drvdata(dev);
663663
int ret;
664+
struct comp_buffer *source;
665+
static int m = 5000;
666+
667+
/*HACK for xrun debug */
668+
if (m++ == 10000) {
669+
m = 0;
670+
source = list_first_item(&dev->bsource_list,
671+
struct comp_buffer, sink_list);
672+
trace_dai_error("Keyon: hack for xrun debug!");
673+
comp_underrun(dev, source, 3 * dd->period_bytes, 0);
674+
return -EIO; /* xrun */
675+
}
664676

665677
if (dd->pointer_init == DAI_PTR_INIT_HOST) {
666678
/* start the DAI */

‎src/audio/volume.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static int volume_ctrl_get_cmd(struct comp_dev *dev,
402402
"SOF_CTRL_CMD_SWITCH, cdata->comp_id = %u",
403403
cdata->comp_id);
404404
for (j = 0; j < cdata->num_elems; j++) {
405-
cdata->chanv[j].channel = j;
405+
cdata->chanv[j].channel = j;
406406
cdata->chanv[j].value = cd->tvolume[j];
407407
trace_volume("volume_ctrl_set_cmd(), "
408408
"channel = %u, value = %u",
@@ -465,6 +465,7 @@ static int volume_copy(struct comp_dev *dev)
465465
struct comp_data *cd = comp_get_drvdata(dev);
466466
struct comp_buffer *sink;
467467
struct comp_buffer *source;
468+
static int n = 0;
468469

469470
tracev_volume("volume_copy()");
470471

@@ -474,6 +475,14 @@ static int volume_copy(struct comp_dev *dev)
474475
sink = list_first_item(&dev->bsink_list,
475476
struct comp_buffer, source_list);
476477

478+
/*HACK for xrun debug */
479+
if (n++ == 10000) {
480+
trace_volume_error("Keyon: hack for xrun debug!");
481+
n = 0;
482+
comp_underrun(dev, source, 3 * cd->source_period_bytes, 0);
483+
return -EIO; /* xrun */
484+
}
485+
477486
/* make sure source component buffer has enough data available and that
478487
* the sink component buffer has enough free bytes for copy. Also
479488
* check for XRUNs

0 commit comments

Comments
 (0)