Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: kasper@303.nu
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: es18xx - 1869 not working, debugging ALSA drivers
Date: Mon, 02 Dec 2002 14:34:21 +0100	[thread overview]
Message-ID: <s5hy978a6jm.wl@alsa2.suse.de> (raw)
In-Reply-To: <s5hel95zk1u.wl@alsa2.suse.de>

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

      reply	other threads:[~2002-12-02 13:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=s5hy978a6jm.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=kasper@303.nu \
    /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