Update of /cvsroot/alsa/alsa-kernel/pci/trident
In directory sc8-pr-cvs1:/tmp/cvs-serv9973

Modified Files:
        trident_main.c trident_memory.c 
Log Message:
- fixed oops on trident 4D NX (due to the last change for sg-buffer support).



Index: trident_main.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/trident/trident_main.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- trident_main.c      7 Jan 2003 10:52:37 -0000       1.24
+++ trident_main.c      8 Jan 2003 13:08:25 -0000       1.25
@@ -2041,6 +2041,20 @@
        .pointer =      snd_trident_playback_pointer,
 };
 
+static snd_pcm_ops_t snd_trident_nx_playback_ops = {
+       .open =         snd_trident_playback_open,
+       .close =        snd_trident_playback_close,
+       .ioctl =        snd_trident_ioctl,
+       .hw_params =    snd_trident_hw_params,
+       .hw_free =      snd_trident_hw_free,
+       .prepare =      snd_trident_playback_prepare,
+       .trigger =      snd_trident_trigger,
+       .pointer =      snd_trident_playback_pointer,
+       .copy =         snd_pcm_sgbuf_ops_copy_playback,
+       .silence =      snd_pcm_sgbuf_ops_silence,
+       .page =         snd_pcm_sgbuf_ops_page,
+};
+
 static snd_pcm_ops_t snd_trident_capture_ops = {
        .open =         snd_trident_capture_open,
        .close =        snd_trident_capture_close,
@@ -2052,6 +2066,20 @@
        .pointer =      snd_trident_capture_pointer,
 };
 
+static snd_pcm_ops_t snd_trident_nx_capture_ops = {
+       .open =         snd_trident_capture_open,
+       .close =        snd_trident_capture_close,
+       .ioctl =        snd_trident_ioctl,
+       .hw_params =    snd_trident_capture_hw_params,
+       .hw_free =      snd_trident_hw_free,
+       .prepare =      snd_trident_capture_prepare,
+       .trigger =      snd_trident_trigger,
+       .pointer =      snd_trident_capture_pointer,
+       .copy =         snd_pcm_sgbuf_ops_copy_capture,
+       .silence =      snd_pcm_sgbuf_ops_silence,
+       .page =         snd_pcm_sgbuf_ops_page,
+};
+
 static snd_pcm_ops_t snd_trident_si7018_capture_ops = {
        .open =         snd_trident_capture_open,
        .close =        snd_trident_capture_close,
@@ -2074,6 +2102,20 @@
        .pointer =      snd_trident_playback_pointer,
 };
 
+static snd_pcm_ops_t snd_trident_nx_foldback_ops = {
+       .open =         snd_trident_foldback_open,
+       .close =        snd_trident_foldback_close,
+       .ioctl =        snd_trident_ioctl,
+       .hw_params =    snd_trident_hw_params,
+       .hw_free =      snd_trident_hw_free,
+       .prepare =      snd_trident_foldback_prepare,
+       .trigger =      snd_trident_trigger,
+       .pointer =      snd_trident_playback_pointer,
+       .copy =         snd_pcm_sgbuf_ops_copy_capture,
+       .silence =      snd_pcm_sgbuf_ops_silence,
+       .page =         snd_pcm_sgbuf_ops_page,
+};
+
 static snd_pcm_ops_t snd_trident_spdif_ops = {
        .open =         snd_trident_spdif_open,
        .close =        snd_trident_spdif_close,
@@ -2085,6 +2127,20 @@
        .pointer =      snd_trident_spdif_pointer,
 };
 
