Skip to content

Commit 71da2a6

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 c6e20f3 commit 71da2a6

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
@@ -1491,7 +1491,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
14911491
u32 valid_bits;
14921492
u32 channels;
14931493
u32 rate;
1494-
bool single_format;
14951494
int sample_valid_bits;
14961495
int i = 0;
14971496

@@ -1500,10 +1499,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15001499
return -EINVAL;
15011500
}
15021501

1503-
single_format = sof_ipc4_is_single_format(sdev, pin_fmts, pin_fmts_size);
1504-
if (single_format)
1505-
goto in_fmt;
1506-
15071502
sample_valid_bits = sof_ipc4_get_valid_bits(sdev, params);
15081503
if (sample_valid_bits < 0)
15091504
return sample_valid_bits;
@@ -1523,14 +1518,13 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
15231518
valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt->fmt_cfg);
15241519
if (params_rate(params) == rate && params_channels(params) == channels &&
15251520
sample_valid_bits == valid_bits)
1526-
break;
1521+
goto in_fmt;
15271522
}
15281523

1529-
if (i == pin_fmts_size) {
1530-
dev_err(sdev->dev, "%s: Unsupported audio format: %uHz, %ubit, %u channels\n",
1531-
__func__, params_rate(params), sample_valid_bits, params_channels(params));
1532-
return -EINVAL;
1533-
}
1524+
dev_err(sdev->dev, "%s: Unsupported audio format: %uHz, %ubit, %u channels\n",
1525+
__func__, params_rate(params), sample_valid_bits, params_channels(params));
1526+
1527+
return -EINVAL;
15341528

15351529
in_fmt:
15361530
/* copy input format */

0 commit comments

Comments
 (0)