ASoC: SOF: ipc4-pcm: Look for best matching hw_config for SSP
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 19 Jun 2025 10:26:57 +0000 (13:26 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 19 Jun 2025 23:21:13 +0000 (00:21 +0100)
commit8a07944a77e962b625c582696497964c393a3489
tree2c6ba6561ed99bc00e47189f9161d0ded12f544a
parent7f8924e8785b68c998bc1906e049bf5595865e60
ASoC: SOF: ipc4-pcm: Look for best matching hw_config for SSP

Instead of just looking for a hw_config with matching rate only it sounds
better to try to find the best matching configuration.

If we have multiple hw_configurations with the same rate, but each with
different format for example then we have been picking the first config
with the matching rate, which can be a problem and it wil depend on how
the configs are ordered.

Instead we should be trying to find the best match out of the configs
1. rate + format + channels are matching
2. rate + format are matching
3. rate matching

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://patch.msgid.link/20250619102657.12109-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc4-pcm.c