Skip to content

Commit 2af0d03

Browse files
committed
ASoC: SOF: ipc4-pcm: use common helper function in copier prepare
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>
1 parent 98834fa commit 2af0d03

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,21 +1553,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
15531553
out_sample_valid_bits =
15541554
SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(copier_data->out_format.fmt_cfg);
15551555
snd_mask_none(fmt);
1556-
switch (out_sample_valid_bits) {
1557-
case 16:
1558-
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
1559-
break;
1560-
case 24:
1561-
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
1562-
break;
1563-
case 32:
1564-
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
1565-
break;
1566-
default:
1567-
dev_err(sdev->dev, "invalid sample frame format %d\n",
1568-
params_format(pipeline_params));
1569-
return -EINVAL;
1570-
}
1556+
ret = ipc4_set_fmt_mask(fmt, out_sample_valid_bits);
15711557

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

0 commit comments

Comments
 (0)