Skip to content

Commit

Permalink
ASoC: SOF: ipc4-pcm: use common helper function in copier prepare
Browse files Browse the repository at this point in the history
Use the ipc4_set_fmt_mask() helper function instead of open-coding
the logic in multiple places.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
  • Loading branch information
kv2019i authored and plbossart committed Feb 16, 2023
1 parent d7a6729 commit 80d7c2e
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions sound/soc/sof/ipc4-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1601,21 +1601,9 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
out_sample_valid_bits =
SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(copier_data->out_format.fmt_cfg);
snd_mask_none(fmt);
switch (out_sample_valid_bits) {
case 16:
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
break;
case 24:
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
break;
case 32:
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
break;
default:
dev_err(sdev->dev, "invalid sample frame format %d\n",
params_format(pipeline_params));
return -EINVAL;
}
ret = ipc4_set_fmt_mask(fmt, out_sample_valid_bits);
if (ret)
return ret;

/*
* Set the gateway dma_buffer_size to 2ms buffer size to meet the FW expectation. In the
Expand Down

0 comments on commit 80d7c2e

Please sign in to comment.