aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-component.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-10-02 14:30:59 +0900
committerMark Brown <broonie@kernel.org>2019-10-08 13:40:22 +0100
commitc64bfc9066007962fca1b9b2d426b1efc171cac9 (patch)
tree329b74cf376cda1f969313ccf9a0b116663b8318 /sound/soc/soc-component.c
parentASoC: soc-core: merge snd_pcm_ops member to component driver (diff)
downloadlinux-dev-c64bfc9066007962fca1b9b2d426b1efc171cac9.tar.xz
linux-dev-c64bfc9066007962fca1b9b2d426b1efc171cac9.zip
ASoC: soc-core: add new pcm_construct/pcm_destruct
Current snd_soc_component_driver has pcm_new/pcm_free, but, it doesn't have "component" at parameter. Thus, each callback can't know it is called for which component. Each callback currently is getting "component" by using snd_soc_rtdcom_lookup() with driver name. It works today, but, will not work in the future if we support multi CPU/Codec/Platform, because 1 rtd might have multiple same driver name component. To solve this issue, each callback need to be called with component. This patch adds new pcm_construct/pcm_destruct with "component" parameter. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sgobaf3g.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-component.c')
-rw-r--r--sound/soc/soc-component.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 2d9cb763e63a..d2b052ac88cd 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -588,6 +588,13 @@ int snd_soc_pcm_component_new(struct snd_pcm *pcm)
for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
+ if (component->driver->pcm_construct) {
+ ret = component->driver->pcm_construct(component, rtd);
+ if (ret < 0)
+ return ret;
+ }
+
+ /* remove me */
if (component->driver->pcm_new) {
ret = component->driver->pcm_new(rtd);
if (ret < 0)
@@ -607,6 +614,10 @@ void snd_soc_pcm_component_free(struct snd_pcm *pcm)
for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
+ if (component->driver->pcm_destruct)
+ component->driver->pcm_destruct(component, pcm);
+
+ /* remove me */
if (component->driver->pcm_free)
component->driver->pcm_free(pcm);
}