lkml.org 
[lkml]   [2006]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
At Mon, 12 Jun 2006 16:42:54 +0200,
Gerhard Pircher wrote:
>
> > > But as far as I understand this would require a rewrite of all the
> > > ALSA drivers (or at least a rewrite of the ALSA's DMA helper
> > > functions).
> >
> > Yes. The change of ALSA side has been also on my tree. But it was
> > still pending since I'm not satisfied with the design yet.
> > If you're interested in it, let me know. I'll post the patch.
>
> Yes, please! Then I can test, if the dma_mmap_coherent() patch works on
> my non cache coherent powerpc machine.

For using dma_mmap_coherent(), the patch below should suffice.
(Also you need to enable HAVE_DMA_MMAP_COHERENT there not only for
ARM.)

> Do you think the DMA Layer/ALSA patches will go upstream in one of
> the next ALSA/Linux kernel versions?

Definitely no 2.6.18 material yet.


Takashi


diff -r 08577d0b45ef sound/core/pcm_native.c
--- a/sound/core/pcm_native.c Tue Jun 13 12:01:14 2006 +0200
+++ b/sound/core/pcm_native.c Wed Jun 14 16:40:32 2006 +0200
@@ -3123,6 +3123,10 @@ static int snd_pcm_mmap_control(struct s
}
#endif /* coherent mmap */

+#if defined(CONFIG_ARM)
+#define HAVE_DMA_MMAP_COHERENT
+#endif
+
/*
* nopage callback for mmapping a RAM page
*/
@@ -3166,6 +3170,14 @@ static struct vm_operations_struct snd_p
.nopage = snd_pcm_mmap_data_nopage,
};

+#ifdef HAVE_DMA_MMAP_COHERENT
+static struct vm_operations_struct snd_pcm_vm_ops_data_one_map =
+{
+ .open = snd_pcm_mmap_data_open,
+ .close = snd_pcm_mmap_data_close,
+};
+#endif
+
/*
* mmap the DMA buffer on RAM
*/
@@ -3175,6 +3187,16 @@ static int snd_pcm_default_mmap(struct s
area->vm_ops = &snd_pcm_vm_ops_data;
area->vm_private_data = substream;
area->vm_flags |= VM_RESERVED;
+#ifdef HAVE_DMA_MMAP_COHERENT
+ if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) {
+ area->vm_ops = &snd_pcm_vm_ops_data_one_map;
+ if (dma_mmap_coherent(substream->dma_buffer.dev.dev, area,
+ substream->runtime->dma_area,
+ substream->runtime->dma_addr,
+ area->vm_end - area->vm_start))
+ return -EAGAIN;
+ }
+#endif
atomic_inc(&substream->mmap_count);
return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-06-14 16:45    [W:0.882 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site