All of lore.kernel.org
 help / color / mirror / Atom feed
* es18xx - 1869 not working, debugging ALSA drivers
@ 2002-11-05 19:33 kasper
  2002-11-05 21:56 ` Benny Sjostrand
  2002-11-28 17:22 ` Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: kasper @ 2002-11-05 19:33 UTC (permalink / raw)
  To: alsa-devel

Hi,

I've been trying to get ALSA running on my Compaq Armada 3500 for quite a 
while now. The soundchip is a es1869, which is supposed to be supported by 
the es18xx driver. It only works 1 out of 10 times though - and I figured out 
when it works and when it doesn't... But that didn't help me much until now, 
I tried to force it to always use the working mode, but that didn't work 
out...

The OSS driver is working properly, but I use the Soundblaster driver, which 
is only half-duplex, and in fact, it's a different mode of the soundchip.

I've been trying to debug the driver, but it's not really my thing... Maybe 
there are some handy tricks to debug ALSA drivers? Or is it just:
1) change the source
2) compile the source
3) see if it works (by loading the module.. and playing some audio)
4) if it doesn't work restart with 1)

Are there tools to control soundchips without using this laborious cycle? Some 
kind of framework to check out the stuff that is written in the chip's 
datasheet?

greetz,
Kasper


-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: es18xx - 1869 not working, debugging ALSA drivers
  2002-11-05 19:33 es18xx - 1869 not working, debugging ALSA drivers kasper
@ 2002-11-05 21:56 ` Benny Sjostrand
  2002-11-28 17:22 ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Benny Sjostrand @ 2002-11-05 21:56 UTC (permalink / raw)
  To: kasper; +Cc: alsa-devel

>
>
>I've been trying to debug the driver, but it's not really my thing... Maybe 
>there are some handy tricks to debug ALSA drivers? Or is it just:
>1) change the source
>2) compile the source
>3) see if it works (by loading the module.. and playing some audio)
>4) if it doesn't work restart with 1)
>  
>
Yeah,.., I feel familiar with that method -:) I guess I'm not the only one
Probably you can add a point:
 3.5) If the computer totally freezes (course change to the source was 
very wrong and bad) restart computer, and go to 1) + (I hate ext2 
filesystems)

 I don't known any better method, maybe just yet another point:
1.5) review changes yet one more time and go back to 1 or 1.5 a couple 
of times
       to try prevent moment "3.5"

But, stuffs like the tool  "ksymoops", the alsa functions/macros:  
snd_assert(...),
snd_magic_cast(...), snd_printk(...), snd_printdd(...), etc. helps a lot!

/Benny





-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: es18xx - 1869 not working, debugging ALSA drivers
  2002-11-05 19:33 es18xx - 1869 not working, debugging ALSA drivers kasper
  2002-11-05 21:56 ` Benny Sjostrand
@ 2002-11-28 17:22 ` Takashi Iwai
  2002-12-02 13:34   ` Takashi Iwai
  1 sibling, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2002-11-28 17:22 UTC (permalink / raw)
  To: kasper; +Cc: alsa-devel

At Tue, 5 Nov 2002 20:33:16 +0100,
kasper@303.nu wrote:
> 
> Hi,
> 
> I've been trying to get ALSA running on my Compaq Armada 3500 for quite a 
> while now. The soundchip is a es1869, which is supposed to be supported by 
> the es18xx driver. It only works 1 out of 10 times though - and I figured out 
> when it works and when it doesn't... But that didn't help me much until now, 
> I tried to force it to always use the working mode, but that didn't work 
> out...
> 
> The OSS driver is working properly, but I use the Soundblaster driver, which 
> is only half-duplex, and in fact, it's a different mode of the soundchip.

i've seen this on my colleague's laptop.
it seems that the second DAC (which is used for the playback) doesn't
work although it looks as if initialized properly.

perhaps an easy solution is to make a module option to make the driver
work as half-duplex.



