Skip to content

Commit bbfda1e

Browse files
authored
Merge 8097cfa into f273e69
2 parents f273e69 + 8097cfa commit bbfda1e

File tree

7 files changed

+155
-147
lines changed

7 files changed

+155
-147
lines changed

sound/soc/sof/ipc3-pcm.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,23 @@ static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component,
117117
if (platform_params->cont_update_posn)
118118
pcm.params.cont_update_posn = 1;
119119

120-
dev_dbg(component->dev, "stream_tag %d", pcm.params.stream_tag);
120+
spcm_dbg(spcm, substream->stream, "stream_tag %d\n",
121+
pcm.params.stream_tag);
121122

122123
/* send hw_params IPC to the DSP */
123124
ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm),
124125
&ipc_params_reply, sizeof(ipc_params_reply));
125126
if (ret < 0) {
126-
dev_err(component->dev, "HW params ipc failed for stream %d\n",
127-
pcm.params.stream_tag);
127+
spcm_err(spcm, substream->stream,
128+
"STREAM_PCM_PARAMS ipc failed for stream_tag %d\n",
129+
pcm.params.stream_tag);
128130
return ret;
129131
}
130132

131133
ret = snd_sof_set_stream_data_offset(sdev, &spcm->stream[substream->stream],
132134
ipc_params_reply.posn_offset);
133135
if (ret < 0) {
134-
dev_err(component->dev, "%s: invalid stream data offset for PCM %d\n",
135-
__func__, spcm->pcm.pcm_id);
136+
spcm_err(spcm, substream->stream, "invalid stream data offset\n");
136137
return ret;
137138
}
138139

@@ -171,7 +172,7 @@ static int sof_ipc3_pcm_trigger(struct snd_soc_component *component,
171172
stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP;
172173
break;
173174
default:
174-
dev_err(component->dev, "Unhandled trigger cmd %d\n", cmd);
175+
spcm_err(spcm, substream->stream, "Unhandled trigger cmd %d\n", cmd);
175176
return -EINVAL;
176177
}
177178

