From 9ec8ccc97dd9bd089078574e0eab859c9ce95456 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 18 Sep 2026 01:45:07 +0000 Subject: [PATCH] ASoC: soc-dai: add snd_soc_dai_{set/to}_priv() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DAI parameter will be capsuled soon, will be not enable to access from each drivers. DAI priv has been mainly referred from SoundWire driver. Let's add snd_soc_dai_{set/to}_priv() for it. Signed-off-by: Kuninori Morimoto Reviewed-by: Charles Keepax Reviewed-by: Alvin Šipraga Link: https://patch.msgid.link/87fqz7jpst.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-dai.h | 2 ++ sound/soc/sdca/sdca_asoc.c | 4 ++-- sound/soc/soc-dai.c | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index fc23221766b6..be4781b61989 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -566,6 +566,8 @@ struct list_head *snd_soc_dai_to_list(struct snd_soc_dai *dai); unsigned int snd_soc_dai_get_symmetric_rate(struct snd_soc_dai *dai); unsigned int snd_soc_dai_get_symmetric_channels(struct snd_soc_dai *dai); unsigned int snd_soc_dai_get_symmetric_sample_bits(struct snd_soc_dai *dai); +void snd_soc_dai_set_priv(struct snd_soc_dai *dai, void *priv); +void *snd_soc_dai_to_priv(struct snd_soc_dai *dai); /* REMOVE ME */ #define snd_soc_dai_get_pcm_stream snd_soc_dai_pcm_stream_get diff --git a/sound/soc/sdca/sdca_asoc.c b/sound/soc/sdca/sdca_asoc.c index ce2e7c270765..ccc579f878ff 100644 --- a/sound/soc/sdca/sdca_asoc.c +++ b/sound/soc/sdca/sdca_asoc.c @@ -1507,7 +1507,7 @@ int sdca_asoc_set_constraints(struct device *dev, struct regmap *regmap, return ret; } - dai->priv = constraint; + snd_soc_dai_set_priv(dai, constraint); return 0; } @@ -1523,7 +1523,7 @@ EXPORT_SYMBOL_NS(sdca_asoc_set_constraints, "SND_SOC_SDCA"); void sdca_asoc_free_constraints(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct snd_pcm_hw_constraint_list *constraint = dai->priv; + struct snd_pcm_hw_constraint_list *constraint = snd_soc_dai_to_priv(dai); kfree(constraint); } diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 9787d7913c30..7412294eaea4 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -32,6 +32,18 @@ struct snd_soc_dai_driver *snd_soc_dai_to_driver(const struct snd_soc_dai *dai) } EXPORT_SYMBOL_GPL(snd_soc_dai_to_driver); +void snd_soc_dai_set_priv(struct snd_soc_dai *dai, void *priv) +{ + dai->priv = priv; +} +EXPORT_SYMBOL_GPL(snd_soc_dai_set_priv); + +void *snd_soc_dai_to_priv(struct snd_soc_dai *dai) +{ + return dai->priv; +} +EXPORT_SYMBOL_GPL(snd_soc_dai_to_priv); + struct snd_soc_dai *snd_soc_dai_from_list(struct list_head *list) { return list_entry(list, struct snd_soc_dai, list);