Skip to content

Commit 80d7c2e

Browse files
kv2019iplbossart
authored andcommitted
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 d7a6729 commit 80d7c2e

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

sound/soc/sof/ipc4-topology.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,21 +1601,9 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
16011601
out_sample_valid_bits =
16021602
SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(copier_data->out_format.fmt_cfg);
16031603
snd_mask_none(fmt);
1604-
switch (out_sample_valid_bits) {
1605-
case 16:
1606-
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
1607-
break;
1608-
case 24:
1609-
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
1610-
break;
1611-
case 32:
1612-
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S32_LE);
1613-
break;
1614-
default:
1615-
dev_err(sdev->dev, "invalid sample frame format %d\n",
1616-
params_format(pipeline_params));
1617-
return -EINVAL;
1618-
}
1604+
ret = ipc4_set_fmt_mask(fmt, out_sample_valid_bits);
1605+
if (ret)
1606+
return ret;
16191607

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

0 commit comments

Comments
 (0)