Commit dc90bbef authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul
Browse files

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: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarLiam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Tested-by: default avatar <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20250227140615.8147-5-yung-chuan.liao@linux.intel.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent df896e4f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+4 −2
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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;