ALSA: pcm - Call pgprot_noncached() for vmalloc'ed buffers
authorTakashi Iwai <tiwai@suse.de>
Mon, 18 Jan 2010 13:58:57 +0000 (14:58 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 18 Jan 2010 14:00:34 +0000 (15:00 +0100)
pgprot_noncached() can be set for vmalloc'ed buffers safely, and we'd
need non-cached behavior more or less, even for the intermediate ring-
buffers.

Now snd_pcm_lib_mmap_vmalloc() is added as the common PCM mmap callback
that is coupled with snd_pcm_lib_alloc_vmalloc_buffer() & co.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/pcm.h
sound/core/pcm_native.c
sound/drivers/vx/vx_pcm.c
sound/mips/sgio2audio.c
sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
sound/usb/ua101.c
sound/usb/usbaudio.c

index 1d4ca2aae50dc8ea71e8ab7f96734f03143cd7d3..aabf48bb8ee663024ac436f9d0647302b35cfd81 100644 (file)
@@ -1021,6 +1021,10 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s
 #define snd_pcm_lib_mmap_iomem NULL
 #endif
 
+int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
+                              struct vm_area_struct *area);
+#define snd_pcm_lib_mmap_vmalloc       snd_pcm_lib_mmap_noncached
+
 static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
 {
        *max = dma < 4 ? 64 * 1024 : 128 * 1024;
index 5df0d21f18b38de14ad9c2140c03621f4d93f7f3..88fff44702a433fcea9a24966359f8ea577d5e13 100644 (file)
@@ -3176,6 +3176,15 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream,
 EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);
 #endif /* SNDRV_PCM_INFO_MMAP */
 
+/* mmap callback with pgprot_noncached */
+int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
+                              struct vm_area_struct *area)
+{
+       area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
+       return snd_pcm_default_mmap(substream, area);
+}
+EXPORT_SYMBOL(snd_pcm_lib_mmap_noncached);
+
 /*
  * mmap DMA buffer
  */
index c8385d26a16f2dd749ddbae4aafeb706b89edbb3..35a2f71a6af5202f49b2e3339c68ebb2575abe7e 100644 (file)
@@ -905,6 +905,7 @@ static struct snd_pcm_ops vx_pcm_playback_ops = {
        .trigger =      vx_pcm_trigger,
        .pointer =      vx_pcm_playback_pointer,
        .page =         snd_pcm_lib_get_vmalloc_page,
+       .mmap =         snd_pcm_lib_mmap_vmalloc,
 };
 
 
@@ -1125,6 +1126,7 @@ static struct snd_pcm_ops vx_pcm_capture_ops = {
        .trigger =      vx_pcm_trigger,
        .pointer =      vx_pcm_capture_pointer,
        .page =         snd_pcm_lib_get_vmalloc_page,
+       .mmap =         snd_pcm_lib_mmap_vmalloc,
 };
 
 
index 9b486beeb93226ac7c0adbe0e7ea7b7738173824..6aff217379d910d2a333bec3c4c950a8ffe593d3 100644 (file)
@@ -691,6 +691,7 @@ static struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
        .trigger =     snd_sgio2audio_pcm_trigger,
        .pointer =     snd_sgio2audio_pcm_pointer,
        .page =        snd_pcm_lib_get_vmalloc_page,
+       .mmap =        snd_pcm_lib_mmap_vmalloc,
 };
 
 static struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
@@ -703,6 +704,7 @@ static struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
        .trigger =     snd_sgio2audio_pcm_trigger,
        .pointer =     snd_sgio2audio_pcm_pointer,
        .page =        snd_pcm_lib_get_vmalloc_page,
+       .mmap =        snd_pcm_lib_mmap_vmalloc,
 };
 
 static struct snd_pcm_ops snd_sgio2audio_capture_ops = {
@@ -715,6 +717,7 @@ static struct snd_pcm_ops snd_sgio2audio_capture_ops = {
        .trigger =     snd_sgio2audio_pcm_trigger,
        .pointer =     snd_sgio2audio_pcm_pointer,
        .page =        snd_pcm_lib_get_vmalloc_page,
+       .mmap =        snd_pcm_lib_mmap_vmalloc,
 };
 
 /*
index 0afa683c900eb3ec1f83d543fda96ab242d63737..0d668f471620cc81283142cc16cc0d1159cb84f9 100644 (file)
@@ -277,6 +277,7 @@ static struct snd_pcm_ops pdacf_pcm_capture_ops = {
        .trigger =      pdacf_pcm_trigger,
        .pointer =      pdacf_pcm_capture_pointer,
        .page =         snd_pcm_lib_get_vmalloc_page,
+       .mmap =         snd_pcm_lib_mmap_vmalloc,
 };
 
 
index 16dc7bd5e120efd01c48fe5ae653a4ba50387347..4f4ccdf70dd04ce9bc7440590fdc0d3d22f83834 100644 (file)
@@ -911,6 +911,7 @@ static struct snd_pcm_ops capture_pcm_ops = {
        .trigger = capture_pcm_trigger,
        .pointer = capture_pcm_pointer,
        .page = snd_pcm_lib_get_vmalloc_page,
+       .mmap = snd_pcm_lib_mmap_vmalloc,
 };
 
 static struct snd_pcm_ops playback_pcm_ops = {
@@ -923,6 +924,7 @@ static struct snd_pcm_ops playback_pcm_ops = {
        .trigger = playback_pcm_trigger,
        .pointer = playback_pcm_pointer,
        .page = snd_pcm_lib_get_vmalloc_page,
+       .mmap = snd_pcm_lib_mmap_vmalloc,
 };
 
 static const struct uac_format_type_i_discrete_descriptor *
index 4ada98e1630944ad9fa6ca749724d419e2ba47a2..b8e0b8fda607d5d2e87d9e68d94b97cab8478495 100644 (file)
@@ -1997,6 +1997,7 @@ static struct snd_pcm_ops snd_usb_playback_ops = {
        .trigger =      snd_usb_pcm_playback_trigger,
        .pointer =      snd_usb_pcm_pointer,
        .page =         snd_pcm_lib_get_vmalloc_page,
+       .mmap =         snd_pcm_lib_mmap_vmalloc,
 };
 
 static struct snd_pcm_ops snd_usb_capture_ops = {
@@ -2009,6 +2010,7 @@ static struct snd_pcm_ops snd_usb_capture_ops = {
        .trigger =      snd_usb_pcm_capture_trigger,
        .pointer =      snd_usb_pcm_pointer,
        .page =         snd_pcm_lib_get_vmalloc_page,
+       .mmap =         snd_pcm_lib_mmap_vmalloc,
 };