Skip to content

Commit 304abde

Browse files
committed
ASoC: SOF: IPC4: fix reversed pipeline trigger priority order
The IPC4 definition of pipeline prioity is: 0 - highest priority 7 - lowest priority RUNNING should use ascending order (highest priority first), otherwise descending order (lowest priority first) should be used. Fixes: 4df7d6a ("ASoC: SOF: IPC4: sort pipeline based on priority") Cc: stable@vger.kernel.org Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent f6602b8 commit 304abde

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

sound/soc/sof/ipc4-pcm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,12 @@ static void sof_ipc4_add_pipeline_by_priority(struct ipc4_pipeline_set_state_dat
148148
struct sof_ipc4_pipeline *pipeline = pipe_widget->private;
149149
int i, j;
150150

151+
/* 0 = highest priority, 7 = lowest */
151152
for (i = 0; i < trigger_list->count; i++) {
152-
/* add pipeline from low priority to high */
153+
/* ascend=true: sort ascending [0,1,2...] = highest priority first */
153154
if (ascend && pipeline->priority < pipe_priority[i])
154155
break;
155-
/* add pipeline from high priority to low */
156+
/* ascend=false: sort descending [7,6,5...] = lowest priority first */
156157
else if (!ascend && pipeline->priority > pipe_priority[i])
157158
break;
158159
}
@@ -187,19 +188,19 @@ sof_ipc4_add_pipeline_to_trigger_list(struct snd_sof_dev *sdev, int state,
187188
*/
188189
if (spipe->started_count == spipe->paused_count)
189190
sof_ipc4_add_pipeline_by_priority(trigger_list, pipe_widget, pipe_priority,
190-
false);
191+
true);
191192
break;
192193
case SOF_IPC4_PIPE_RESET:
193194
/* RESET if the pipeline is neither running nor paused */
194195
if (!spipe->started_count && !spipe->paused_count)
195196
sof_ipc4_add_pipeline_by_priority(trigger_list, pipe_widget, pipe_priority,
196-
true);
197+
false);
197198
break;
198199
case SOF_IPC4_PIPE_PAUSED:
199200
/* Pause the pipeline only when its started_count is 1 more than paused_count */
200201
if (spipe->paused_count == (spipe->started_count - 1))
201202
sof_ipc4_add_pipeline_by_priority(trigger_list, pipe_widget, pipe_priority,
202-
true);
203+
false);
203204
break;
204205
default:
205206
break;

0 commit comments

Comments
 (0)