Skip to content
Open
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
2 changes: 1 addition & 1 deletion sound/soc/soc-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int snd_soc_ret(const struct device *dev, int ret, const char *fmt, ...)
vaf.fmt = fmt;
vaf.va = &args;

dev_err(dev, "ASoC error (%d): %pV", ret, &vaf);
dev_err_ratelimited(dev, "ASoC error (%d): %pV", ret, &vaf);
va_end(args);
}

Expand Down
6 changes: 3 additions & 3 deletions sound/soc/sof/ipc3-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component,
ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm),
&ipc_params_reply, sizeof(ipc_params_reply));
if (ret < 0) {
spcm_err(spcm, substream->stream,
"STREAM_PCM_PARAMS ipc failed for stream_tag %d\n",
pcm.params.stream_tag);
spcm_err_ratelimited(spcm, substream->stream,
"STREAM_PCM_PARAMS ipc failed for stream_tag %d\n",
pcm.params.stream_tag);
return ret;
}

Expand Down
17 changes: 9 additions & 8 deletions sound/soc/sof/ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,17 @@ static int ipc3_wait_tx_done(struct snd_sof_ipc *ipc, void *reply_data)
msecs_to_jiffies(sdev->ipc_timeout));

if (ret == 0) {
dev_err(sdev->dev,
"ipc tx timed out for %#x (msg/reply size: %d/%zu)\n",
hdr->cmd, hdr->size, msg->reply_size);
dev_err_ratelimited(sdev->dev,
"ipc tx timed out for %#x (msg/reply size: %d/%zu)\n",
hdr->cmd, hdr->size, msg->reply_size);
snd_sof_handle_fw_exception(ipc->sdev, "IPC timeout");
ret = -ETIMEDOUT;
} else {
ret = msg->reply_error;
if (ret < 0) {
dev_err(sdev->dev,
"ipc tx error for %#x (msg/reply size: %d/%zu): %d\n",
hdr->cmd, hdr->size, msg->reply_size, ret);
dev_err_ratelimited(sdev->dev,
"ipc tx error for %#x (msg/reply size: %d/%zu): %d\n",
hdr->cmd, hdr->size, msg->reply_size, ret);
} else {
if (sof_debug_check_flag(SOF_DBG_PRINT_IPC_SUCCESS_LOGS))
ipc3_log_header(sdev->dev, "ipc tx succeeded", hdr->cmd);
Expand Down Expand Up @@ -371,8 +371,9 @@ static int sof_ipc3_tx_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_
/* ensure the DSP is in D0 before sending a new IPC */
ret = snd_sof_dsp_set_power_state(sdev, &target_state);
if (ret < 0) {
dev_err(sdev->dev, "%s: resuming DSP failed: %d\n",
__func__, ret);
dev_err_ratelimited(sdev->dev,
"%s: resuming DSP failed: %d\n",
__func__, ret);
return ret;
}
}
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/sof/ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,15 @@ static int ipc4_wait_tx_done(struct snd_sof_ipc *ipc, void *reply_data)
ret = wait_event_timeout(msg->waitq, msg->ipc_complete,
msecs_to_jiffies(sdev->ipc_timeout));
if (ret == 0) {
dev_err(sdev->dev, "ipc timed out for %#x|%#x\n",
ipc4_msg->primary, ipc4_msg->extension);
dev_err_ratelimited(sdev->dev, "ipc timed out for %#x|%#x\n",
ipc4_msg->primary, ipc4_msg->extension);
snd_sof_handle_fw_exception(ipc->sdev, "IPC timeout");
return -ETIMEDOUT;
}

if (msg->reply_error) {
dev_err(sdev->dev, "ipc error for msg %#x|%#x\n",
ipc4_msg->primary, ipc4_msg->extension);
dev_err_ratelimited(sdev->dev, "ipc error for msg %#x|%#x\n",
ipc4_msg->primary, ipc4_msg->extension);
ret = msg->reply_error;
} else {
if (reply_data) {
Expand Down
31 changes: 17 additions & 14 deletions sound/soc/sof/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ sof_pcm_setup_connected_widgets(struct snd_sof_dev *sdev, struct snd_soc_pcm_run

ret = sof_widget_list_prepare(sdev, spcm, params, platform_params, dir);
if (ret < 0) {
spcm_err(spcm, dir, "widget list prepare failed\n");
spcm_err_ratelimited(spcm, dir, "widget list prepare failed\n");
spcm->stream[dir].list = NULL;
snd_soc_dapm_dai_free_widgets(&list);
return ret;
Expand Down Expand Up @@ -162,7 +162,8 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
platform_params = &spcm->platform_params[substream->stream];
ret = snd_sof_pcm_platform_hw_params(sdev, substream, params, platform_params);
if (ret < 0) {
spcm_err(spcm, substream->stream, "platform hw params failed\n");
spcm_err_ratelimited(spcm, substream->stream,
"platform hw params failed\n");
return ret;
}

Expand All @@ -179,8 +180,9 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,

host_widget = snd_sof_find_swidget_by_comp_id(sdev, host_comp_id);
if (!host_widget) {
spcm_err(spcm, substream->stream,
"failed to find host widget with comp_id %d\n", host_comp_id);
spcm_err_ratelimited(spcm, substream->stream,
"failed to find host widget with comp_id %d\n",
host_comp_id);
return -EINVAL;
}

Expand Down Expand Up @@ -226,8 +228,8 @@ static int sof_pcm_stream_free(struct snd_sof_dev *sdev,
ret = pcm_ops->hw_free(sdev->component, substream, spcm,
substream->stream);
if (ret < 0) {
spcm_err(spcm, substream->stream,
"pcm_ops->hw_free failed %d\n", ret);
spcm_err_ratelimited(spcm, substream->stream,
"pcm_ops->hw_free failed %d\n", ret);
err = ret;
}
}
Expand All @@ -239,8 +241,8 @@ static int sof_pcm_stream_free(struct snd_sof_dev *sdev,
/* reset the DMA */
ret = snd_sof_pcm_platform_hw_free(sdev, substream);
if (ret < 0) {
spcm_err(spcm, substream->stream,
"platform hw free failed %d\n", ret);
spcm_err_ratelimited(spcm, substream->stream,
"platform hw free failed %d\n", ret);
if (!err)
err = ret;
}
Expand All @@ -249,8 +251,8 @@ static int sof_pcm_stream_free(struct snd_sof_dev *sdev,
if (free_widget_list) {
ret = sof_widget_list_free(sdev, spcm, dir);
if (ret < 0) {
spcm_err(spcm, substream->stream,
"sof_widget_list_free failed %d\n", ret);
spcm_err_ratelimited(spcm, substream->stream,
"sof_widget_list_free failed %d\n", ret);
if (!err)
err = ret;
}
Expand Down Expand Up @@ -351,8 +353,8 @@ static int sof_pcm_prepare(struct snd_soc_component *component,

ret = sof_pcm_hw_params(component, substream, &spcm->params[substream->stream]);
if (ret < 0) {
spcm_err(spcm, substream->stream,
"failed to set hw_params after resume\n");
spcm_err_ratelimited(spcm, substream->stream,
"failed to set hw_params after resume\n");
return ret;
}

Expand All @@ -361,8 +363,9 @@ static int sof_pcm_prepare(struct snd_soc_component *component,
platform_params = &spcm->platform_params[substream->stream];
ret = sof_widget_list_setup(sdev, spcm, params, platform_params, dir);
if (ret < 0) {
dev_err(sdev->dev, "failed widget list set up for pcm %d dir %u\n",
le32_to_cpu(spcm->pcm.pcm_id), dir);
dev_err_ratelimited(sdev->dev,
"failed widget list set up for pcm %d dir %u\n",
le32_to_cpu(spcm->pcm.pcm_id), dir);
spcm->stream[dir].list = NULL;
snd_soc_dapm_dai_free_widgets(&list);
return ret;
Expand Down
6 changes: 6 additions & 0 deletions sound/soc/sof/sof-audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,12 @@ struct snd_sof_widget *snd_sof_find_swidget_by_comp_id(struct snd_sof_dev *sdev,
(__spcm)->pcm.pcm_name, __dir, \
##__VA_ARGS__)

#define spcm_err_ratelimited(__spcm, __dir, __fmt, ...) \
dev_err_ratelimited((__spcm)->scomp->dev, "%s: pcm%u (%s), dir %d: " __fmt, \
__func__, le32_to_cpu((__spcm)->pcm.pcm_id), \
(__spcm)->pcm.pcm_name, __dir, \
##__VA_ARGS__)

#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)
void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream);
void snd_sof_compr_init_elapsed_work(struct work_struct *work);
Expand Down