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
12 changes: 11 additions & 1 deletion src/audio/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ static int pipeline_comp_complete(struct comp_dev *current, void *data,

/* complete component init */
current->pipeline = ppl_data->p;
current->frames = ppl_data->p->ipc_pipe.frames_per_sched;

pipeline_for_each_comp(current, &pipeline_comp_complete, data,
NULL, dir);
Expand Down Expand Up @@ -286,6 +285,17 @@ static int pipeline_comp_params(struct comp_dev *current, void *data, int dir)
/* send current params to the component */
current->params = ppl_data->params->params;

/* set frames from samplerate/period, but round integer up */
Comment thread
tlauda marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we roll this into #1280 and https://github.com/orgs/thesofproject/teams/sof-developers/discussions/9 . These are related and should be in the same PR for QA.

if (current->output_rate != 0) {
current->frames = (current->output_rate +
current->pipeline->ipc_pipe.period - 1) /
current->pipeline->ipc_pipe.period;
} else {
current->frames = (current->params.rate +
current->pipeline->ipc_pipe.period - 1) /
current->pipeline->ipc_pipe.period;
}

err = comp_params(current);
if (err < 0 || err == PPL_STATUS_PATH_STOP)
return err;
Expand Down
2 changes: 2 additions & 0 deletions src/audio/src/src.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp)
cd->polyphase_func = src_polyphase_stage_cir;
src_polyphase_reset(&cd->src);

dev->output_rate = ipc_src->sink_rate;

dev->state = COMP_STATE_READY;
return dev;
}
Expand Down
1 change: 1 addition & 0 deletions src/include/sof/audio/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ struct comp_dev {
uint16_t is_dma_connected; /**< component is connected to DMA */
uint64_t position; /**< component rendering position */
uint32_t frames; /**< number of frames we copy to sink */
uint32_t output_rate; /**< 0 means all output rates are fine */
struct pipeline *pipeline; /**< pipeline we belong to */

/** common runtime configuration for downstream/upstream */
Expand Down
17 changes: 5 additions & 12 deletions test/cmocka/src/audio/pipeline/pipeline_connect_upstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,8 @@ static void test_audio_pipeline_complete_connect_downstream_variable_set
/*Testing component*/
pipeline_complete(&result, test_data->first, test_data->second);

assert_int_equal
(
result.sched_comp->frames, test_data->p.ipc_pipe.frames_per_sched
);
assert_ptr_equal(result.sched_comp->pipeline, &result);
assert_ptr_equal(test_data->first->pipeline, &result);
Comment thread
juimonen marked this conversation as resolved.
Resolved
}

/*Test going downstream ignoring sink from other pipeline*/
Expand Down Expand Up @@ -171,10 +168,8 @@ static void test_audio_pipeline_complete_connect_downstream_full(void **state)
/*Testing component*/
pipeline_complete(&result, test_data->first, test_data->second);

assert_int_equal(test_data->first->frames,
result.ipc_pipe.frames_per_sched);
assert_int_equal(test_data->second->frames,
result.ipc_pipe.frames_per_sched);
assert_ptr_equal(test_data->first->pipeline, &result);
assert_ptr_equal(test_data->second->pipeline, &result);
}

/*Test going upstream all the way*/
Expand All @@ -195,10 +190,8 @@ static void test_audio_pipeline_complete_connect_upstream_full(void **state)
/*Testing component*/
pipeline_complete(&result, test_data->first, test_data->second);

assert_int_equal(test_data->first->frames,
result.ipc_pipe.frames_per_sched);
assert_int_equal(test_data->second->frames,
result.ipc_pipe.frames_per_sched);
assert_ptr_equal(test_data->first->pipeline, &result);
assert_ptr_equal(test_data->second->pipeline, &result);
}

/*Test going upstream all the way*/
Expand Down
14 changes: 8 additions & 6 deletions tools/test/topology/test-all.m4
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ include(`byt.m4')

PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4,
1, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0,
TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_FORMAT, 2)
1000, 0, 0,
TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_FORMAT, 2,
48000, 48000, 48000)


# Passthrough playback pipeline 2 on PCM 0 using max 2 channels of s24le.
# Schedule 48 frames per 1000us deadline on core 0 with priority 0

PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-capture.m4,
2, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0,
TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_FORMAT, 2)
1000, 0, 0,
TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_FORMAT, 2,
48000, 48000, 48000)

#
# DAI configuration
Expand All @@ -66,14 +68,14 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-capture.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
1, TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_LINK_NAME,
PIPELINE_SOURCE_1, 2, TEST_DAI_FORMAT,
48, 1000, 0, 0)
1000, 0, 0)

# capture DAI is SSP TEST_DAI_PORT using 2 periods
# Buffers use s24le format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-capture.m4,
2, TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_LINK_NAME,
PIPELINE_SINK_2, 2, TEST_DAI_FORMAT,
48, 1000, 0, 0)
1000, 0, 0)

# PCM Passthrough
PCM_DUPLEX_ADD(Passthrough, 0, PIPELINE_PCM_1, PIPELINE_PCM_2)
Expand Down
7 changes: 4 additions & 3 deletions tools/test/topology/test-capture.m4
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ include(`byt.m4')

PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-capture.m4,
2, 0, 4, TEST_PIPE_FORMAT,
48, 1000, 0, 0,
TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_FORMAT, 2)
1000, 0, 0,
TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_FORMAT, 2,
48000, 48000, 48000)

