Skip to content

Commit 28b2ec0

Browse files
plbossartgregkh
authored andcommitted
soundwire: stream: extend sdw_alloc_stream() to take 'type' parameter
[ Upstream commit dc90bbe ] 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: bcba172 ("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>
1 parent 2cd2003 commit 28b2ec0

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

Documentation/driver-api/soundwire/stream.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ per stream. From ASoC DPCM framework, this stream state maybe linked to
291291

292292
.. code-block:: c
293293
294-
int sdw_alloc_stream(char * stream_name);
294+
int sdw_alloc_stream(char * stream_name, enum sdw_stream_type type);
295295
296296
The SoundWire core provides a sdw_startup_stream() helper function,
297297
typically called during a dailink .startup() callback, which performs

drivers/soundwire/stream.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,12 +1744,13 @@ static int set_stream(struct snd_pcm_substream *substream,
17441744
* sdw_alloc_stream() - Allocate and return stream runtime
17451745
*
17461746
* @stream_name: SoundWire stream name
1747+
* @type: stream type (could be PCM ,PDM or BPT)
17471748
*
17481749
* Allocates a SoundWire stream runtime instance.
17491750
* sdw_alloc_stream should be called only once per stream. Typically
17501751
* invoked from ALSA/ASoC machine/platform driver.
17511752
*/
1752-
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name)
1753+
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type)
17531754
{
17541755
struct sdw_stream_runtime *stream;
17551756

@@ -1761,6 +1762,7 @@ struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name)
17611762
INIT_LIST_HEAD(&stream->master_list);
17621763
stream->state = SDW_STREAM_ALLOCATED;
17631764
stream->m_rt_count = 0;
1765+
stream->type = type;
17641766

17651767
return stream;
17661768
}
@@ -1789,7 +1791,7 @@ int sdw_startup_stream(void *sdw_substream)
17891791
if (!name)
17901792
return -ENOMEM;
17911793

1792-
sdw_stream = sdw_alloc_stream(name);
1794+
sdw_stream = sdw_alloc_stream(name, SDW_STREAM_PCM);
17931795
if (!sdw_stream) {
17941796
dev_err(rtd->dev, "alloc stream failed for substream DAI %s\n", substream->name);
17951797
ret = -ENOMEM;

include/linux/soundwire/sdw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ struct sdw_stream_runtime {
10241024
int m_rt_count;
10251025
};
10261026

1027-
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name);
1027+
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type);
10281028
void sdw_release_stream(struct sdw_stream_runtime *stream);
10291029

10301030
int sdw_compute_params(struct sdw_bus *bus);

sound/soc/qcom/sdw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int qcom_snd_sdw_startup(struct snd_pcm_substream *substream)
2727
struct snd_soc_dai *codec_dai;
2828
int ret, i;
2929

30-
sruntime = sdw_alloc_stream(cpu_dai->name);
30+
sruntime = sdw_alloc_stream(cpu_dai->name, SDW_STREAM_PCM);
3131
if (!sruntime)
3232
return -ENOMEM;
3333

0 commit comments

Comments
 (0)