Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions src/audio/kpb.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ static int kpb_prepare(struct comp_dev *dev)
/* Init private data */
cd->kpb_no_of_clients = 0;
cd->buffered_data = 0;
cd->state = KPB_STATE_BUFFERING;

/* Init history buffer */
kpb_clear_history_buffer(cd->history_buffer);
Expand Down Expand Up @@ -437,16 +436,12 @@ static int kpb_reset(struct comp_dev *dev)
/* Reset history buffer */
kpb->is_internal_buffer_full = false;
kpb_clear_history_buffer(kpb->history_buffer);

/* Reset amount of buffered data */
kpb->buffered_data = 0;

/* Unregister KPB for async notification */
notifier_unregister(&kpb->kpb_events);

/* Reset KPB state to initial buffering state */
kpb->state = KPB_STATE_BUFFERING;

return comp_set_state(dev, COMP_TRIGGER_RESET);
}

Expand Down Expand Up @@ -474,17 +469,15 @@ static int kpb_copy(struct comp_dev *dev)
/* Get source and sink buffers */
source = list_first_item(&dev->bsource_list, struct comp_buffer,
sink_list);
sink = (kpb->state == KPB_STATE_BUFFERING) ? kpb->rt_sink
: kpb->cli_sink;

/* Pause selector copy during draining and/or draining on demand.
* We keep selector in this "paused" state as long as draining
* is going and later during direct copy to client's/host sink,
* in so called "draining on demand" state. In order to rearm
* detection algorithm kpb_reset is needed.
*/
if (kpb->state != KPB_STATE_BUFFERING)
/* Stop copying downstream if in draining */
if (kpb->state == KPB_STATE_DRAINING_ON_DEMAND) {
comp_update_buffer_consume(source, source->avail);
return PPL_STATUS_PATH_STOP;
}

sink = (kpb->state == KPB_STATE_BUFFERING) ? kpb->rt_sink
: kpb->cli_sink;

/* Process source data */
/* Check if there are valid pointers */
Expand Down Expand Up @@ -795,6 +788,7 @@ static void kpb_init_draining(struct comp_data *kpb, struct kpb_client *cli)
comp_set_attribute(kpb->cli_sink->sink,
COMP_ATTR_COPY_BLOCKING, 1);

kpb->state = KPB_STATE_DRAINING_ON_DEMAND;
/* Schedule draining task */
schedule_task(&kpb->draining_task, 0, 0,
SOF_SCHEDULE_FLAG_IDLE);
Expand Down Expand Up @@ -855,7 +849,7 @@ static uint64_t kpb_draining_task(void *arg)
/* Draining is done. Now switch KPB to copy real time stream
* to client's sink
*/
*draining_data->state = KPB_STATE_DRAINING_ON_DEMAND;
*draining_data->state = KPB_STATE_REALTIME;

/* Reset host-sink copy mode back to unblocking */
comp_set_attribute(sink->sink, COMP_ATTR_COPY_BLOCKING, 0);
Expand Down
12 changes: 8 additions & 4 deletions src/audio/selector.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static int selector_params(struct comp_dev *dev)
else
dev->params.channels = cd->config.in_channels_count;

return 0;
return PPL_STATUS_PATH_STOP;
}


Expand Down Expand Up @@ -303,9 +303,11 @@ static int selector_cmd(struct comp_dev *dev, int cmd, void *data,
*/
static int selector_trigger(struct comp_dev *dev, int cmd)
{
int ret;
trace_selector("selector_trigger()");

return comp_set_state(dev, cmd);
ret = comp_set_state(dev, cmd);
return ret == 0 ? PPL_STATUS_PATH_STOP : ret;
}


Expand Down Expand Up @@ -454,7 +456,7 @@ static int selector_prepare(struct comp_dev *dev)
goto err;
}

return 0;
return PPL_STATUS_PATH_STOP;

