@@ -104,6 +104,8 @@ struct snd_soc_component_driver {
struct page *(*page)(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
unsigned long offset);
+ int (*ack) (struct snd_soc_component *component,
+ struct snd_pcm_substream *substream);
int (*mmap)(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct vm_area_struct *vma);
@@ -415,6 +417,7 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
unsigned long offset);
int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
struct vm_area_struct *vma);
+int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream);
int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd);
void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd);
@@ -516,6 +516,20 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
return -EINVAL;
}
+int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_component *component;
+ int i;
+
+ /* FIXME. it returns 1st ack now */
+ for_each_rtd_components(rtd, i, component)
+ if (component->driver->ack)
+ return component->driver->ack(component, substream);
+
+ return -EINVAL;
+}
+
int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component;
@@ -3027,6 +3027,8 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
rtd->ops.ioctl = snd_soc_pcm_component_ioctl;
if (drv->sync_stop)
rtd->ops.sync_stop = snd_soc_pcm_component_sync_stop;
+ if (drv->ack)
+ rtd->ops.ack = snd_soc_pcm_component_ack;
if (drv->copy_user)
rtd->ops.copy_user = snd_soc_pcm_component_copy_user;
if (drv->page)
Current ALSA SoC is directly using component->driver->ops->xxx, thus, it is deep nested, and makes code difficult to read, and is not good for encapsulation. This patch adds new snd_soc_component_ack() and use it. Ack callback is revived because some ASoC driver is using it. Signed-off-by: Gyeongtaek Lee <gt82.lee@samsung.com> --- include/sound/soc-component.h | 3 +++ sound/soc/soc-component.c | 14 ++++++++++++++ sound/soc/soc-pcm.c | 2 ++ 3 files changed, 19 insertions(+)