Skip to content

Commit 09391c7

Browse files
committed
ASoC: SOF: ipc-topology: Add 8-bit formats
This patch enables use of 8-bit unsigned, A-law, and mu-law sample formats with IPC4 SOF. Change to function sof_ipc4_get_valid_bits() returns 8 bits for these ALSA formats. Change to function sof_ipc4_prepare_copier_module() is needed to handle properly all non 32-bit formats with SCS bit set. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 4468fe2 commit 09391c7

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,10 @@ static int sof_ipc4_init_output_audio_fmt(struct snd_sof_dev *sdev,
14261426
static int sof_ipc4_get_valid_bits(struct snd_sof_dev *sdev, struct snd_pcm_hw_params *params)
14271427
{
14281428
switch (params_format(params)) {
1429+
case SNDRV_PCM_FORMAT_U8:
1430+
case SNDRV_PCM_FORMAT_MU_LAW:
1431+
case SNDRV_PCM_FORMAT_A_LAW:
1432+
return 8;
14291433
case SNDRV_PCM_FORMAT_S16_LE:
14301434
return 16;
14311435
case SNDRV_PCM_FORMAT_S24_LE:
@@ -1942,10 +1946,20 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
19421946
host_dma_id = platform_params->stream_tag - 1;
19431947
pipeline->msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_HOST_ID(host_dma_id);
19441948

1945-
/* Set SCS bit for S16_LE format only */
19461949
if (params_format(fe_params) == SNDRV_PCM_FORMAT_S16_LE)
19471950
pipeline->msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_SCS_MASK;
19481951

1952+
/* Set SCS bit for 8 and 16 bit formats */
1953+
switch (params_format(fe_params)) {
1954+
case SNDRV_PCM_FORMAT_S16_LE:
1955+
case SNDRV_PCM_FORMAT_U8:
1956+
case SNDRV_PCM_FORMAT_A_LAW:
1957+
case SNDRV_PCM_FORMAT_MU_LAW:
1958+
pipeline->msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_SCS_MASK;
1959+
default:
1960+
break;
1961+
}
1962+
19491963
/*
19501964
* Despite its name the bitfield 'fifo_size' is used to define DMA buffer
19511965
* size. The expression calculates 2ms buffer size.

0 commit comments

Comments
 (0)