Skip to content

Commit

Permalink
ipc4: Ensure pipeline component directions are synchronized
Browse files Browse the repository at this point in the history
This patch addresses an issue where audio output could be silent due to
the direction property of pipeline components not being set. The problem
manifests when the pipeline is initialized in the sequence:

Init -> Reset -> Pause -> Ready

In this scenario, the direction property may remain unset, leading to
incorrect pipeline behavior.

In flow of transitions: Init -> Pause -> Ready, this issue does not occur
because the firmware attempts to set the directions in pipe components
during the transition from Init to Pause. This step is skipped if Pause
is done after Reset, which is the scenario that this patch addresses.

The added code ensures that if the source component's direction is unset
but the sink's direction is set, or vice versa, the direction is copied
from the set component to the unset one. This synchronization of the
direction property guarantees that the pipeline's data flow is correctly
established.

This synchronization of the direction property guarantees that the
pipeline's data flow is correctly established, allowing the
`pipeline_for_each_comp` function to traverse and process all components
as intended, thus resolving the silent audio output problem.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
  • Loading branch information
tmleman authored and kv2019i committed Apr 4, 2024
1 parent f77bdfb commit 732f07c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/ipc/ipc4/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,28 @@ static struct ipc_comp_dev *pipeline_get_host_dev(struct ipc_comp_dev *ppl_icd)
struct ipc *ipc = ipc_get();
int host_id;

/* If the source component's direction is not set but the sink's direction is,
* this block will copy the direction from the sink to the source component and
* mark the source's direction as set.
*/
if (!ppl_icd->pipeline->source_comp->direction_set &&
ppl_icd->pipeline->sink_comp->direction_set) {
ppl_icd->pipeline->source_comp->direction =
ppl_icd->pipeline->sink_comp->direction;
ppl_icd->pipeline->source_comp->direction_set = true;
}

/* If the sink component's direction is not set but the source's direction is,
* this block will copy the direction from the source to the sink component and
* mark the sink's direction as set.
*/
if (!ppl_icd->pipeline->sink_comp->direction_set &&
ppl_icd->pipeline->source_comp->direction_set) {
ppl_icd->pipeline->sink_comp->direction =
ppl_icd->pipeline->source_comp->direction;
ppl_icd->pipeline->sink_comp->direction_set = true;
}

if (ppl_icd->pipeline->source_comp->direction == SOF_IPC_STREAM_PLAYBACK)
host_id = ppl_icd->pipeline->source_comp->ipc_config.id;
else
Expand Down

0 comments on commit 732f07c

Please sign in to comment.