ASoC: soc-dai: add snd_soc_dai_{set/to}_priv()

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 <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
Link: https://patch.msgid.link/87fqz7jpst.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2026-09-18 01:45:07 +00:00 committed by Mark Brown
parent ee4f730ac8
commit 9ec8ccc97d
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
3 changed files with 16 additions and 2 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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);