[PATCH 2/3] soundwire: qcom: set owner device of runtime stream

From: Krzysztof Kozlowski
Date: Wed Oct 25 2023 - 10:46:38 EST


From: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>

Store the pointer to struct device of Soundwire controller owning this
runtime stream. This can be later used by Soundwire devices, to check
if their DAI prepare callback is called for the same bus, in cases where
multiple Soundwire buses are used in same soundcard codec list.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
Co-developed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
---
drivers/soundwire/qcom.c | 1 +
include/linux/soundwire/sdw.h | 2 ++
2 files changed, 3 insertions(+)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index fe65c26c5281..a95f39563b47 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1298,6 +1298,7 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream,
goto err_alloc;
}

+ sruntime->dev = ctrl->bus.dev;
ctrl->sruntime[dai->id] = sruntime;

for_each_rtd_codec_dais(rtd, i, codec_dai) {
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index 4f3d14bb1538..650334adc261 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -1023,6 +1023,7 @@ struct sdw_stream_params {
* master_list can contain only one m_rt per Master instance
* for a stream
* @m_rt_count: Count of Master runtime(s) in this stream
+ * @dev: SoundWire controller owning this runtime stream
*/
struct sdw_stream_runtime {
const char *name;
@@ -1031,6 +1032,7 @@ struct sdw_stream_runtime {
enum sdw_stream_type type;
struct list_head master_list;
int m_rt_count;
+ struct device *dev;
};

struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name);
--
2.34.1