Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Pierre-Louis Bossart and committed by
Vinod Koul
dc90bbef df896e4f

+7 -5
+1 -1
Documentation/driver-api/soundwire/stream.rst
··· 291 291 292 292 .. code-block:: c 293 293 294 - int sdw_alloc_stream(char * stream_name); 294 + int sdw_alloc_stream(char * stream_name, enum sdw_stream_type type); 295 295 296 296 The SoundWire core provides a sdw_startup_stream() helper function, 297 297 typically called during a dailink .startup() callback, which performs
+4 -2
drivers/soundwire/stream.c
··· 1806 1806 * sdw_alloc_stream() - Allocate and return stream runtime 1807 1807 * 1808 1808 * @stream_name: SoundWire stream name 1809 + * @type: stream type (could be PCM ,PDM or BPT) 1809 1810 * 1810 1811 * Allocates a SoundWire stream runtime instance. 1811 1812 * sdw_alloc_stream should be called only once per stream. Typically 1812 1813 * invoked from ALSA/ASoC machine/platform driver. 1813 1814 */ 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) 1815 1816 { 1816 1817 struct sdw_stream_runtime *stream; 1817 1818 ··· 1824 1823 INIT_LIST_HEAD(&stream->master_list); 1825 1824 stream->state = SDW_STREAM_ALLOCATED; 1826 1825 stream->m_rt_count = 0; 1826 + stream->type = type; 1827 1827 1828 1828 return stream; 1829 1829 } ··· 1853 1851 if (!name) 1854 1852 return -ENOMEM; 1855 1853 1856 - sdw_stream = sdw_alloc_stream(name); 1854 + sdw_stream = sdw_alloc_stream(name, SDW_STREAM_PCM); 1857 1855 if (!sdw_stream) { 1858 1856 dev_err(rtd->dev, "alloc stream failed for substream DAI %s\n", substream->name); 1859 1857 ret = -ENOMEM;
+1 -1
include/linux/soundwire/sdw.h
··· 1019 1019 unsigned int lane_used_bandwidth[SDW_MAX_LANES]; 1020 1020 }; 1021 1021 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); 1023 1023 void sdw_release_stream(struct sdw_stream_runtime *stream); 1024 1024 1025 1025 int sdw_compute_params(struct sdw_bus *bus, struct sdw_stream_runtime *stream);
+1 -1
sound/soc/qcom/sdw.c
··· 27 27 struct snd_soc_dai *codec_dai; 28 28 int ret, i; 29 29 30 - sruntime = sdw_alloc_stream(cpu_dai->name); 30 + sruntime = sdw_alloc_stream(cpu_dai->name, SDW_STREAM_PCM); 31 31 if (!sruntime) 32 32 return -ENOMEM; 33 33