sound/soc/sof/ipc3-topology.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,28 +2386,16 @@ static int sof_ipc3_set_up_all_pipelines(struct snd_sof_dev *sdev, bool verify)
23862386
static int sof_tear_down_left_over_pipelines(struct snd_sof_dev *sdev)
23872387
{
23882388
struct snd_sof_widget *swidget;
2389-
struct snd_sof_pcm *spcm;
2390-
int dir, ret;
2389+
int ret;
23912390

23922391
/*
23932392
* free all PCMs and their associated DAPM widgets if their connected DAPM widget
23942393
* list is not NULL. This should only be true for paused streams at this point.
23952394
* This is equivalent to the handling of FE DAI suspend trigger for running streams.
23962395
*/
2397-
list_for_each_entry(spcm, &sdev->pcm_list, list) {
2398-
for_each_pcm_streams(dir) {
2399-
struct snd_pcm_substream *substream = spcm->stream[dir].substream;
2400-
2401-
if (!substream || !substream->runtime || spcm->stream[dir].suspend_ignored)
2402-
continue;
2403-
2404-
if (spcm->stream[dir].list) {
2405-
ret = sof_pcm_stream_free(sdev, substream, spcm, dir, true);
2406-
if (ret < 0)
2407-
return ret;
2408-
}
2409-
}
2410-
}
2396+
ret = sof_pcm_free_all_streams(sdev);
2397+
if (ret)
2398+
return ret;
24112399

24122400
/*
24132401
* free any left over DAI widgets. This is equivalent to the handling of suspend trigger

sound/soc/sof/ipc4-pcm.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static int sof_ipc4_chain_dma_trigger(struct snd_sof_dev *sdev,
313313
set_fifo_size = false;
314314
break;
315315
default:
316-
dev_err(sdev->dev, "Unexpected state %d", state);
316+
spcm_err(spcm, direction, "Unexpected pipeline state %d\n", state);
317317
return -EINVAL;
318318
}
319319

@@ -333,8 +333,8 @@ static int sof_ipc4_chain_dma_trigger(struct snd_sof_dev *sdev,
333333
struct sof_ipc4_pipeline *pipeline = pipe_widget->private;
334334

335335
if (!pipeline->use_chain_dma) {
336-
dev_err(sdev->dev,
337-
"All pipelines in chained DMA stream should have use_chain_dma attribute set.");
336+
spcm_err(spcm, direction,
337+
"All pipelines in chained DMA path should have use_chain_dma attribute set.");
338338
return -EINVAL;
339339
}
340340

@@ -389,12 +389,12 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
389389
int ret;
390390
int i;
391391

392-
dev_dbg(sdev->dev, "trigger cmd: %d state: %d\n", cmd, state);
393-
394392
spcm = snd_sof_find_spcm_dai(component, rtd);
395393
if (!spcm)
396394
return -EINVAL;
397395

396+
spcm_dbg(spcm, substream->stream, "cmd: %d, state: %d\n", cmd, state);
397+
398398
pipeline_list = &spcm->stream[substream->stream].pipeline_list;
399399

400400
/* nothing to trigger if the list is empty */
@@ -465,7 +465,7 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
465465
*/
466466
ret = sof_ipc4_set_multi_pipeline_state(sdev, SOF_IPC4_PIPE_PAUSED, trigger_list);
467467
if (ret < 0) {
468-
dev_err(sdev->dev, "failed to pause all pipelines\n");
468+
spcm_err(spcm, substream->stream, "failed to pause all pipelines\n");
469469
goto free;
470470
}
471471

@@ -494,7 +494,9 @@ static int sof_ipc4_trigger_pipelines(struct snd_soc_component *component,
494494
/* else set the RUNNING/RESET state in the DSP */
495495
ret = sof_ipc4_set_multi_pipeline_state(sdev, state, trigger_list);
496496
if (ret < 0) {
497-
dev_err(sdev->dev, "failed to set final state %d for all pipelines\n", state);
497+
spcm_err(spcm, substream->stream,
498+
"failed to set final state %d for all pipelines\n",
499+
state);
498500
/*
499501
* workaround: if the firmware is crashed while setting the
500502
* pipelines to reset state we must ignore the error code and

sound/soc/sof/ipc4-topology.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3409,9 +3409,6 @@ static int sof_ipc4_dai_get_param(struct snd_sof_dev *sdev, struct snd_sof_dai *
34093409

34103410
static int sof_ipc4_tear_down_all_pipelines(struct snd_sof_dev *sdev, bool verify)
34113411
{
3412-
struct snd_sof_pcm *spcm;
3413-
int dir, ret;
3414-
34153412
/*
34163413
* This function is called during system suspend, we need to make sure
34173414
* that all streams have been freed up.
@@ -3423,21 +3420,8 @@ static int sof_ipc4_tear_down_all_pipelines(struct snd_sof_dev *sdev, bool verif
34233420
*
34243421
* This will also make sure that paused streams handled correctly.
34253422
*/
3426-
list_for_each_entry(spcm, &sdev->pcm_list, list) {
3427-
for_each_pcm_streams(dir) {
3428-
struct snd_pcm_substream *substream = spcm->stream[dir].substream;
3429-
3430-
if (!substream || !substream->runtime || spcm->stream[dir].suspend_ignored)
3431-
continue;
34323423

3433-
if (spcm->stream[dir].list) {
3434-
ret = sof_pcm_stream_free(sdev, substream, spcm, dir, true);
3435-
if (ret < 0)
3436-
return ret;
3437-
}
3438-
}
3439-
}
3440-
return 0;
3424+
return sof_pcm_free_all_streams(sdev);
34413425
}
34423426

34433427
static int sof_ipc4_link_setup(struct snd_sof_dev *sdev, struct snd_soc_dai_link *link)

0 commit comments

Comments
 (0)