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 v4 03/16] ASoC: pcm: Honor subformat when configuring runtime
Date: Thu, 16 Nov 2023 12:22:42 +0100 [thread overview]
Message-ID: <20231116112255.1584795-4-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20231116112255.1584795-1-cezary.rojewski@intel.com>
Subformat options are ignored when setting up hardware parameters and
assigning PCM stream capabilities. Account for them to allow for
granular format selection.
As there is only one user currently (format S32_LE), subformat is
represented by a simple u32 and stores flags only for that one user
alone. Such approach allows for alloc/free-less code until there are
more users on the horizon.
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
include/sound/soc.h | 1 +
sound/soc/soc-pcm.c | 10 ++++++++++
2 files changed, 11 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 7792c393e238..ccc31bc41e92 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -620,6 +620,7 @@ enum snd_soc_trigger_order {
struct snd_soc_pcm_stream {
const char *stream_name;
u64 formats; /* SNDRV_PCM_FMTBIT_* */
+ u32 subformats; /* for S32_LE format, SNDRV_PCM_SUBFMTBIT_* */
unsigned int rates; /* SNDRV_PCM_RATE_* */
unsigned int rate_min; /* min rate */
unsigned int rate_max; /* max rate */
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 323e4d7b6adf..9d688917cce2 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -554,6 +554,12 @@ static void soc_pcm_hw_update_format(struct snd_pcm_hardware *hw,
hw->formats &= p->formats;
}
+static void soc_pcm_hw_update_subformat(struct snd_pcm_hardware *hw,
+ struct snd_soc_pcm_stream *p)
+{
+ hw->subformats &= p->subformats;
+}
+
/**
* snd_soc_runtime_calc_hw() - Calculate hw limits for a PCM stream
* @rtd: ASoC PCM runtime
@@ -592,6 +598,7 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
soc_pcm_hw_update_chan(hw, cpu_stream);
soc_pcm_hw_update_rate(hw, cpu_stream);
soc_pcm_hw_update_format(hw, cpu_stream);
+ soc_pcm_hw_update_subformat(hw, cpu_stream);
}
cpu_chan_min = hw->channels_min;
cpu_chan_max = hw->channels_max;
@@ -613,6 +620,7 @@ int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
soc_pcm_hw_update_chan(hw, codec_stream);
soc_pcm_hw_update_rate(hw, codec_stream);
soc_pcm_hw_update_format(hw, codec_stream);
+ soc_pcm_hw_update_subformat(hw, codec_stream);
}
/* Verify both a valid CPU DAI and a valid CODEC DAI were found */
@@ -1713,6 +1721,7 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream)
soc_pcm_hw_update_rate(hw, cpu_stream);
soc_pcm_hw_update_chan(hw, cpu_stream);
soc_pcm_hw_update_format(hw, cpu_stream);
+ soc_pcm_hw_update_subformat(hw, cpu_stream);
}
}
@@ -1750,6 +1759,7 @@ static void dpcm_runtime_setup_be_format(struct snd_pcm_substream *substream)
codec_stream = snd_soc_dai_get_pcm_stream(dai, stream);
soc_pcm_hw_update_format(hw, codec_stream);
+ soc_pcm_hw_update_subformat(hw, codec_stream);
}
}
}
--
2.25.1
next prev parent reply other threads:[~2023-11-16 11:21 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 11:22 [PATCH v4 00/16] ALSA/ASoC: hda: Address format selection limitations and ambiguity Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 01/16] ALSA: pcm: Introduce MSBITS subformat interface Cezary Rojewski
2023-11-16 15:10 ` Jaroslav Kysela
2023-11-17 11:45 ` Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 02/16] ALSA: hda: Honor subformat when querying PCMs Cezary Rojewski
2023-11-16 11:22 ` Cezary Rojewski [this message]
2023-11-16 11:22 ` [PATCH v4 04/16] ALSA: hda: Upgrade stream-format infrastructure Cezary Rojewski
2023-11-16 15:10 ` Jaroslav Kysela
2023-11-17 11:51 ` Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 05/16] ALSA: hda: Switch to new stream-format interface Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 06/16] ALSA: hda/hdmi: " Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 07/16] ALSA: hda/ca0132: " Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 08/16] ASoC: codecs: hda: " Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 09/16] ASoC: codecs: hdac_hda: " Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 10/16] ASoC: codecs: hdac_hdmi: " Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 11/16] ASoC: Intel Skylake: " Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 12/16] ASoC: SOF: Intel: " Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 13/16] ASoC: Intel: avs: " Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 14/16] ALSA: hda: Drop snd_hdac_calc_stream_format() Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 15/16] ASoC: Intel: avs: Kill S24_LE format Cezary Rojewski
2023-11-16 11:22 ` [PATCH v4 16/16] ASoC: Intel: avs: Unhardcode HDAudio BE DAI drivers description Cezary Rojewski
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=20231116112255.1584795-4-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