Skip to content

Commit 9c9d463

Browse files
ujfalusibardliao
authored andcommitted
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 <[email protected]>
1 parent 3ae7c1f commit 9c9d463

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
@@ -1577,7 +1577,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15771577
u32 channels;
15781578
u32 rate;
15791579
u32 type;
1580-
bool single_format;
15811580
int sample_valid_bits;
15821581
int sample_type;
15831582
int i = 0;
@@ -1587,10 +1586,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15871586
return -EINVAL;
15881587
}
15891588

1590-
single_format = sof_ipc4_is_single_format(sdev, pin_fmts, pin_fmts_size);
1591-
if (single_format)
1592-
goto in_fmt;
1593-
15941589
sample_valid_bits = sof_ipc4_get_valid_bits(sdev, params);
15951590
if (sample_valid_bits < 0)
15961591
return sample_valid_bits;
@@ -1615,16 +1610,15 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
16151610
type = sof_ipc4_fmt_cfg_to_type(fmt->fmt_cfg);
16161611
if (params_rate(params) == rate && params_channels(params) == channels &&
16171612
sample_valid_bits == valid_bits && sample_type == type)
1618-
break;
1613+
goto in_fmt;
16191614
}
16201615

1621-
if (i == pin_fmts_size) {
1622-
dev_err(sdev->dev,
1623-
"%s: Unsupported audio format: %uHz, %ubit, %u channels, type: %d\n",
1624-
__func__, params_rate(params), sample_valid_bits,
1625-
params_channels(params), sample_type);
1626-
return -EINVAL;
1627-
}
1616+
dev_err(sdev->dev,
1617+
"%s: Unsupported audio format: %uHz, %ubit, %u channels, type: %d\n",
1618+
__func__, params_rate(params), sample_valid_bits,
1619+
params_channels(params), sample_type);
1620+
1621+
return -EINVAL;
16281622

16291623
in_fmt:
16301624
/* copy input format */

0 commit comments

Comments
 (0)