Skip to contentSkip to conversation

ASoC: OMAP: Add checking to detect bufferless pcms

PATCH In review Joonyoung Shim 4 participants 7 messages Apr 22, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: OMAP: Add checking to detect bufferless pcms

Add checking in hw_params and prepare to detect bufferless pcms(i.e. BT <--> codec).

---
 sound/soc/omap/omap-pcm.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
sound/soc/omap/omap-pcm.c +8 -1
index 07cf7f4..6454e15 100644
@@ -87,8 +87,10 @@ static int omap_pcm_hw_params(struct snd_pcm_substream *substream,
 	struct omap_pcm_dma_data *dma_data = rtd->dai->cpu_dai->dma_data;
 	int err = 0;
 
+	/* return if this is a bufferless transfer e.g.
+	 * codec <--> BT codec or GSM modem -- lg FIXME */
 	if (!dma_data)
-		return -ENODEV;
+		return 0;
 
 	snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
 	runtime->dma_bytes = params_buffer_bytes(params);
@@ -134,6 +136,11 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
 	struct omap_pcm_dma_data *dma_data = prtd->dma_data;
 	struct omap_dma_channel_params dma_params;
 
+	/* return if this is a bufferless transfer e.g.
+	 * codec <--> BT codec or GSM modem -- lg FIXME */
+	if (!prtd->dma_data)
+		return 0;
+
 	memset(&dma_params, 0, sizeof(dma_params));
 	/*
 	 * Note: Regardless of interface data formats supported by OMAP McBSP
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 14 lines · Joonyoung Shim

Add checking in hw_params and prepare to detect bufferless pcms(i.e. BT <--> codec).

---
 sound/soc/omap/omap-pcm.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
sound/soc/omap/omap-pcm.c +0 -0
index 07cf7f4..6454e15 100644
@@ -87,8 +87,10 @@ static int omap_pcm_hw_params(struct snd_pcm_substream
 *substream,

sound/soc/omap/omap-pcm.c static int omap_pcm_hw_params(struct snd_pcm_substream · line 96

Quoted 10 lines
sound/soc/omap/omap-pcm.c +3 -1
       struct omap_pcm_dma_data *dma_data = rtd->dai->cpu_dai->dma_data;
       int err = 0;
 
+       /* return if this is a bufferless transfer e.g.
+        * codec <--> BT codec or GSM modem -- lg FIXME */
       if (!dma_data)
-               return -ENODEV;
+               return 0;
 
 

I see exactly similar lines in s3c24xx-pcm.c but don't point now the use case where this is used and I don't have idea what is this all about.

Is this something where DAI driver or another end of connection is used to provide clocking and the whole setup is then controlled with ALSA PCM API? Somehow I have the feeling that would there be a better way to achieve it than with dummy bufferless transfer?

Signature · 1 line
Jarkko
#2 lore raw
Quoted 10 lines · Jarkko Nikula

sound/soc/omap/omap-pcm.c static int omap_pcm_hw_params(struct snd_pcm_substream *substream, · line 93

Quoted 5 lines · Joonyoung Shim
sound/soc/omap/omap-pcm.c +3 -1
+       /* return if this is a bufferless transfer e.g.
+        * codec <--> BT codec or GSM modem -- lg FIXME */
       if (!dma_data)
-               return -ENODEV;
+               return 0;

I see exactly similar lines in s3c24xx-pcm.c but don't point now the use case where this is used and I don't have idea what is this all about.

The use case is for dummy DAIs used to represent bluetooth and similar - they aren't going to do any DMA so don't pass anything to the platform.

Quoted 4 lines

Is this something where DAI driver or another end of connection is used to provide clocking and the whole setup is then controlled with ALSA PCM API? Somehow I have the feeling that would there be a better way to achieve it than with dummy bufferless transfer?

The host isn't transferring any data at all in these cases. Ideally we'd support multiple platforms and there'd be a dummy platform driver to go with the dummy DAI driver.

#3 lore raw
Quoted 4 lines · Mark Brown
Quoted 1 line · Jarkko Nikula

Is this something where DAI driver or another end of connection is used

to

Quoted 9 lines
Quoted 1 line

provide clocking and the whole setup is then controlled with ALSA PCM

API?

Quoted 2 lines

Somehow I have the feeling that would there be a better way to achieve it than with dummy bufferless transfer?

The host isn't transferring any data at all in these cases. Ideally we'd support multiple platforms and there'd be a dummy platform driver to go with the dummy DAI driver.

Probably it's better to extend this patch to other architectures as well (at least DaVinci) where possible in order to be more consistent. I just noticed that also PXA is having the same feature.

Signature · 1 line
Jarkko
#4 lore raw
Quoted 9 lines · Jarkko Nikula
Quoted 3 lines · Mark Brown

The host isn't transferring any data at all in these cases. Ideally we'd support multiple platforms and there'd be a dummy platform driver to go with the dummy DAI driver.

Probably it's better to extend this patch to other architectures as well (at least DaVinci) where possible in order to be more consistent. I just noticed that also PXA is having the same feature.

Yes, though given that it's a bodge at the moment it'd need someone to go through per architecture and check that the right thing is being done.

When I've thought about doing it I've always decided it'd probably be less hassle to fix the core not to need the bodge :/

#5 lore raw
In reply to Jarkko Nikula
Quoted 5 lines · On Wednesday 22 April 2009 11:30:32 ext Jarkko Nikula wrote:

On Wed, Apr 22, 2009 at 4:56 AM, Joonyoung Shim <[email protected]<mailto:[email protected]>> wrote: Add checking in hw_params and prepare to detect bufferless pcms(i.e. BT <--> codec).

Quoted 7 lines

I see exactly similar lines in s3c24xx-pcm.c but don't point now the use case where this is used and I don't have idea what is this all about.

Is this something where DAI driver or another end of connection is used to provide clocking and the whole setup is then controlled with ALSA PCM API? Somehow I have the feeling that would there be a better way to achieve it than with dummy bufferless transfer?

In the twl codec, the BT interface does not have dedicated clock line, but it is (re)using the clock lines for the voice PCM interface. So in order to get BT data going between the BT and the codec, the voice PCM interface has to generate the clocks.

But I think this could be done even without the need for the alsa PCM interface, probably well placed DAPM switches would also can take care of this?

Quoted 3 lines

--
Jarkko

Signature · 1 line
Péter
#6 lore raw
In reply to Jarkko Nikula
Quoted 28 lines · Jarkko Nikula

On Wed, Apr 22, 2009 at 4:56 AM, Joonyoung Shim <[email protected] <mailto:[email protected]>> wrote:

    Add checking in hw_params and prepare to detect bufferless pcms(i.e. BT
    <--> codec).

    Signed-off-by: Joonyoung Shim <[email protected]
    <mailto:[email protected]>>
    ---
    쟳ound/soc/omap/omap-pcm.c |    9 ++++++++-
     1 files changed, 8 insertions(+), 1 deletions(-)

    diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
    index 07cf7f4..6454e15 100644
    --- a/sound/soc/omap/omap-pcm.c
    +++ b/sound/soc/omap/omap-pcm.c
    @@ -87,8 +87,10 @@ static int omap_pcm_hw_params(struct
    snd_pcm_substream *substream,
          쟳truct omap_pcm_dma_data *dma_data = rtd->dai->cpu_dai->dma_data;
          쟧nt err = 0;

    +       /* return if this is a bufferless transfer e.g.
    +        * codec <--> BT codec or GSM modem -- lg FIXME */
          쟧f (!dma_data)
    -               return -ENODEV;
    +               return 0;
Quoted 7 lines

I see exactly similar lines in s3c24xx-pcm.c but don't point now the use case where this is used and I don't have idea what is this all about.

Is this something where DAI driver or another end of connection is used to provide clocking and the whole setup is then controlled with ALSA PCM API? Somehow I have the feeling that would there be a better way to achieve it than with dummy bufferless transfer?

I tested this patch with the omap3 target having the twl4030 codec. The twl4030 codec driver supports the voice DAI to transfer pcm data between modem and codec, and i added for test the dummy voice DAI in machine driver. To transfer pcm data at modem <--> codec doesn't need DMA.

Quoted 4 lines
Signature · 2 lines
-- 
Jarkko

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel