mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: ipc4-pcm: Fix incorrect comparison with number of tdm_slots
@ 2025-08-19 16:05 Richard Fitzgerald
  2025-09-19 12:54 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Fitzgerald @ 2025-08-19 16:05 UTC (permalink / raw)
  To: broonie, peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
	kai.vehmanen
  Cc: sound-open-firmware, linux-sound, linux-kernel, patches

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")
---
 sound/soc/sof/ipc4-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/ipc4-pcm.c b/sound/soc/sof/ipc4-pcm.c
index 374dc10d10fd..86f7377fb92f 100644
--- a/sound/soc/sof/ipc4-pcm.c
+++ b/sound/soc/sof/ipc4-pcm.c
@@ -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 */
-- 
2.39.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: SOF: ipc4-pcm: Fix incorrect comparison with number of tdm_slots
  2025-08-19 16:05 [PATCH] ASoC: SOF: ipc4-pcm: Fix incorrect comparison with number of tdm_slots Richard Fitzgerald
@ 2025-09-19 12:54 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-09-19 12:54 UTC (permalink / raw)
  To: peter.ujfalusi, yung-chuan.liao, ranjani.sridharan, kai.vehmanen,
	Richard Fitzgerald
  Cc: sound-open-firmware, linux-sound, linux-kernel, patches

On Tue, 19 Aug 2025 17:05:25 +0100, Richard Fitzgerald wrote:
> 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.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: ipc4-pcm: Fix incorrect comparison with number of tdm_slots
      commit: 62a7b3bbb6b873fdcc85a37efbd0102d66c8a73e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-19 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-19 16:05 [PATCH] ASoC: SOF: ipc4-pcm: Fix incorrect comparison with number of tdm_slots Richard Fitzgerald
2025-09-19 12:54 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®