]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
soundwire: stream: extend sdw_alloc_stream() to take 'type' parameter
authorPierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Mon, 5 Jan 2026 15:10:07 +0000 (10:10 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:15:04 +0000 (10:15 +0100)
[ Upstream commit dc90bbefa792031d89fe2af9ad4a6febd6be96a9 ]

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>
Tested-by: shumingf@realtek.com
Link: https://lore.kernel.org/r/20250227140615.8147-5-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Stable-dep-of: bcba17279327 ("ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/driver-api/soundwire/stream.rst
drivers/soundwire/stream.c
include/linux/soundwire/sdw.h
sound/soc/qcom/sdw.c

index 2a794484f62c970a95cd35fa688b98fc9bbf2a63..d662012996335600a7ddf3c1e1580ba11150d6da 100644 (file)
@@ -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
index 6c1e3aed8162487c59036b578dd86c1edf9219c9..9764da386921fb0302047416e66a39e7e203952a 100644 (file)
@@ -1744,12 +1744,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;
 
@@ -1761,6 +1762,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;
 }
@@ -1789,7 +1791,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;
index 5e0dd47a041240fe7ec64c15c4f180c878fc231b..cfb89989b369347d6956048b874da08ee33615a2 100644 (file)
@@ -1024,7 +1024,7 @@ struct sdw_stream_runtime {
        int m_rt_count;
 };
 
-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);
index f2eda2ff46c04f47b0a992cb42aa7837eb2fd382..875da4adb1d7b4efdee47baa4fa8a3c1305e6c04 100644 (file)
@@ -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;