> I've been trying to debug the driver, but it's not really my thing... Maybe 
> there are some handy tricks to debug ALSA drivers? Or is it just:
> 1) change the source
> 2) compile the source
> 3) see if it works (by loading the module.. and playing some audio)
> 4) if it doesn't work restart with 1)
> 
> Are there tools to control soundchips without using this laborious cycle? Some 
> kind of framework to check out the stuff that is written in the chip's 
> datasheet?

i'd love to have such a tool :)

btw, if you need to access only i/o ports, then even a user program
can do.  it would be easier than recompiling the driver.


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T 
handheld. Power & Color in a compact size! 
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: es18xx - 1869 not working, debugging ALSA drivers
  2002-11-28 17:22 ` Takashi Iwai
@ 2002-12-02 13:34   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2002-12-02 13:34 UTC (permalink / raw)
  To: kasper; +Cc: alsa-devel

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

Hi,

At Thu, 28 Nov 2002 18:22:05 +0100,
I wrote:
> 
> At Tue, 5 Nov 2002 20:33:16 +0100,
> kasper@303.nu wrote:
> > 
> > Hi,
> > 
> > I've been trying to get ALSA running on my Compaq Armada 3500 for quite a 
> > while now. The soundchip is a es1869, which is supposed to be supported by 
> > the es18xx driver. It only works 1 out of 10 times though - and I figured out 
> > when it works and when it doesn't... But that didn't help me much until now, 
> > I tried to force it to always use the working mode, but that didn't work 
> > out...
> > 
> > The OSS driver is working properly, but I use the Soundblaster driver, which 
> > is only half-duplex, and in fact, it's a different mode of the soundchip.
> 
> i've seen this on my colleague's laptop.
> it seems that the second DAC (which is used for the playback) doesn't
> work although it looks as if initialized properly.
> 
> perhaps an easy solution is to make a module option to make the driver
> work as half-duplex.

with the attached patch, you can speficy the same value to both dma1
and dma2, and the driver works as half-duplex.
could you check whether it works for you?


thanks,

Takashi

[-- Attachment #2: es18xx-one-dma.dif --]
[-- Type: application/octet-stream, Size: 4820 bytes --]

Index: alsa-kernel/isa/es18xx.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/isa/es18xx.c,v
retrieving revision 1.19
diff -u -r1.19 es18xx.c
--- alsa-kernel/isa/es18xx.c	30 Oct 2002 11:02:40 -0000	1.19
+++ alsa-kernel/isa/es18xx.c	2 Dec 2002 13:25:44 -0000
@@ -444,8 +444,7 @@
 	if (snd_pcm_format_width(params_format(hw_params)) == 16)
 		shift++;
 
-	switch (substream->number) {
-	case 0:
+	if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
 		if ((chip->caps & ES18XX_DUPLEX_MONO) &&
 		    (chip->capture_a_substream) &&
 		    params_channels(hw_params) != 1) {
@@ -453,10 +452,8 @@
 			return -EBUSY;
 		}
 		chip->dma2_shift = shift;
-		break;
-	case 1:
+	} else {
 		chip->dma1_shift = shift;
-		break;
 	}
 	if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0)
 		return err;
@@ -708,26 +705,20 @@
 static int snd_es18xx_playback_prepare(snd_pcm_substream_t *substream)
 {
         es18xx_t *chip = snd_pcm_substream_chip(substream);
-	switch (substream->number) {
-	case 0:
+	if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
 		return snd_es18xx_playback1_prepare(chip, substream);
-	case 1:
+	else
 		return snd_es18xx_playback2_prepare(chip, substream);
-	}
-	return -EINVAL;
 }
 
 static int snd_es18xx_playback_trigger(snd_pcm_substream_t *substream,
 				       int cmd)
 {
         es18xx_t *chip = snd_pcm_substream_chip(substream);
-	switch (substream->number) {
-	case 0:
+	if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
 		return snd_es18xx_playback1_trigger(chip, substream, cmd);
-	case 1:
+	else
 		return snd_es18xx_playback2_trigger(chip, substream, cmd);
-	}
-	return -EINVAL;
 }
 
 static void snd_es18xx_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -798,19 +789,17 @@
         es18xx_t *chip = snd_pcm_substream_chip(substream);
 	int pos;
 
-	switch (substream->number) {
-	case 0:
+	if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
 		if (!(chip->active & DAC2))
 			return 0;
 		pos = chip->dma2_size - snd_dma_residue(chip->dma2);
 		return pos >> chip->dma2_shift;
-	case 1:
+	} else {
 		if (!(chip->active & DAC1))
 			return 0;
 		pos = chip->dma1_size - snd_dma_residue(chip->dma1);
 		return pos >> chip->dma1_shift;
 	}
-	return 0;
 }
 
 static snd_pcm_uframes_t snd_es18xx_capture_pointer(snd_pcm_substream_t * substream)
@@ -867,20 +856,17 @@
 	snd_pcm_runtime_t *runtime = substream->runtime;
         es18xx_t *chip = snd_pcm_substream_chip(substream);
 
-	switch (substream->number) {
-	case 0:
+	if (substream->number == 0 && (chip->caps & ES18XX_PCM2)) {
 		if ((chip->caps & ES18XX_DUPLEX_MONO) &&
 		    chip->capture_a_substream && 
 		    chip->capture_a_substream->runtime->channels != 1)
 			return -EAGAIN;
 		chip->playback_a_substream = substream;
-		break;
-	case 1:
+	} else if (substream->number <= 1) {
 		if (chip->capture_a_substream)
 			return -EAGAIN;
 		chip->playback_b_substream = substream;
-		break;
-	default:
+	} else {
 		snd_BUG();
 		return -EINVAL;
 	}
@@ -912,17 +898,10 @@
 {
         es18xx_t *chip = snd_pcm_substream_chip(substream);
 
-	switch (substream->number) {
-	case 0:
+	if (substream->number == 0 && (chip->caps & ES18XX_PCM2))
 		chip->playback_a_substream = NULL;
-		break;
-	case 1:
+	else
 		chip->playback_b_substream = NULL;
-		break;
-	default:
-		snd_BUG();
-		return -EINVAL;
-	}
 	
 	snd_pcm_lib_free_pages(substream);
 	return 0;
@@ -1544,6 +1523,9 @@
 
         snd_printd("[0x%lx] ESS%x chip found\n", chip->port, chip->version);
 
+	if (chip->dma1 == chip->dma2)
+		chip->caps &= ~(ES18XX_PCM2 | ES18XX_DUPLEX_SAME);
+
         return snd_es18xx_initialize(chip);
 }
 
@@ -1709,7 +1691,7 @@
 		disable_dma(chip->dma1);
 		free_dma(chip->dma1);
 	}
-	if (chip->dma2 >= 0) {
+	if (chip->dma2 >= 0 && chip->dma1 != chip->dma2) {
 		disable_dma(chip->dma2);
 		free_dma(chip->dma2);
 	}
@@ -1773,7 +1755,7 @@
 	}
 	chip->dma1 = dma1;
 
-	if (request_dma(dma2, "ES18xx DMA 2")) {
+	if (dma2 != dma1 && request_dma(dma2, "ES18xx DMA 2")) {
 		snd_es18xx_free(chip);
 		printk(KERN_ERR PFX "unable to grap DMA2 %d\n", dma2);
 		return -EBUSY;
@@ -2181,10 +2163,16 @@
 #endif
 	sprintf(card->driver, "ES%x", chip->version);
 	sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
-	sprintf(card->longname, "%s at 0x%lx, irq %d, dma1 %d, dma2 %d",
-		card->shortname,
-		chip->port,
-		xirq, xdma1, xdma2);
+	if (xdma1 != xdma2)
+		sprintf(card->longname, "%s at 0x%lx, irq %d, dma1 %d, dma2 %d",
+			card->shortname,
+			chip->port,
+			xirq, xdma1, xdma2);
+	else
+		sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
+			card->shortname,
+			chip->port,
+			xirq, xdma1);
 	if ((err = snd_card_register(card)) < 0) {
 		snd_card_free(card);
 		return err;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-12-02 13:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-05 19:33 es18xx - 1869 not working, debugging ALSA drivers kasper
2002-11-05 21:56 ` Benny Sjostrand
2002-11-28 17:22 ` Takashi Iwai
2002-12-02 13:34   ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.