All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [ALSA] mpc8610: Add mmap support
@ 2008-01-17 15:06 Timur Tabi
  2008-01-17 16:24 ` Alexander E. Patrakov
  0 siblings, 1 reply; 7+ messages in thread
From: Timur Tabi @ 2008-01-17 15:06 UTC (permalink / raw)
  To: alsa-devel; +Cc: Timur Tabi

Enable mmap support in the MPC8610 ASoC driver.  The driver can use ALSA's
default mmap functionality, it was just not enabled previously.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 sound/soc/fsl/fsl_dma.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 2173203..652514f 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -136,7 +136,9 @@ struct fsl_dma_private {
  */
 static const struct snd_pcm_hardware fsl_dma_hardware = {
 
-	.info   		= SNDRV_PCM_INFO_INTERLEAVED,
+	.info   		= SNDRV_PCM_INFO_INTERLEAVED |
+				  SNDRV_PCM_INFO_MMAP |
+				  SNDRV_PCM_INFO_MMAP_VALID,
 	.formats		= FSLDMA_PCM_FORMATS,
 	.rates  		= FSLDMA_PCM_RATES,
 	.rate_min       	= 5512,
-- 
1.5.2.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] [ALSA] mpc8610: Add mmap support
  2008-01-17 15:06 [PATCH] [ALSA] mpc8610: Add mmap support Timur Tabi
@ 2008-01-17 16:24 ` Alexander E. Patrakov
  2008-01-17 16:31   ` Timur Tabi
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander E. Patrakov @ 2008-01-17 16:24 UTC (permalink / raw)
  To: Timur Tabi; +Cc: alsa-devel

Timur Tabi wrote:
> Enable mmap support in the MPC8610 ASoC driver.  The driver can use ALSA's
> default mmap functionality, it was just not enabled previously.
> 
> Signed-off-by: Timur Tabi <timur@freescale.com>

[sorry, I may be completely wrong below about the .page callback purpose - in 
this case, just confirm that the testcase works]

Hm, the "struct snd_pcm_ops fsl_dma_ops" doesn't contain the .page callback. 
With saa7134-alsa, this led to the "device claims to support mmap but actually 
doesn't work" bug, see the following subthread:

http://mailman.alsa-project.org/pipermail/alsa-devel/2007-October/003773.html

IOW: have you actually tested that the following commands work (X,Y refer to the 
FSL chip)?

aplay -M -D hw:X,Y sample.wav
arecord -f cd -M -D:X,Y capture.wav

> ---
>  sound/soc/fsl/fsl_dma.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
> index 2173203..652514f 100644
> --- a/sound/soc/fsl/fsl_dma.c
> +++ b/sound/soc/fsl/fsl_dma.c
> @@ -136,7 +136,9 @@ struct fsl_dma_private {
>   */
>  static const struct snd_pcm_hardware fsl_dma_hardware = {
>  
> -	.info   		= SNDRV_PCM_INFO_INTERLEAVED,
> +	.info   		= SNDRV_PCM_INFO_INTERLEAVED |
> +				  SNDRV_PCM_INFO_MMAP |
> +				  SNDRV_PCM_INFO_MMAP_VALID,
>  	.formats		= FSLDMA_PCM_FORMATS,
>  	.rates  		= FSLDMA_PCM_RATES,
>  	.rate_min       	= 5512,

-- 
Alexander E. Patrakov

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] [ALSA] mpc8610: Add mmap support
  2008-01-17 16:24 ` Alexander E. Patrakov
@ 2008-01-17 16:31   ` Timur Tabi
  2008-01-17 16:45     ` Takashi Iwai
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Timur Tabi @ 2008-01-17 16:31 UTC (permalink / raw)
  To: Alexander E. Patrakov; +Cc: alsa-devel

