Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org
Cc: tiwai@suse.com, perex@perex.cz,
	amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 3/9] ASoC: Intel: avs: Fix PPLCxFMT calculation
Date: Fri, 30 May 2025 16:10:19 +0200	[thread overview]
Message-ID: <20250530141025.2942936-4-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20250530141025.2942936-1-cezary.rojewski@intel.com>

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>
---
 sound/soc/intel/avs/pcm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c
index 405cfc1ab0cb..d1acc636add7 100644
--- a/sound/soc/intel/avs/pcm.c
+++ b/sound/soc/intel/avs/pcm.c
@@ -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);
-- 
2.25.1


  parent reply	other threads:[~2025-05-30 13:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 14:10 [PATCH 0/9] ASoC: Intel: avs: Set of functional fixes Cezary Rojewski
2025-05-30 14:10 ` [PATCH 1/9] ASoC: codecs: hda: Fix RPM usage count underflow Cezary Rojewski
2025-05-30 14:10 ` [PATCH 2/9] ASoC: Intel: avs: Fix deadlock when the failing IPC is SET_D0IX Cezary Rojewski
2025-05-30 14:10 ` Cezary Rojewski [this message]
2025-05-30 14:10 ` [PATCH 4/9] ASoC: Intel: avs: Fix possible null-ptr-deref when initing hw Cezary Rojewski
2025-05-30 14:10 ` [PATCH 5/9] ASoC: Intel: avs: Fix paths in MODULE_FIRMWARE hints Cezary Rojewski
2025-05-30 14:10 ` [PATCH 6/9] ASoC: Intel: avs: Verify kcalloc() status when setting constraints Cezary Rojewski
2025-05-30 14:10 ` [PATCH 7/9] ASoC: Intel: avs: Verify content returned by parse_int_array() Cezary Rojewski
2025-05-30 14:10 ` [PATCH 8/9] ASoC: Intel: avs: Simplify verification of parse_int_array() result Cezary Rojewski
2025-05-30 14:10 ` [PATCH 9/9] ASoC: Intel: avs: Include missing string.h Cezary Rojewski
2025-06-02 16:42 ` (subset) [PATCH 0/9] ASoC: Intel: avs: Set of functional fixes Mark Brown
2025-06-03 10:57   ` Cezary Rojewski
2025-06-03 11:01     ` Mark Brown
2025-06-03 11:03       ` Cezary Rojewski
2025-06-03 16:04 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250530141025.2942936-4-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox