From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: the last changes to trident driver Date: Wed, 08 Jan 2003 13:00:29 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <20030107232051.2861d226.james@tappin.me.uk> <20030108110650.1d579069.sjt@star.sr.bham.ac.uk> Mime-Version: 1.0 (generated by SEMI 1.14.4 - "Hosorogi") Content-Type: multipart/mixed; boundary="Multipart_Wed_Jan__8_13:00:29_2003-1" Return-path: In-Reply-To: <20030108110650.1d579069.sjt@star.sr.bham.ac.uk> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: James Tappin Cc: Self at home , alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Wed_Jan__8_13:00:29_2003-1 Content-Type: text/plain; charset=US-ASCII At Wed, 8 Jan 2003 11:06:50 +0000, James Tappin wrote: > > On Wed, 08 Jan 2003 11:08:39 +0100 > Takashi Iwai wrote: > > TI> At Tue, 7 Jan 2003 23:20:51 +0000, > TI> James Tappin wrote: > TI> > > TI> > On Tue, 07 Jan 2003 17:04:47 +0100 > TI> > Takashi Iwai wrote: > TI> > > TI> > > Hi, > TI> > > > TI> > > if someone has a Trident 4DNX (not DX), could you test the latest CVS > TI> > > driver? i hope my last change doesn't break, but i couldn't test the > TI> > > board atm... > TI> > > > TI> > > > TI> > > TI> > Hi Takashi, > TI> > I've managed to resolve my unresolved references problem by rebuilding > TI> > the kernel without gameport support, but now attempting to aplay a wav > TI> > file produces an immediate segfault (but it refuses to dump core). > TI> > TI> hmm, perhaps it caused oops in kernel. > TI> could you check the kernel message and get the trace via ksymoops if > TI> possible? > TI> > > I've just logged into the machine from work and looked back at the system logs and this > is what I see from "ksymoops syslog.0": > hmm, unfortunately the stack wasn't parsed correctly with symbols. did you build the alsa drivers with debug option (--with-debug=full)? anyway, please rebuild the drivers with the attached patch (and debug option, if not yet). i hope a fatal oops or hang-up can be avoided now... oh, also, please update the cvs tree again. i've done some changes since yesterday. thanks, Takashi --Multipart_Wed_Jan__8_13:00:29_2003-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="trident-nx-fix.dif" Content-Transfer-Encoding: 7bit Index: alsa-kernel/pci/trident/trident_main.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/trident/trident_main.c,v retrieving revision 1.19 diff -u -r1.19 trident_main.c --- alsa-kernel/pci/trident/trident_main.c 7 Jan 2003 10:51:12 -0000 1.19 +++ alsa-kernel/pci/trident/trident_main.c 8 Jan 2003 11:56:17 -0000 @@ -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: alsa-kernel/pci/trident/trident_memory.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/trident/trident_memory.c,v retrieving revision 1.6 diff -u -r1.6 trident_memory.c --- alsa-kernel/pci/trident/trident_memory.c 7 Jan 2003 10:47:57 -0000 1.6 +++ alsa-kernel/pci/trident/trident_memory.c 8 Jan 2003 11:45:21 -0000 @@ -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; } --Multipart_Wed_Jan__8_13:00:29_2003-1-- ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com