public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org, tiwai@suse.com, perex@perex.cz
Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
	amadeuszx.slawinski@linux.intel.com,
	pierre-louis.bossart@linux.intel.com, hdegoede@redhat.com,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH v5 08/16] ASoC: codecs: hda: Switch to new stream-format interface
Date: Fri, 17 Nov 2023 13:06:02 +0100	[thread overview]
Message-ID: <20231117120610.1755254-9-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20231117120610.1755254-1-cezary.rojewski@intel.com>

To provide option for selecting different bit-per-sample than just the
maximum one, use the new format calculation mechanism.

While at it, complete PCM stream initialization with subformat options.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/codecs/hda-dai.c | 7 +++++--
 sound/soc/codecs/hda.c     | 2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/hda-dai.c b/sound/soc/codecs/hda-dai.c
index 5371ff086261..7bd7ddcd810f 100644
--- a/sound/soc/codecs/hda-dai.c
+++ b/sound/soc/codecs/hda-dai.c
@@ -76,13 +76,16 @@ static int hda_codec_dai_prepare(struct snd_pcm_substream *substream, struct snd
 	struct hdac_stream *stream;
 	struct hda_codec *codec;
 	unsigned int format;
+	unsigned int bits;
 	int ret;
 
 	codec = dev_to_hda_codec(dai->dev);
 	stream = substream->runtime->private_data;
 	stream_info = snd_soc_dai_get_dma_data(dai, substream);
-	format = snd_hdac_calc_stream_format(runtime->rate, runtime->channels, runtime->format,
-					     runtime->sample_bits, 0);
+
+	bits = snd_hdac_stream_format_bits(runtime->format, runtime->subformat,
+					   stream_info->maxbps);
+	format = snd_hdac_stream_format(runtime->channels, bits, runtime->rate);
 
 	ret = snd_hda_codec_prepare(codec, stream_info, stream->stream_tag, format, substream);
 	if (ret < 0) {
diff --git a/sound/soc/codecs/hda.c b/sound/soc/codecs/hda.c
index d57b043d6bfe..d2117e36ddd1 100644
--- a/sound/soc/codecs/hda.c
+++ b/sound/soc/codecs/hda.c
@@ -52,6 +52,7 @@ static int hda_codec_create_dais(struct hda_codec *codec, int pcm_count,
 		stream->channels_max = pcm->stream[dir].channels_max;
 		stream->rates = pcm->stream[dir].rates;
 		stream->formats = pcm->stream[dir].formats;
+		stream->subformats = pcm->stream[dir].subformats;
 		stream->sig_bits = pcm->stream[dir].maxbps;
 
 capture_dais:
@@ -71,6 +72,7 @@ static int hda_codec_create_dais(struct hda_codec *codec, int pcm_count,
 		stream->channels_max = pcm->stream[dir].channels_max;
 		stream->rates = pcm->stream[dir].rates;
 		stream->formats = pcm->stream[dir].formats;
+		stream->subformats = pcm->stream[dir].subformats;
 		stream->sig_bits = pcm->stream[dir].maxbps;
 	}
 
-- 
2.25.1


  parent reply	other threads:[~2023-11-17 12:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 12:05 [PATCH v5 00/16] ALSA/ASoC: hda: Address format selection limitations and ambiguity Cezary Rojewski
2023-11-17 12:05 ` [PATCH v5 01/16] ALSA: pcm: Introduce MSBITS subformat interface Cezary Rojewski
2023-11-17 12:05 ` [PATCH v5 02/16] ALSA: hda: Honor subformat when querying PCMs Cezary Rojewski
2023-11-17 12:05 ` [PATCH v5 03/16] ASoC: pcm: Honor subformat when configuring runtime Cezary Rojewski
2023-11-17 12:05 ` [PATCH v5 04/16] ALSA: hda: Upgrade stream-format infrastructure Cezary Rojewski
2023-11-17 12:05 ` [PATCH v5 05/16] ALSA: hda: Switch to new stream-format interface Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 06/16] ALSA: hda/hdmi: " Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 07/16] ALSA: hda/ca0132: " Cezary Rojewski
2023-11-17 12:06 ` Cezary Rojewski [this message]
2023-11-17 12:06 ` [PATCH v5 09/16] ASoC: codecs: hdac_hda: " Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 10/16] ASoC: codecs: hdac_hdmi: " Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 11/16] ASoC: Intel Skylake: " Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 12/16] ASoC: SOF: Intel: " Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 13/16] ASoC: Intel: avs: " Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 14/16] ALSA: hda: Drop snd_hdac_calc_stream_format() Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 15/16] ASoC: Intel: avs: Kill S24_LE format Cezary Rojewski
2023-11-17 12:06 ` [PATCH v5 16/16] ASoC: Intel: avs: Unhardcode HDAudio BE DAI drivers description Cezary Rojewski
2023-11-27  9:37 ` [PATCH v5 00/16] ALSA/ASoC: hda: Address format selection limitations and ambiguity Takashi Iwai
2023-11-27 10:13   ` Jaroslav Kysela
2023-11-27 16:30     ` Takashi Iwai

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=20231117120610.1755254-9-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --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