ASoC: soc-component: Add snd_soc_pcm_component_ack
authorShengjiu Wang <shengjiu.wang@nxp.com>
Fri, 12 Mar 2021 02:38:40 +0000 (10:38 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 25 Mar 2021 13:58:06 +0000 (13:58 +0000)
Add snd_soc_pcm_component_ack back, which can be used to get an
updated buffer pointer in the platform driver.
On Asymmetric multiprocessor, this pointer can be sent to Cortex-M
core for audio processing.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615516725-4975-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-component.h
sound/soc/soc-component.c
sound/soc/soc-pcm.c

index 7dc75b39287f5d256c296620af1cafde3fd7a43f..722cfab28d29c98d11a670ea29da9774f80173a0 100644 (file)
@@ -146,6 +146,8 @@ struct snd_soc_component_driver {
        int (*mmap)(struct snd_soc_component *component,
                    struct snd_pcm_substream *substream,
                    struct vm_area_struct *vma);
+       int (*ack)(struct snd_soc_component *component,
+                  struct snd_pcm_substream *substream);
 
        const struct snd_compress_ops *compress_ops;
 
@@ -498,5 +500,6 @@ int snd_soc_pcm_component_pm_runtime_get(struct snd_soc_pcm_runtime *rtd,
                                         void *stream);
 void snd_soc_pcm_component_pm_runtime_put(struct snd_soc_pcm_runtime *rtd,
                                          void *stream, int rollback);
+int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream);
 
 #endif /* __SOC_COMPONENT_H */
index 8415e9bd2932185a9ee2c1abe38e031210d97fb9..3a5e84e16a87bc8f8dea8ed33a3c910f86b670a6 100644 (file)
@@ -1212,3 +1212,17 @@ void snd_soc_pcm_component_pm_runtime_put(struct snd_soc_pcm_runtime *rtd,
                soc_component_mark_pop(component, stream, pm);
        }
 }
+
+int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream)
+{
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
+       struct snd_soc_component *component;
+       int i;
+
+       /* FIXME: use 1st pointer */
+       for_each_rtd_components(rtd, i, component)
+               if (component->driver->ack)
+                       return component->driver->ack(component, substream);
+
+       return 0;
+}
index 2df70ab851ea7c97d950e05ac1e8c90fe28569fc..02968a4e52b43fead08111a3dbf3c5e30ffc0ed9 100644 (file)
@@ -2772,6 +2772,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
                        rtd->ops.page           = snd_soc_pcm_component_page;
                if (drv->mmap)
                        rtd->ops.mmap           = snd_soc_pcm_component_mmap;
+               if (drv->ack)
+                       rtd->ops.ack            = snd_soc_pcm_component_ack;
        }
 
        if (playback)