err:
comp_set_state(dev, COMP_TRIGGER_RESET);
Expand All @@ -468,9 +470,11 @@ static int selector_prepare(struct comp_dev *dev)
*/
static int selector_reset(struct comp_dev *dev)
{
int ret;
trace_selector("selector_reset()");

return comp_set_state(dev, COMP_TRIGGER_RESET);
ret = comp_set_state(dev, COMP_TRIGGER_RESET);
return ret == 0 ? PPL_STATUS_PATH_STOP : ret;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions src/drivers/intel/cavs/hda-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ static int hda_dma_wait_for_buffer_full(struct dma *dma,

while (!(host_dma_reg_read(dma, chan->index, DGCS) & DGCS_BF)) {
if (deadline < platform_timer_get(platform_timer)) {
/* safe check in case we've got preempted after read */
if (host_dma_reg_read(dma, chan->index, DGCS) &
DGCS_BF)
return 0;

trace_hddma_error("hda-dmac: %d wait for buffer full "
"timeout", dma->plat_data.id);
return -ETIME;
Expand All @@ -293,6 +298,11 @@ static int hda_dma_wait_for_buffer_empty(struct dma *dma,

while (host_dma_reg_read(dma, chan->index, DGCS) & DGCS_BNE) {
if (deadline < platform_timer_get(platform_timer)) {
/* safe check in case we've got preempted after read */
if (!(host_dma_reg_read(dma, chan->index, DGCS) &
DGCS_BNE))
return 0;

trace_hddma_error("hda-dmac: %d wait for buffer empty "
"timeout", dma->plat_data.id);
return -ETIME;
Expand Down
1 change: 1 addition & 0 deletions src/include/sof/audio/kpb.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
enum kpb_state {
KPB_STATE_BUFFERING = 0,
KPB_STATE_DRAINING_ON_DEMAND,
KPB_STATE_REALTIME,
};

enum kpb_event {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/apollolake/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ struct sof;
#define PLATFORM_DEFAULT_DELAY 12

/* minimal L1 exit time in cycles */
#define PLATFORM_FORCE_L1_EXIT_TIME 585
#define PLATFORM_FORCE_L1_EXIT_TIME 800

/* the SSP port fifo depth */
#define SSP_FIFO_DEPTH 16
Expand Down
6 changes: 3 additions & 3 deletions tools/topology/m4/detect_test_coef.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ CONTROLBYTES_PRIV(DETECTOR_priv,
` 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x03,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x20,0x00,0x00,0x00,0x05,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x80,0x02,0x00,0x00,'
` 0x03,0x00,0x00,0x80,0x00,0x00,0x00,0x00,'
` 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x80,0x07,0x00,0x00,'
` 0x03,0x00,0xff,0x3f,0x00,0x00,0x00,0x00,'
` 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"'
)
28 changes: 16 additions & 12 deletions tools/topology/sof-glk-da7219-kwd.m4
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ PIPELINE_PCM_ADD(sof/pipe-volume-playback.m4,
7, 7, 2, s32le,
48, 1000, 0, 0)

# Passthrough capture pipeline 8 on PCM 8 using max 2 channels.
# Schedule 320 frames per 1000us deadline on core 0 with priority 0
PIPELINE_PCM_ADD(sof/pipe-kfbm-capture.m4,
8, 8, 2, s16le,
KWD_PERIOD_FRAMES,
KWD_PIPE_SCH_DEADLINE_US,
0, 0)

#
# DAIs configuration
#
Expand Down Expand Up @@ -122,24 +114,36 @@ DAI_ADD(sof/pipe-dai-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
5, HDA, 3, iDisp1,
PIPELINE_SOURCE_5, 2, s32le,
48, 1000, 0, 0)
48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)

# playback DAI is iDisp2 using 2 periods
# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
6, HDA, 4, iDisp2,
PIPELINE_SOURCE_6, 2, s32le,
48, 1000, 0, 0)
48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)

# playback DAI is iDisp3 using 2 periods
# Buffers use s32le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
7, HDA, 5, iDisp3,
PIPELINE_SOURCE_7, 2, s32le,
48, 1000, 0, 0)
48, 1000, 0, 0, SCHEDULE_TIME_DOMAIN_TIMER)

#
# KWD configuration
#

# Passthrough capture pipeline 8 on PCM 8 using max 2 channels.
# Schedule 320 frames per 20000us deadline on core 0 with priority 0
PIPELINE_PCM_ADD(sof/pipe-kfbm-capture.m4,
8, 8, 2, s16le,
KWD_PERIOD_FRAMES,
KWD_PIPE_SCH_DEADLINE_US,
0, 0)

# capture DAI is DMIC 1 using 2 periods
# Buffers use s16le format, with 320 frame per 1000us on core 0 with priority 0
# Buffers use s16le format, with 320 frame per 20000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
8, DMIC, 1, dmic16k,
PIPELINE_SINK_8, 2, s16le,
Expand Down