+static snd_pcm_ops_t snd_trident_nx_spdif_ops = {
+       .open =         snd_trident_spdif_open,
+       .close =        snd_trident_spdif_close,
+       .ioctl =        snd_trident_ioctl,
+       .hw_params =    snd_trident_spdif_hw_params,
+       .hw_free =      snd_trident_hw_free,
+       .prepare =      snd_trident_spdif_prepare,
+       .trigger =      snd_trident_trigger,
+       .pointer =      snd_trident_spdif_pointer,
+       .copy =         snd_pcm_sgbuf_ops_copy_playback,
+       .silence =      snd_pcm_sgbuf_ops_silence,
+       .page =         snd_pcm_sgbuf_ops_page,
+};
+
 static snd_pcm_ops_t snd_trident_spdif_7018_ops = {
        .open =         snd_trident_spdif_open,
        .close =        snd_trident_spdif_close,
@@ -2154,11 +2210,16 @@
        pcm->private_data = trident;
        pcm->private_free = snd_trident_pcm_free;
 
-       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_trident_playback_ops);
-       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
+       if (trident->tlb.entries) {
+               snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 
+&snd_trident_nx_playback_ops);
+               snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, 
+&snd_trident_nx_capture_ops);
+       } else {
+               snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 
+&snd_trident_playback_ops);
+               snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
                                trident->device != TRIDENT_DEVICE_ID_SI7018 ?
-                                       &snd_trident_capture_ops :
-                                       &snd_trident_si7018_capture_ops);
+                               &snd_trident_capture_ops :
+                               &snd_trident_si7018_capture_ops);
+       }
 
        pcm->info_flags = 0;
        pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
@@ -2200,7 +2261,10 @@
 
        foldback->private_data = trident;
        foldback->private_free = snd_trident_foldback_pcm_free;
-       snd_pcm_set_ops(foldback, SNDRV_PCM_STREAM_CAPTURE, &snd_trident_foldback_ops);
+       if (trident->tlb.entries)
+               snd_pcm_set_ops(foldback, SNDRV_PCM_STREAM_CAPTURE, 
+&snd_trident_nx_foldback_ops);
+       else
+               snd_pcm_set_ops(foldback, SNDRV_PCM_STREAM_CAPTURE, 
+&snd_trident_foldback_ops);
        foldback->info_flags = 0;
        strcpy(foldback->name, "Trident 4DWave");
        substream = foldback->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
@@ -2246,7 +2310,9 @@
 
        spdif->private_data = trident;
        spdif->private_free = snd_trident_spdif_pcm_free;
-       if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
+       if (trident->tlb.entries) {
+               snd_pcm_set_ops(spdif, SNDRV_PCM_STREAM_PLAYBACK, 
+&snd_trident_nx_spdif_ops);
+       } else if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
                snd_pcm_set_ops(spdif, SNDRV_PCM_STREAM_PLAYBACK, 
&snd_trident_spdif_ops);
        } else {
                snd_pcm_set_ops(spdif, SNDRV_PCM_STREAM_PLAYBACK, 
&snd_trident_spdif_7018_ops);

Index: trident_memory.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/trident/trident_memory.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- trident_memory.c    7 Jan 2003 10:49:12 -0000       1.8
+++ trident_memory.c    8 Jan 2003 13:08:25 -0000       1.9
@@ -202,12 +202,20 @@
                up(&hdr->block_mutex);
                return NULL;
        }
+       if (lastpg(blk) - firstpg(blk) >= sgbuf->pages) {
+               snd_printk(KERN_ERR "page calculation doesn't match: allocated pages = 
+%d, trident = %d/%d\n", sgbuf->pages, firstpg(blk), lastpg(blk));
+               __snd_util_mem_free(hdr, blk);
+               up(&hdr->block_mutex);
+               return NULL;
+       }
+                          
        /* set TLB entries */
        idx = 0;
        for (page = firstpg(blk); page <= lastpg(blk); page++, idx++) {
                dma_addr_t addr = sgbuf->table[idx].addr;
                unsigned long ptr = (unsigned long)sgbuf->table[idx].buf;
                if (! is_valid_page(addr)) {
+                       __snd_util_mem_free(hdr, blk);
                        up(&hdr->block_mutex);
                        return NULL;
                }



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to