]> www.infradead.org Git - users/hch/misc.git/commitdiff
ASoC: SOF: ipc4-pcm: Fix incorrect comparison with number of tdm_slots
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Tue, 19 Aug 2025 16:05:25 +0000 (17:05 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 18 Sep 2025 21:23:57 +0000 (22:23 +0100)
In ipc4_ssp_dai_config_pcm_params_match() when comparing params_channels()
against hw_config->tdm_slots the comparison should be a <= not a ==.

The number of TDM slots must be enough for the number of required channels.
But it can be greater. There are various reason why a I2S/TDM link has more
TDM slots than a particular audio stream needs.

The original comparison would fail on systems that had more TDM slots.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 8a07944a77e9 ("ASoC: SOF: ipc4-pcm: Look for best matching hw_config for SSP")
Link: https://patch.msgid.link/20250819160525.423416-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc4-pcm.c

index 374dc10d10fd52c261267cae3729b76a479f1297..86f7377fb92facf666ade3d693a96a7f402642ee 100644 (file)
@@ -639,14 +639,14 @@ static int ipc4_ssp_dai_config_pcm_params_match(struct snd_sof_dev *sdev,
 
                if (params_rate(params) == le32_to_cpu(hw_config->fsync_rate) &&
                    params_width(params) == le32_to_cpu(hw_config->tdm_slot_width) &&
-                   params_channels(params) == le32_to_cpu(hw_config->tdm_slots)) {
+                   params_channels(params) <= le32_to_cpu(hw_config->tdm_slots)) {
                        current_config = le32_to_cpu(hw_config->id);
                        partial_match = false;
                        /* best match found */
                        break;
                } else if (current_config < 0 &&
                           params_rate(params) == le32_to_cpu(hw_config->fsync_rate) &&
-                          params_channels(params) == le32_to_cpu(hw_config->tdm_slots)) {
+                          params_channels(params) <= le32_to_cpu(hw_config->tdm_slots)) {
                        current_config = le32_to_cpu(hw_config->id);
                        partial_match = true;
                        /* keep looking for better match */