Skip to content

Commit 15ace47

Browse files
committed
ASoC: SOF: ipc4-topology: Always validate the input audio format on fmt init
Even if there is a single format supported by the module on it's input, it must be validated that it is matching with the reference parameters. The DAI copier's DAI side reference is adjusted to the formats it supports, but modules deep within the path might have incorrect configuration in topology (single format which is not matching with the previous module's output for example). This should be reported as errors and not silently accepted. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent dc4c99a commit 15ace47

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,7 +1548,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15481548
u32 channels;
15491549
u32 rate;
15501550
u32 type;
1551-
bool single_format;
15521551
int sample_valid_bits;
15531552
int sample_type;
15541553
int i = 0;
@@ -1558,10 +1557,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15581557
return -EINVAL;
15591558
}
15601559

1561-
single_format = sof_ipc4_is_single_format(sdev, pin_fmts, pin_fmts_size);
1562-
if (single_format)
1563-
goto in_fmt;
1564-
15651560
sample_valid_bits = sof_ipc4_get_valid_bits(sdev, params);
15661561
if (sample_valid_bits < 0)
15671562
return sample_valid_bits;
@@ -1586,14 +1581,13 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15861581
type = SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE(fmt->fmt_cfg);
15871582
if (params_rate(params) == rate && params_channels(params) == channels &&
15881583
sample_valid_bits == valid_bits && sample_type == type)
1589-
break;
1584+
goto in_fmt;
15901585
}
15911586

1592-
if (i == pin_fmts_size) {
1593-
dev_err(sdev->dev, "%s: Unsupported audio format: %uHz, %ubit, %u channels\n",
1594-
__func__, params_rate(params), sample_valid_bits, params_channels(params));
1595-
return -EINVAL;
1596-
}
1587+
dev_err(sdev->dev, "%s: Unsupported audio format: %uHz, %ubit, %u channels\n",
1588+
__func__, params_rate(params), sample_valid_bits, params_channels(params));
1589+
1590+
return -EINVAL;
15971591

15981592
in_fmt:
15991593
/* copy input format */

0 commit comments

Comments
 (0)