Alexander E. Patrakov wrote:
> Timur Tabi wrote:
>> Enable mmap support in the MPC8610 ASoC driver.  The driver can use 
>> ALSA's
>> default mmap functionality, it was just not enabled previously.
>>
>> Signed-off-by: Timur Tabi <timur@freescale.com>
> 
> [sorry, I may be completely wrong below about the .page callback purpose 
> - in this case, just confirm that the testcase works]
> 
> Hm, the "struct snd_pcm_ops fsl_dma_ops" doesn't contain the .page 
> callback. With saa7134-alsa, this led to the "device claims to support 
> mmap but actually doesn't work" bug, see the following subthread:

Isn't that an ARM chip?  The default MMAP handler in ALSA doesn't support ARM, 
but it works for PowerPC.

> http://mailman.alsa-project.org/pipermail/alsa-devel/2007-October/003773.html 
> 
> 
> IOW: have you actually tested that the following commands work (X,Y 
> refer to the FSL chip)?
> 
> aplay -M -D hw:X,Y sample.wav
> arecord -f cd -M -D:X,Y capture.wav

I haven't tried record, but I did try playback, and it worked.  Without this 
patch, adding -M gives me this error:

aplay: set_params:852: Access type not available

After applying this patch, playback works fine.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] [ALSA] mpc8610: Add mmap support
  2008-01-17 16:31   ` Timur Tabi
@ 2008-01-17 16:45     ` Takashi Iwai
  2008-01-17 17:00     ` Alexander E. Patrakov
  2008-01-17 21:40     ` Trent Piepho
  2 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2008-01-17 16:45 UTC (permalink / raw)
  To: Timur Tabi; +Cc: alsa-devel, Alexander E. Patrakov

At Thu, 17 Jan 2008 10:31:37 -0600,
Timur Tabi wrote:
> 
> Alexander E. Patrakov wrote:
> > Timur Tabi wrote:
> >> Enable mmap support in the MPC8610 ASoC driver.  The driver can use 
> >> ALSA's
> >> default mmap functionality, it was just not enabled previously.
> >>
> >> Signed-off-by: Timur Tabi <timur@freescale.com>
> > 
> > [sorry, I may be completely wrong below about the .page callback purpose 
> > - in this case, just confirm that the testcase works]
> > 
> > Hm, the "struct snd_pcm_ops fsl_dma_ops" doesn't contain the .page 
> > callback. With saa7134-alsa, this led to the "device claims to support 
> > mmap but actually doesn't work" bug, see the following subthread:
> 
> Isn't that an ARM chip?  The default MMAP handler in ALSA doesn't support ARM, 
> but it works for PowerPC.
> 
> > http://mailman.alsa-project.org/pipermail/alsa-devel/2007-October/003773.html 
> > 
> > 
> > IOW: have you actually tested that the following commands work (X,Y 
> > refer to the FSL chip)?
> > 
> > aplay -M -D hw:X,Y sample.wav
> > arecord -f cd -M -D:X,Y capture.wav
> 
> I haven't tried record, but I did try playback, and it worked.  Without this 
> patch, adding -M gives me this error:
> 
> aplay: set_params:852: Access type not available
> 
> After applying this patch, playback works fine.

Great, applied to ALSA tree now.

Thanks.

Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] [ALSA] mpc8610: Add mmap support
  2008-01-17 16:31   ` Timur Tabi
  2008-01-17 16:45     ` Takashi Iwai
@ 2008-01-17 17:00     ` Alexander E. Patrakov
  2008-01-17 21:40     ` Trent Piepho
  2 siblings, 0 replies; 7+ messages in thread
From: Alexander E. Patrakov @ 2008-01-17 17:00 UTC (permalink / raw)
  To: Timur Tabi; +Cc: alsa-devel

Timur Tabi wrote:
> Alexander E. Patrakov wrote:
>> Hm, the "struct snd_pcm_ops fsl_dma_ops" doesn't contain the .page 
>> callback. With saa7134-alsa, this led to the "device claims to support 
>> mmap but actually doesn't work" bug, see the following subthread:
> 
> Isn't that an ARM chip?  The default MMAP handler in ALSA doesn't support ARM, 
> but it works for PowerPC.

