Skip to content

Commit fbea2d8

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 86aa6e9 commit fbea2d8

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15661566
u32 channels;
15671567
u32 rate;
15681568
u32 type;
1569-
bool single_format;
15701569
int sample_valid_bits;
15711570
int sample_type;
15721571
int i = 0;
@@ -1576,10 +1575,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15761575
return -EINVAL;
15771576
}
15781577

1579-
single_format = sof_ipc4_is_single_format(sdev, pin_fmts, pin_fmts_size);
1580-
if (single_format)
1581-
goto in_fmt;
1582-
15831578
sample_valid_bits = sof_ipc4_get_valid_bits(sdev, params);
15841579
if (sample_valid_bits < 0)
15851580
return sample_valid_bits;
@@ -1604,16 +1599,15 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
16041599
type = sof_ipc4_fmt_cfg_to_type(fmt->fmt_cfg);
16051600
if (params_rate(params) == rate && params_channels(params) == channels &&
16061601
sample_valid_bits == valid_bits && sample_type == type)
1607-
break;
1602+
goto in_fmt;
16081603
}
16091604

1610-
if (i == pin_fmts_size) {
1611-
dev_err(sdev->dev,
1612-
"%s: Unsupported audio format: %uHz, %ubit, %u channels, type: %d\n",
1613-
__func__, params_rate(params), sample_valid_bits,
1614-
params_channels(params), sample_type);
1615-
return -EINVAL;
1616-
}
1605+
dev_err(sdev->dev,
1606+
"%s: Unsupported audio format: %uHz, %ubit, %u channels, type: %d\n",
1607+
__func__, params_rate(params), sample_valid_bits,
1608+
params_channels(params), sample_type);
1609+
1610+
return -EINVAL;
16171611

16181612
in_fmt:
16191613
/* copy input format */

0 commit comments

Comments
 (0)