Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: R CHAN <rspchan@starhub.net.sg>
Cc: perex@suse.cz, alsa-devel@lists.sourceforge.net
Subject: Re: Re: ALSA 1.0.0pre1 is released - intel8x0 is oopsing (2.6)
Date: Thu, 20 Nov 2003 16:33:18 +0100	[thread overview]
Message-ID: <s5hk75vys01.wl@alsa2.suse.de> (raw)
In-Reply-To: <3FBC70F5.3060706@starhub.net.sg>

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

At Thu, 20 Nov 2003 15:44:53 +0800,
R CHAN wrote:
> 
> Just tried ALSA CVS and 2.6.0-test9 current bk.
> CVS snd-intel8x0 is oopsing.

could you try the attached patch?


Takashi

[-- Attachment #2: intel8x0-fix.dif --]
[-- Type: application/octet-stream, Size: 4942 bytes --]

Index: alsa-kernel/include/ac97_codec.h
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/include/ac97_codec.h,v
retrieving revision 1.34
diff -u -r1.34 ac97_codec.h
--- alsa-kernel/include/ac97_codec.h	18 Nov 2003 11:48:28 -0000	1.34
+++ alsa-kernel/include/ac97_codec.h	20 Nov 2003 15:22:47 -0000
@@ -479,7 +479,7 @@
 
 int snd_ac97_pcm_assign(ac97_bus_t *ac97,
 			unsigned short pcms_count,
-			struct ac97_pcm *pcms);
+			const struct ac97_pcm *pcms);
 int snd_ac97_pcm_open(struct ac97_pcm *pcm, unsigned int rate,
 		      enum ac97_pcm_cfg cfg, unsigned short slots);
 int snd_ac97_pcm_close(struct ac97_pcm *pcm);
Index: alsa-kernel/pci/intel8x0.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/intel8x0.c,v
retrieving revision 1.101
diff -u -r1.101 intel8x0.c
--- alsa-kernel/pci/intel8x0.c	18 Nov 2003 11:48:28 -0000	1.101
+++ alsa-kernel/pci/intel8x0.c	20 Nov 2003 15:30:21 -0000
@@ -892,8 +892,10 @@
 	err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
 	if (err < 0)
 		return err;
-	if (ichdev->pcm_open_flag)
+	if (ichdev->pcm_open_flag) {
 		snd_ac97_pcm_close(ichdev->pcm);
+		ichdev->pcm_open_flag = 0;
+	}
 	err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params),
 				params_channels(hw_params),
 				ichdev->pcm->r[0].slots);
@@ -906,8 +908,10 @@
 {
 	ichdev_t *ichdev = get_ichdev(substream);
 
-	if (ichdev->pcm_open_flag)
+	if (ichdev->pcm_open_flag) {
 		snd_ac97_pcm_close(ichdev->pcm);
+		ichdev->pcm_open_flag = 0;
+	}
 	return snd_pcm_lib_free_pages(substream);
 }
 
@@ -1765,14 +1769,16 @@
 		goto __err;
 	chip->ac97_bus = pbus;
 	ac97.pci = chip->pci;
-	if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) {
-	      __err:
-		/* clear the cold-reset bit for the next chance */
-		if (chip->device_type != DEVICE_ALI)
-			iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD);
-		return err;
+	for (i = 0; i < codecs; i++) {
+		ac97.num = i;
+		if ((err = snd_ac97_mixer(pbus, &ac97, &x97)) < 0) {
+			snd_printk(KERN_ERR "Unable to initialize codec #%d\n", i);
+			if (i == 0)
+				goto __err;
+			continue;
+		}
+		chip->ac97[i] = x97;
 	}
-	chip->ac97[0] = x97;
 	/* tune up the primary codec */
 	snd_ac97_tune_hardware(chip->ac97[0], ac97_quirks);
 	/* enable separate SDINs for ICH4 */
@@ -1784,7 +1790,7 @@
 		i -= 2;		/* do not allocate PCM2IN and MIC2 */
 	if (spdif_idx < 0)
 		i--;		/* do not allocate S/PDIF */
-	err = snd_ac97_pcm_assign(pbus, ARRAY_SIZE(ac97_pcm_defs), ac97_pcm_defs);
+	err = snd_ac97_pcm_assign(pbus, i, ac97_pcm_defs);
 	if (err < 0)
 		goto __err;
 	chip->ichd[ICHD_PCMOUT].pcm = &pbus->pcms[0];
@@ -1826,6 +1832,12 @@
 	}
 	chip->in_ac97_init = 0;
 	return 0;
+
+ __err:
+	/* clear the cold-reset bit for the next chance */
+	if (chip->device_type != DEVICE_ALI)
+		iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD);
+	return err;
 }
 
 