saa7134 is a Philips chip that you'll find in many TV tuners.

As for the .page logic, my question was indeed stupid. I should have read the 
snd_pcm_mmap_data_nopage() function and notice that, by default, it wants to do 
this:

vaddr = runtime->dma_area + offset;
page = virt_to_page(vaddr);

and saa7134 wants to use vmalloc_to_page() instead of virt_to_page() due to the 
way it allocates the DMA buffer.


> I haven't tried record, but I did try playback, and it worked.  Without this 
> patch, adding -M gives me this error:
> 
> aplay: set_params:852: Access type not available
> 
> After applying this patch, playback works fine.

Good!

-- 
Alexander E. Patrakov

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] [ALSA] mpc8610: Add mmap support
  2008-01-17 16:31   ` Timur Tabi
  2008-01-17 16:45     ` Takashi Iwai
  2008-01-17 17:00     ` Alexander E. Patrakov
@ 2008-01-17 21:40     ` Trent Piepho
  2008-01-17 21:41       ` Timur Tabi
  2 siblings, 1 reply; 7+ messages in thread
From: Trent Piepho @ 2008-01-17 21:40 UTC (permalink / raw)
  To: Timur Tabi; +Cc: alsa-devel, Alexander E. Patrakov

On Thu, 17 Jan 2008, Timur Tabi wrote:
> Alexander E. Patrakov wrote:
> > Timur Tabi wrote:
> >> Enable mmap support in the MPC8610 ASoC driver.  The driver can use
> >> ALSA's
> >> default mmap functionality, it was just not enabled previously.
> >>
> >> Signed-off-by: Timur Tabi <timur@freescale.com>
> >
> > [sorry, I may be completely wrong below about the .page callback purpose
> > - in this case, just confirm that the testcase works]
> >
> > Hm, the "struct snd_pcm_ops fsl_dma_ops" doesn't contain the .page
> > callback. With saa7134-alsa, this led to the "device claims to support
> > mmap but actually doesn't work" bug, see the following subthread:
>
> Isn't that an ARM chip?  The default MMAP handler in ALSA doesn't support ARM,
> but it works for PowerPC.

Alexander is talking about the same thing I was in my previous message to
you.  saa7134, like cx88-alsa, uses vmalloc instead of ALSA to allocate the
DMA buffer, and so a special page callback is needed.

> I haven't tried record, but I did try playback, and it worked.  Without this
> patch, adding -M gives me this error:
>
> aplay: set_params:852: Access type not available
>
> After applying this patch, playback works fine.

The key thing to know is that you will not get an error message if your
page callback is wrong!  Everything will appear to work.  You just won't
hear any sound.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] [ALSA] mpc8610: Add mmap support
  2008-01-17 21:40     ` Trent Piepho
@ 2008-01-17 21:41       ` Timur Tabi
  0 siblings, 0 replies; 7+ messages in thread
From: Timur Tabi @ 2008-01-17 21:41 UTC (permalink / raw)
  To: Trent Piepho; +Cc: alsa-devel, Alexander E. Patrakov

Trent Piepho wrote:

> The key thing to know is that you will not get an error message if your
> page callback is wrong!  Everything will appear to work.  You just won't
> hear any sound.

When I said playback works fine, I was wearing my headphones. :-)

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-01-17 21:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-17 15:06 [PATCH] [ALSA] mpc8610: Add mmap support Timur Tabi
2008-01-17 16:24 ` Alexander E. Patrakov
2008-01-17 16:31   ` Timur Tabi
2008-01-17 16:45     ` Takashi Iwai
2008-01-17 17:00     ` Alexander E. Patrakov
2008-01-17 21:40     ` Trent Piepho
2008-01-17 21:41       ` Timur Tabi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.