[PATCHv2 2/5] ASoC: core: soc level wrapper for pcm_pointer callback

2010-03-03 Thread Peter Ujfalusi
Create a soc level wrapper for pcm_pointer callback.
This will facilitate the soc level handling of different
HW buffers in the audio path.

Signed-off-by: Peter Ujfalusi peter.ujfal...@nokia.com
---
 sound/soc/soc-core.c |   19 ++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 37c872e..de5223d 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -797,6 +797,23 @@ static int soc_pcm_trigger(struct snd_pcm_substream 
*substream, int cmd)
return 0;
 }
 
+/*
+ * soc level wrapper for pointer callback
+ */
+static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
+{
+   struct snd_soc_pcm_runtime *rtd = substream-private_data;
+   struct snd_soc_device *socdev = rtd-socdev;
+   struct snd_soc_card *card = socdev-card;
+   struct snd_soc_platform *platform = card-platform;
+   snd_pcm_uframes_t offset = 0;
+
+   if (platform-pcm_ops-pointer)
+   offset = platform-pcm_ops-pointer(substream);
+
+   return offset;
+}
+
 /* ASoC PCM operations */
 static struct snd_pcm_ops soc_pcm_ops = {
.open   = soc_pcm_open,
@@ -805,6 +822,7 @@ static struct snd_pcm_ops soc_pcm_ops = {
.hw_free= soc_pcm_hw_free,
.prepare= soc_pcm_prepare,
.trigger= soc_pcm_trigger,
+   .pointer= soc_pcm_pointer,
 };
 
 #ifdef CONFIG_PM
@@ -1331,7 +1349,6 @@ static int soc_new_pcm(struct snd_soc_device *socdev,
dai_link-pcm = pcm;
pcm-private_data = rtd;
soc_pcm_ops.mmap = platform-pcm_ops-mmap;
-   soc_pcm_ops.pointer = platform-pcm_ops-pointer;
soc_pcm_ops.ioctl = platform-pcm_ops-ioctl;
soc_pcm_ops.copy = platform-pcm_ops-copy;
soc_pcm_ops.silence = platform-pcm_ops-silence;
-- 
1.7.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [alsa-devel] [PATCHv2 2/5] ASoC: core: soc level wrapper for pcm_pointer callback

2010-03-03 Thread Liam Girdwood
On Wed, 2010-03-03 at 15:08 +0200, Peter Ujfalusi wrote:
 Create a soc level wrapper for pcm_pointer callback.
 This will facilitate the soc level handling of different
 HW buffers in the audio path.
 
 Signed-off-by: Peter Ujfalusi peter.ujfal...@nokia.com

Acked-by: Liam Girdwood l...@slimlogic.co.uk

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html