From: Bard Liao <yung-chuan.liao@linux.intel.com>
To: linux-sound@vger.kernel.org, broonie@kernel.org, tiwai@suse.de,
vkoul@kernel.org
Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org,
pierre-louis.bossart@linux.dev, bard.liao@intel.com
Subject: [PATCH v2 04/16] soundwire: stream: extend sdw_alloc_stream() to take 'type' parameter
Date: Mon, 24 Feb 2025 14:44:38 +0800 [thread overview]
Message-ID: <20250224064451.33772-5-yung-chuan.liao@linux.intel.com> (raw)
In-Reply-To: <20250224064451.33772-1-yung-chuan.liao@linux.intel.com>
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
In the existing definition of sdw_stream_runtime, the 'type' member is
never set and defaults to PCM. To prepare for the BPT/BRA support, we
need to special-case streams and make use of the 'type'.
No functional change for now, the implicit PCM type is now explicit.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
Documentation/driver-api/soundwire/stream.rst | 2 +-
drivers/soundwire/stream.c | 6 ++++--
include/linux/soundwire/sdw.h | 2 +-
sound/soc/qcom/sdw.c | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/Documentation/driver-api/soundwire/stream.rst b/Documentation/driver-api/soundwire/stream.rst
index 2a794484f62c..d66201299633 100644
--- a/Documentation/driver-api/soundwire/stream.rst
+++ b/Documentation/driver-api/soundwire/stream.rst
@@ -291,7 +291,7 @@ per stream. From ASoC DPCM framework, this stream state maybe linked to
.. code-block:: c
- int sdw_alloc_stream(char * stream_name);
+ int sdw_alloc_stream(char * stream_name, enum sdw_stream_type type);
The SoundWire core provides a sdw_startup_stream() helper function,
typically called during a dailink .startup() callback, which performs
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index dd8de88d8b46..ae6d1c767ab9 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1806,12 +1806,13 @@ static int set_stream(struct snd_pcm_substream *substream,
* sdw_alloc_stream() - Allocate and return stream runtime
*
* @stream_name: SoundWire stream name
+ * @type: stream type (could be PCM ,PDM or BPT)
*
* Allocates a SoundWire stream runtime instance.
* sdw_alloc_stream should be called only once per stream. Typically
* invoked from ALSA/ASoC machine/platform driver.
*/
-struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name)
+struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type)
{
struct sdw_stream_runtime *stream;
@@ -1823,6 +1824,7 @@ struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name)
INIT_LIST_HEAD(&stream->master_list);
stream->state = SDW_STREAM_ALLOCATED;
stream->m_rt_count = 0;
+ stream->type = type;
return stream;
}
@@ -1851,7 +1853,7 @@ int sdw_startup_stream(void *sdw_substream)
if (!name)
return -ENOMEM;
- sdw_stream = sdw_alloc_stream(name);
+ sdw_stream = sdw_alloc_stream(name, SDW_STREAM_PCM);
if (!sdw_stream) {
dev_err(rtd->dev, "alloc stream failed for substream DAI %s\n", substream->name);
ret = -ENOMEM;
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index 857b670eb9a5..ba58e2a52322 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -1019,7 +1019,7 @@ struct sdw_bus {
unsigned int lane_used_bandwidth[SDW_MAX_LANES];
};
-struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name);
+struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type);
void sdw_release_stream(struct sdw_stream_runtime *stream);
int sdw_compute_params(struct sdw_bus *bus, struct sdw_stream_runtime *stream);
diff --git a/sound/soc/qcom/sdw.c b/sound/soc/qcom/sdw.c
index f2eda2ff46c0..875da4adb1d7 100644
--- a/sound/soc/qcom/sdw.c
+++ b/sound/soc/qcom/sdw.c
@@ -27,7 +27,7 @@ int qcom_snd_sdw_startup(struct snd_pcm_substream *substream)
struct snd_soc_dai *codec_dai;
int ret, i;
- sruntime = sdw_alloc_stream(cpu_dai->name);
+ sruntime = sdw_alloc_stream(cpu_dai->name, SDW_STREAM_PCM);
if (!sruntime)
return -ENOMEM;
--
2.43.0
next prev parent reply other threads:[~2025-02-24 6:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 6:44 [PATCH v2 00/16] SoundWire/ASoC: add SDW BPT/BRA support Bard Liao
2025-02-24 6:44 ` [PATCH v2 01/16] Documentation: driver: add SoundWire BRA description Bard Liao
2025-02-24 6:44 ` [PATCH v2 02/16] soundwire: cadence: add BTP support for DP0 Bard Liao
2025-02-24 6:44 ` [PATCH v2 03/16] soundwire: extend sdw_stream_type to BPT Bard Liao
2025-02-24 6:44 ` Bard Liao [this message]
2025-02-24 6:44 ` [PATCH v2 05/16] soundwire: stream: special-case the bus compute_params() routine Bard Liao
2025-02-24 6:44 ` [PATCH v2 06/16] soundwire: stream: reuse existing code for BPT stream Bard Liao
2025-02-24 6:44 ` [PATCH v2 07/16] soundwire: bus: add send_async/wait APIs for BPT protocol Bard Liao
2025-02-24 6:44 ` [PATCH v2 08/16] soundwire: bus: add bpt_stream pointer Bard Liao
2025-02-24 6:44 ` [PATCH v2 09/16] soundwire: cadence: add BTP/BRA helpers to format data Bard Liao
2025-02-27 6:43 ` Vinod Koul
2025-02-24 6:44 ` [PATCH v2 10/16] soundwire: intel_auxdevice: add indirection for BPT send_async/wait Bard Liao
2025-02-24 6:44 ` [PATCH v2 11/16] ASoC: SOF: Intel: hda-sdw-bpt: add helpers for SoundWire BPT DMA Bard Liao
2025-02-24 14:07 ` Mark Brown
2025-02-24 6:44 ` [PATCH v2 12/16] soundwire: intel: add BPT context definition Bard Liao
2025-02-24 6:44 ` [PATCH v2 13/16] soundwire: intel_ace2x: add BPT send_async/wait callbacks Bard Liao
2025-02-24 6:44 ` [PATCH v2 14/16] ASoC: SOF: Intel: hda-sdw-bpt: add CHAIN_DMA support Bard Liao
2025-02-24 14:08 ` Mark Brown
2025-02-24 6:44 ` [PATCH v2 15/16] soundwire: debugfs: add interface for BPT/BRA transfers Bard Liao
2025-02-24 6:44 ` [PATCH v2 16/16] ASoC: rt711-sdca: add DP0 support Bard Liao
2025-02-24 14:13 ` 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=20250224064451.33772-5-yung-chuan.liao@linux.intel.com \
--to=yung-chuan.liao@linux.intel.com \
--cc=bard.liao@intel.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=pierre-louis.bossart@linux.dev \
--cc=tiwai@suse.de \
--cc=vinod.koul@linaro.org \
--cc=vkoul@kernel.org \
/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