#
# DAI configuration
Expand All @@ -57,7 +58,7 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-capture.m4,
DAI_ADD(sof/pipe-dai-capture.m4,
2, TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_LINK_NAME,
PIPELINE_SINK_2, 2, TEST_DAI_FORMAT,
48, 1000, 0, 0)
1000, 0, 0)

# PCM Passthrough
PCM_CAPTURE_ADD(Passthrough, 0, PIPELINE_PCM_2)
Expand Down
7 changes: 4 additions & 3 deletions tools/test/topology/test-equalizer-playback-ssp.m4
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ include(`dsps/byt.m4')

PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4,
1, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0, 0, 1,
SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2)
1000, 0, 0, 0, 1,
SSP, TEST_SSP_PORT, TEST_SSP_FORMAT, 2,
48000, 48000, 48000)
#
# DAI configuration
#
Expand All @@ -55,7 +56,7 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
1, SSP, TEST_SSP_PORT, TEST_DAI_LINK_NAME,
PIPELINE_SOURCE_1, 2, TEST_SSP_FORMAT,
48, 1000, 0, 0)
1000, 0, 0)

# PCM Passthrough
PCM_PLAYBACK_ADD(Passthrough, 3, 0, 0, PIPELINE_PCM_1)
Expand Down
7 changes: 4 additions & 3 deletions tools/test/topology/test-playback.m4
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ include(`byt.m4')

PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4,
1, 0, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0,
TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_FORMAT, 2)
1000, 0, 0,
TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_FORMAT, 2,
48000, 48000, 48000)
#
# DAI configuration
#
Expand All @@ -56,7 +57,7 @@ PIPELINE_PCM_DAI_ADD(sof/pipe-TEST_PIPE_NAME-playback.m4,
DAI_ADD(sof/pipe-dai-playback.m4,
1, TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_LINK_NAME,
PIPELINE_SOURCE_1, 2, TEST_DAI_FORMAT,
48, 1000, 0, 0)
1000, 0, 0)

# PCM Passthrough
PCM_PLAYBACK_ADD(Passthrough, 0, PIPELINE_PCM_1)
Expand Down
5 changes: 3 additions & 2 deletions tools/test/topology/test-tone-playback.m4
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ define(`TONE_SAMPLE_RATE', 48000)
# Schedule with 48 frame per 1000us deadline on core 0 with priority 0
PIPELINE_ADD(sof/pipe-tone.m4,
5, 2, TEST_PIPE_FORMAT,
48, 1000, 0, 0, 0)
1000, 0, 0, 0, 0,
48000, 48000, 48000)

# playback DAI is SSP2 using 2 periods
# Buffers use TEST_DAI_FORMAT format, with 48 frame per 1000us on core 0 with priority 0
DAI_ADD(sof/pipe-dai-playback.m4,
5, TEST_DAI_TYPE, TEST_DAI_PORT, TEST_DAI_LINK_NAME,
PIPELINE_SOURCE_5, 2, TEST_DAI_FORMAT,
48, 1000, 2, 0)
1000, 2, 0)

#
# BE configurations - overrides config in ACPI if present
Expand Down
1 change: 1 addition & 0 deletions tools/topology/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ set(TPLGS
"sof-apl-dmic-a2ch-b4ch\;sof-apl-dmic-a2ch-b4ch"
"sof-apl-dmic\;sof-apl-dmic-4ch\;-DCHANNELS=4"
Comment thread
dbaluta marked this conversation as resolved.
Resolved
"sof-apl-dmic\;sof-apl-dmic-2ch\;-DCHANNELS=2"
"sof-apl-src-50khz-pcm512x\;sof-apl-src-50khz-pcm512x"
"sof-icl-dmic-4ch\;sof-icl-dmic-4ch"
"sof-apl-src-pcm512x\;sof-apl-src-pcm512x"
"sof-cml-rt5682\;sof-cml-rt5682\;-DPLATFORM=cml"
Expand Down
12 changes: 5 additions & 7 deletions tools/topology/m4/dai.m4
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ define(`DAI_CONFIG',
dnl DAI_ADD(pipeline,
dnl pipe id, dai type, dai_index, dai_be,
dnl buffer, periods, format,
dnl frames, deadline, priority, core, time_domain)
dnl deadline, priority, core, time_domain)
define(`DAI_ADD',
`undefine(`PIPELINE_ID')'
`undefine(`DAI_TYPE')'
Expand All @@ -180,7 +180,6 @@ define(`DAI_ADD',
`undefine(`DAI_BUF')'
`undefine(`DAI_PERIODS')'
`undefine(`DAI_FORMAT')'
`undefine(`SCHEDULE_FRAMES')'
Comment thread
juimonen marked this conversation as resolved.
Resolved
`undefine(`SCHEDULE_DEADLINE')'
`undefine(`SCHEDULE_PRIORITY')'
`undefine(`SCHEDULE_CORE')'
Expand All @@ -193,11 +192,10 @@ define(`DAI_ADD',
`define(`DAI_NAME', $3$4)'
`define(`DAI_PERIODS', $7)'
`define(`DAI_FORMAT', $8)'
`define(`SCHEDULE_FRAMES', $9)'
`define(`SCHEDULE_DEADLINE', $10)'
`define(`SCHEDULE_PRIORITY', $11)'
`define(`SCHEDULE_CORE', $12)'
`define(`SCHEDULE_TIME_DOMAIN', $13)'
`define(`SCHEDULE_DEADLINE', $9)'
`define(`SCHEDULE_PRIORITY', $10)'
`define(`SCHEDULE_CORE', $11)'
`define(`SCHEDULE_TIME_DOMAIN', $12)'
`include($1)'
`DEBUG_DAI($3, $4)'
)
Expand Down
Loading