Commit c85578e7 authored by Mark Brown's avatar Mark Brown

ASoC: SOF: ipc4-topology: Fix nhlt configuration blob

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

The existing logic to pick a DMIC blob is based on several historical
assumptions that the NHLT in BIOS always contains 32-bits per sample
type (first patch, [1]).

The other issue with the existing logic is that it was designed to care only
about the bit depth of the format and fails to find the existing and correct
blob when rate/channels are different on the FE side compared to what we should
be using on the DAI side (we have components in path which can change
rate/channel count).

These issues have not been observed in past but with new MTL based (Windows)
laptops and new topologies to enhance the audio quality, we started to see weird
issues around how our assumptions of vendors failed.

Since some NHLT blob handling cleanup has been done for 6.10, this series will
complete that work to cover even cases that we don't anticipate to see.

[1] https://github.com/thesofproject/linux/issues/4973
parents ba2e8323 b65456b7
...@@ -650,7 +650,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -650,7 +650,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct sof_ipc4_audio_format *ipc4_fmt; struct sof_ipc4_audio_format *ipc4_fmt;
struct sof_ipc4_copier *ipc4_copier; struct sof_ipc4_copier *ipc4_copier;
bool single_fmt = false; bool single_bitdepth = false;
u32 valid_bits = 0; u32 valid_bits = 0;
int dir, ret; int dir, ret;
...@@ -682,18 +682,18 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -682,18 +682,18 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
return 0; return 0;
if (dir == SNDRV_PCM_STREAM_PLAYBACK) { if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
if (sof_ipc4_copier_is_single_format(sdev, if (sof_ipc4_copier_is_single_bitdepth(sdev,
available_fmt->output_pin_fmts, available_fmt->output_pin_fmts,
available_fmt->num_output_formats)) { available_fmt->num_output_formats)) {
ipc4_fmt = &available_fmt->output_pin_fmts->audio_fmt; ipc4_fmt = &available_fmt->output_pin_fmts->audio_fmt;
single_fmt = true; single_bitdepth = true;
} }
} else { } else {
if (sof_ipc4_copier_is_single_format(sdev, if (sof_ipc4_copier_is_single_bitdepth(sdev,
available_fmt->input_pin_fmts, available_fmt->input_pin_fmts,
available_fmt->num_input_formats)) { available_fmt->num_input_formats)) {
ipc4_fmt = &available_fmt->input_pin_fmts->audio_fmt; ipc4_fmt = &available_fmt->input_pin_fmts->audio_fmt;
single_fmt = true; single_bitdepth = true;
} }
} }
} }
...@@ -703,7 +703,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -703,7 +703,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
if (ret) if (ret)
return ret; return ret;
if (single_fmt) { if (single_bitdepth) {
snd_mask_none(fmt); snd_mask_none(fmt);
valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(ipc4_fmt->fmt_cfg); valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(ipc4_fmt->fmt_cfg);
dev_dbg(component->dev, "Set %s to %d bit format\n", dai->name, valid_bits); dev_dbg(component->dev, "Set %s to %d bit format\n", dai->name, valid_bits);
......
This diff is collapsed.
...@@ -476,7 +476,7 @@ struct sof_ipc4_process { ...@@ -476,7 +476,7 @@ struct sof_ipc4_process {
u32 init_config; u32 init_config;
}; };
bool sof_ipc4_copier_is_single_format(struct snd_sof_dev *sdev, bool sof_ipc4_copier_is_single_bitdepth(struct snd_sof_dev *sdev,
struct sof_ipc4_pin_format *pin_fmts, struct sof_ipc4_pin_format *pin_fmts,
u32 pin_fmts_size); u32 pin_fmts_size);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment