Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: James Tappin <sjt@star.sr.bham.ac.uk>
Cc: Self at home <james@tappin.me.uk>, alsa-devel@lists.sourceforge.net
Subject: Re: the last changes to trident driver
Date: Wed, 08 Jan 2003 13:00:29 +0100	[thread overview]
Message-ID: <s5h8yxvam1u.wl@alsa2.suse.de> (raw)
In-Reply-To: <20030108110650.1d579069.sjt@star.sr.bham.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 1477 bytes --]

At Wed, 8 Jan 2003 11:06:50 +0000,
James Tappin wrote:
> 
> On Wed, 08 Jan 2003 11:08:39 +0100
> Takashi Iwai <tiwai@suse.de> 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 <tiwai@suse.de> 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

[-- Attachment #2: trident-nx-fix.dif --]
[-- Type: application/octet-stream, Size: 6023 bytes --]

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;
 		}

  parent reply	other threads:[~2003-01-08 12:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-07 16:04 the last changes to trident driver Takashi Iwai
2003-01-07 19:33 ` James Tappin
2003-01-07 20:00   ` James Tappin
2003-01-07 23:20 ` James Tappin
2003-01-08 10:08   ` Takashi Iwai
     [not found]     ` <20030108110650.1d579069.sjt@star.sr.bham.ac.uk>
2003-01-08 12:00       ` Takashi Iwai [this message]
2003-01-08 12:52         ` James Tappin
2003-01-08 13:05           ` Takashi Iwai
2003-01-08 13:13             ` James Tappin
2003-01-08 18:38             ` James Tappin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h8yxvam1u.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=james@tappin.me.uk \
    --cc=sjt@star.sr.bham.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox