]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: Intel: avs: Fix PPLCxFMT calculation
authorCezary Rojewski <cezary.rojewski@intel.com>
Fri, 30 May 2025 14:10:19 +0000 (16:10 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 2 Jun 2025 11:26:46 +0000 (12:26 +0100)
HDAudio transfer types utilize SDxFMT for front-end (HOST) and PPLCxFMT
for back-end (LINK) side when setting up the stream. BE's
substream->runtime duplicates FE runtime so switch to using BE's
hw_params to address incorrect format values on the LINK side when FE
and BE formats differ.

The problem is introduced with commit d070002a20fc ("ASoC: Intel: avs:
HDA PCM BE operations") but the code has been shuffled around since then
so direct 'Fixes:' tag does not apply.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20250530141025.2942936-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/pcm.c

index 405cfc1ab0cba63f25c8402f03fad9874cf8a3db..d1acc636add79a1b93761615c42d8dc205e41673 100644 (file)
@@ -450,9 +450,10 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn
 
 static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
 {
-       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct snd_soc_pcm_runtime *be = snd_soc_substream_to_rtd(substream);
        const struct snd_soc_pcm_stream *stream_info;
        struct hdac_ext_stream *link_stream;
+       const struct snd_pcm_hw_params *p;
        struct avs_dma_data *data;
        unsigned int format_val;
        unsigned int bits;
@@ -460,14 +461,15 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
 
        data = snd_soc_dai_get_dma_data(dai, substream);
        link_stream = data->link_stream;
+       p = &be->dpcm[substream->stream].hw_params;
 
        if (link_stream->link_prepared)
                return 0;
 
        stream_info = snd_soc_dai_get_pcm_stream(dai, substream->stream);
-       bits = snd_hdac_stream_format_bits(runtime->format, runtime->subformat,
+       bits = snd_hdac_stream_format_bits(params_format(p), params_subformat(p),
                                           stream_info->sig_bits);
-       format_val = snd_hdac_stream_format(runtime->channels, bits, runtime->rate);
+       format_val = snd_hdac_stream_format(params_channels(p), bits, params_rate(p));
 
        snd_hdac_ext_stream_decouple(&data->adev->base.core, link_stream, true);
        snd_hdac_ext_stream_reset(link_stream);