Index: alsa-kernel/pci/ac97/ac97_pcm.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_pcm.c,v
retrieving revision 1.2
diff -u -r1.2 ac97_pcm.c
--- alsa-kernel/pci/ac97/ac97_pcm.c	18 Nov 2003 13:51:31 -0000	1.2
+++ alsa-kernel/pci/ac97/ac97_pcm.c	20 Nov 2003 15:23:34 -0000
@@ -260,7 +260,7 @@
 		unsigned short slots = 0;
 		if (ac97_is_rev22(ac97)) {
 			/* Note: it's simply emulation of AMAP behaviour */
-			u8 es;
+			u16 es;
 			es = ac97->regs[AC97_EXTENDED_STATUS] &= ~AC97_EI_DACS_SLOT_MASK;
 			switch (ac97->addr) {
 			case 1:
@@ -357,11 +357,7 @@
 		case AC97_PCM_MIC_ADC_RATE:	idx = AC97_RATES_MIC_ADC; break;
 		default:			idx = AC97_RATES_SPDIF; break;
 		}
-		if (rates == ~0) {
-			rates = pcm->r[dbl].codec[cidx]->rates[idx];
-		} else {
-			rates &= pcm->r[dbl].codec[cidx]->rates[idx];
-		}
+		rates &= pcm->r[dbl].codec[cidx]->rates[idx];
 	}
 	return rates;
 }
@@ -378,7 +374,7 @@
  */
 int snd_ac97_pcm_assign(ac97_bus_t *bus,
 			unsigned short pcms_count,
-			struct ac97_pcm *pcms)
+			const struct ac97_pcm *pcms)
 {
 	int i, j, k;
 	struct ac97_pcm *pcm, *rpcms, *rpcm;
@@ -389,7 +385,7 @@
 	unsigned int rates;
 	ac97_t *codec;
 
-	rpcms = snd_kcalloc(sizeof(struct ac97_pcm), GFP_KERNEL);
+	rpcms = snd_kcalloc(sizeof(struct ac97_pcm) * pcms_count, GFP_KERNEL);
 	if (rpcms == NULL)
 		return -ENOMEM;
 	memset(avail_slots, 0, sizeof(avail_slots));
@@ -421,6 +417,7 @@
 		rpcm->exclusive = pcm->exclusive;
 		rpcm->private_value = pcm->private_value;
 		rpcm->bus = bus;
+		rpcm->rates = ~0;
 		slots = pcm->r[0].slots;
 		for (j = 0; j < 4 && slots; j++) {
 			rates = ~0;
@@ -448,11 +445,7 @@
 			}
 			slots &= ~tmp;
 			rpcm->r[0].slots |= tmp;
-			if (j == 0) {
-				pcm->rates = rates;
-			} else {
-				pcm->rates &= rates;
-			}
+			rpcm->rates &= rates;
 		}
 	}
 	bus->pcms_count = pcms_count;

  reply	other threads:[~2003-11-20 15:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-19 15:46 [ANN] ALSA 1.0.0pre1 is released Takashi Iwai
2003-11-19 22:39 ` Paul Hanly (Hotmail)
2003-11-20  9:49   ` Takashi Iwai
2003-11-20  1:30 ` Fernando Pablo Lopez-Lezcano
2003-11-20  7:44   ` ALSA 1.0.0pre1 is released - intel8x0 is oopsing (2.6) R CHAN
2003-11-20 15:33     ` Takashi Iwai [this message]
2003-11-21  2:50     ` Re: ALSA 1.0.0pre1 is released - intel8x0 is oopsing (2.6) - FIXED! R CHAN
2003-11-20  9:53   ` [ANN] ALSA 1.0.0pre1 is released Takashi Iwai
2003-11-20 10:01 ` 1.0.0pre1 / ice1712 / mplayer-oss-delay Steffen Sauder
2003-11-20 11:08   ` Takashi Iwai
2003-11-20 16:47 ` [ANN] ALSA 1.0.0pre1 is released Takashi Iwai
2003-11-20 18:30 ` Dave Neuer
2003-11-20 18:45   ` [Alsa-user] " Takashi Iwai
2003-11-26 17:31 ` Kai Vehmanen
2003-11-26 17:37   ` Takashi Iwai
2003-11-26 17:45     ` Kai Vehmanen
2003-11-27 16:16     ` problems with intel8x0 and 1.0.0pre3 (was: Re: [ANN] ALSA 1.0.0pre1 is released) Kai Vehmanen
2003-11-27 16:23       ` Takashi Iwai
2003-11-27 18:08         ` Takashi Iwai
2003-11-28 14:06           ` Kai Vehmanen
2003-12-01 17:44       ` problems with intel8x0 and 1.0.0pre3 Kai Vehmanen

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=s5hk75vys01.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=perex@suse.cz \
    --cc=rspchan@starhub.net.sg \
    /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