Skip to content

Commit dc90bbe

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: stream: extend sdw_alloc_stream() to take 'type' parameter
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>
1 parent df896e4 commit dc90bbe

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

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
@@ -1806,12 +1806,13 @@ static int set_stream(struct snd_pcm_substream *substream,
18061806
* sdw_alloc_stream() - Allocate and return stream runtime
18071807
*
18081808
* @stream_name: SoundWire stream name
1809+
* @type: stream type (could be PCM ,PDM or BPT)
18091810
*
18101811
* Allocates a SoundWire stream runtime instance.
18111812
* sdw_alloc_stream should be called only once per stream. Typically
18121813
* invoked from ALSA/ASoC machine/platform driver.
18131814
*/
1814-
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name)
1815+
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type)
18151816
{
18161817
struct sdw_stream_runtime *stream;
18171818

@@ -1823,6 +1824,7 @@ struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name)
18231824
INIT_LIST_HEAD(&stream->master_list);
18241825
stream->state = SDW_STREAM_ALLOCATED;
18251826
stream->m_rt_count = 0;
1827+
stream->type = type;
18261828

18271829
return stream;
18281830
}
@@ -1851,7 +1853,7 @@ int sdw_startup_stream(void *sdw_substream)
18511853
if (!name)
18521854
return -ENOMEM;
18531855

1854-
sdw_stream = sdw_alloc_stream(name);
1856+
sdw_stream = sdw_alloc_stream(name, SDW_STREAM_PCM);
18551857
if (!sdw_stream) {
18561858
dev_err(rtd->dev, "alloc stream failed for substream DAI %s\n", substream->name);
18571859
ret = -ENOMEM;

include/linux/soundwire/sdw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ struct sdw_bus {
10191019
unsigned int lane_used_bandwidth[SDW_MAX_LANES];
10201020
};
10211021

1022-
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name);
1022+
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type);
10231023
void sdw_release_stream(struct sdw_stream_runtime *stream);
10241024

10251025
int sdw_compute_params(struct sdw_bus *bus, struct sdw_stream_runtime *stream);

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)