Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: James Courtier-Dutton <James@superbug.demon.co.uk>
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: intel8x0 has stopped working.
Date: Thu, 05 Feb 2004 20:42:10 +0100	[thread overview]
Message-ID: <s5hr7x98ga5.wl@alsa2.suse.de> (raw)
In-Reply-To: <40217A56.2020808@superbug.demon.co.uk>

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

At Wed, 04 Feb 2004 23:03:50 +0000,
James Courtier-Dutton wrote:
> 
> Takashi Iwai wrote:
> > At Mon, 02 Feb 2004 19:42:37 +0000,
> > James Courtier-Dutton wrote:
> > 
> >>Once thing I have noticed, is that with the alc650, we used to have VRA 
> >>(alsa 0.9.8), but the 1.0.2 intel8x0 driver ignores the VRA and fixes 
> >>itself at 48000.
> > 
> > 
> > yes, the detection of sample rate range seems broken for some codecs.
> > it was completely rewritten using the generic ac97_pcm.c.
> > 
> > could you check the debug messages with the attached patch?
> > 
> > 
> > Takashi
> > 
> 
> Here is the output as requested.

thanks, could you try the attached patch again and show the kernel
messages?
(this might fix the detection, too, BTW.)


Takashi

[-- Attachment #2: Type: text/plain, Size: 6814 bytes --]

Index: alsa-kernel/pci/ac97/ac97_codec.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_codec.c,v
retrieving revision 1.107
diff -u -r1.107 ac97_codec.c
--- alsa-kernel/pci/ac97/ac97_codec.c	5 Feb 2004 11:30:02 -0000	1.107
+++ alsa-kernel/pci/ac97/ac97_codec.c	5 Feb 2004 19:17:42 -0000
@@ -1867,7 +1867,9 @@
 		snd_ac97_write_cache(ac97, AC97_EXTENDED_STATUS, ac97->ext_id & 0x0189);
 	if (ac97->ext_id & AC97_EI_VRA) {	/* VRA support */
 		snd_ac97_determine_rates(ac97, AC97_PCM_FRONT_DAC_RATE, &ac97->rates[AC97_RATES_FRONT_DAC]);
+		printk(KERN_DEBUG "determined VRA rates: 0x%x\n", ac97->rates[AC97_RATES_FRONT_DAC]);
 		snd_ac97_determine_rates(ac97, AC97_PCM_LR_ADC_RATE, &ac97->rates[AC97_RATES_ADC]);
+		printk(KERN_DEBUG "determined VRA rates: 0x%x\n", ac97->rates[AC97_RATES_ADC]);
 	} else {
 		ac97->rates[AC97_RATES_FRONT_DAC] = SNDRV_PCM_RATE_48000;
 		ac97->rates[AC97_RATES_ADC] = SNDRV_PCM_RATE_48000;
@@ -1882,19 +1884,23 @@
 			ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000 |
 						SNDRV_PCM_RATE_44100 |
 						SNDRV_PCM_RATE_32000;
+		printk(KERN_DEBUG "determined SPDIF rates: 0x%x\n", ac97->rates[AC97_RATES_SPDIF]);
 	}
 	if (ac97->ext_id & AC97_EI_VRM) {	/* MIC VRA support */
 		snd_ac97_determine_rates(ac97, AC97_PCM_MIC_ADC_RATE, &ac97->rates[AC97_RATES_MIC_ADC]);
+		printk(KERN_DEBUG "determined MIC rates: 0x%x\n", ac97->rates[AC97_RATES_MIC_ADC]);
 	} else {
 		ac97->rates[AC97_RATES_MIC_ADC] = SNDRV_PCM_RATE_48000;
 	}
 	if (ac97->ext_id & AC97_EI_SDAC) {	/* SDAC support */
 		snd_ac97_determine_rates(ac97, AC97_PCM_SURR_DAC_RATE, &ac97->rates[AC97_RATES_SURR_DAC]);
 		ac97->scaps |= AC97_SCAP_SURROUND_DAC;
+		printk(KERN_DEBUG "determined SDAC rates: 0x%x\n", ac97->rates[AC97_RATES_SURR_DAC]);
 	}
 	if (ac97->ext_id & AC97_EI_LDAC) {	/* LDAC support */
 		snd_ac97_determine_rates(ac97, AC97_PCM_LFE_DAC_RATE, &ac97->rates[AC97_RATES_LFE_DAC]);
 		ac97->scaps |= AC97_SCAP_CENTER_LFE_DAC;
+		printk(KERN_DEBUG "determined LDAC rates: 0x%x\n", ac97->rates[AC97_RATES_LFE_DAC]);
 	}
 	/* additional initializations */
 	if (bus->init)
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.10
diff -u -r1.10 ac97_pcm.c
--- alsa-kernel/pci/ac97/ac97_pcm.c	2 Jan 2004 13:39:33 -0000	1.10
+++ alsa-kernel/pci/ac97/ac97_pcm.c	5 Feb 2004 19:40:04 -0000
@@ -284,6 +284,7 @@
 		if (ac97_is_rev22(ac97)) {
 			/* Note: it's simply emulation of AMAP behaviour */
 			u16 es;
+			printk(KERN_DEBUG "get_pslots: rev22 amap emu\n");
 			es = ac97->regs[AC97_EXTENDED_STATUS] &= ~AC97_EI_DACS_SLOT_MASK;
 			switch (ac97->addr) {
 			case 1:
@@ -292,6 +293,7 @@
 			}
 			snd_ac97_write_cache(ac97, AC97_EXTENDED_STATUS, es);
 		}
+		printk(KERN_DEBUG "get_pslots: AMAP: addr=%d, scaps=0x%x, ext_id=0x%x\n", ac97->addr, ac97->scaps, ac97->ext_id);
 		switch (ac97->addr) {
 		case 0:
 			slots |= (1<<AC97_SLOT_PCM_LEFT)|(1<<AC97_SLOT_PCM_RIGHT);
@@ -332,6 +334,7 @@
 		return slots;
 	} else {
 		unsigned short slots;
+		printk(KERN_DEBUG "get_pslots: others: addr=%d, scaps=0x%x, ext_id=0x%x\n", ac97->addr, ac97->scaps, ac97->ext_id);
 		slots = (1<<AC97_SLOT_PCM_LEFT)|(1<<AC97_SLOT_PCM_RIGHT);
 		if (ac97->scaps & AC97_SCAP_SURROUND_DAC)
 			slots |= (1<<AC97_SLOT_PCM_SLEFT)|(1<<AC97_SLOT_PCM_SRIGHT);
@@ -371,6 +374,10 @@
 		if (!(slots & (1 << i)))
 			continue;
 		reg = get_slot_reg(pcm, cidx, i, dbl);
+		if (reg == 0xff) {
+			printk(KERN_DEBUG "get_rates: cidx=%d, slot=%d, reg=0x%x\n", cidx, i, reg);
+			continue;
+		}
 		switch (reg) {
 		case AC97_PCM_FRONT_DAC_RATE:	idx = AC97_RATES_FRONT_DAC; break;
 		case AC97_PCM_SURR_DAC_RATE:	idx = AC97_RATES_SURR_DAC; break;
@@ -380,6 +387,7 @@
 		default:			idx = AC97_RATES_SPDIF; break;
 		}
 		rates &= pcm->r[dbl].codec[cidx]->rates[idx];
+		printk(KERN_DEBUG "get_rates: cidx=%d, slot=%d, reg=0x%x, rates=0x%x\n", cidx, i, reg, pcm->r[dbl].codec[cidx]->rates[idx]);
 	}
 	return rates;
 }
@@ -420,16 +428,19 @@
 			continue;
 		avail_slots[0][i] = get_pslots(codec, &rate_table[0][i], &spdif_slots[i]);
 		avail_slots[1][i] = get_cslots(codec);
+		printk(KERN_DEBUG "checking codec %d, slots = 0x%x / 0x%x\n", i, avail_slots[0][i], avail_slots[1][i]);
 		if (!(codec->scaps & AC97_SCAP_INDEP_SDIN)) {
 			for (j = 0; j < i; j++) {
 				if (bus->codec[j])
 					avail_slots[1][i] &= ~avail_slots[1][j];
 			}
+			printk(KERN_DEBUG "-> capture slots = 0x%x\n", avail_slots[1][i]);
 		}
 	}
 	/* FIXME: add double rate allocation */
 	/* first step - exclusive devices */
 	for (i = 0; i < pcms_count; i++) {
+		printk(KERN_DEBUG "probing pcm %d\n", i);
 		pcm = &pcms[i];
 		rpcm = &rpcms[i];
 		/* low-level driver thinks that it's more clever */
@@ -452,22 +463,27 @@
 				tmp = spdif_slots[j];
 			else
 				tmp = avail_slots[pcm->stream][j];
+			printk(KERN_DEBUG ".. probing codec %d, slots = 0x%x, tmp = 0x%x\n", j, slots, tmp);
 			if (pcm->exclusive) {
 				/* exclusive access */
 				tmp &= slots;
+				printk(KERN_DEBUG ".. exclusive tmp = 0x%x\n", tmp);
 				for (k = 0; k < i; k++) {
 					if (rpcm->stream == rpcms[k].stream)
 						tmp &= ~rpcms[k].r[0].rslots[j];
 				}
+				printk(KERN_DEBUG "..... tmp = 0x%x\n", tmp);
 			} else {
 				/* non-exclusive access */
 				tmp &= pcm->r[0].slots;
+				printk(KERN_DEBUG ".. non-exclusive tmp = 0x%x\n", tmp);
 			}
 			if (tmp) {
 				rpcm->r[0].rslots[j] = tmp;
 				rpcm->r[0].codec[j] = bus->codec[j];
 				rpcm->r[0].rate_table[j] = rate_table[pcm->stream][j];
 				rates = get_rates(rpcm, j, tmp, 0);
+				printk(KERN_DEBUG ".. rslots = 0x%x, rate_table = %d, rates = 0x%x\n", tmp, rpcm->r[0].rate_table[j], rates);
 				if (pcm->exclusive)
 					avail_slots[pcm->stream][j] &= ~tmp;
 			}
@@ -475,6 +491,7 @@
 			rpcm->r[0].slots |= tmp;
 			rpcm->rates &= rates;
 		}
+		printk(KERN_DEBUG "--> slots = 0x%x, rates = 0x%x\n", rpcm->r[0].slots, rpcm->rates);
 		if (rpcm->rates == ~0)
 			rpcm->rates = 0; /* not used */
 	}
@@ -501,6 +518,7 @@
 	unsigned char reg;
 	int err = 0;
 
+	printk(KERN_DEBUG "ac97_pcm_open: rate = %d, cfg = %d, slots = 0x%x\n", rate, cfg, slots);
 	if (rate > 48000)	/* FIXME: add support for double rate */
 		return -EINVAL;
 	bus = pcm->bus;
@@ -549,7 +567,7 @@
 				}
 				if (reg_ok & (1 << (reg - AC97_PCM_FRONT_DAC_RATE)))
 					continue;
-				//printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate);
+				printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate);
 				err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate);
 				if (err < 0)
 					snd_printk(KERN_ERR "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err);

  parent reply	other threads:[~2004-02-05 19:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-02 17:41 intel8x0 has stopped working James Courtier-Dutton
2004-02-02 17:59 ` Takashi Iwai
2004-02-02 19:34   ` Prakash K. Cheemplavam
2004-02-02 19:42   ` James Courtier-Dutton
2004-02-02 23:12     ` [PATCH] Fixes: " James Courtier-Dutton
2004-02-03 16:22       ` Jaroslav Kysela
2004-02-03 22:21         ` James Courtier-Dutton
2004-02-05 11:01           ` Jaroslav Kysela
2004-02-05 19:15             ` Glenn Maynard
2004-02-05 19:25               ` Takashi Iwai
2004-02-05 19:38               ` Jaroslav Kysela
2004-02-05 19:58                 ` Glenn Maynard
2004-02-05 20:44                 ` James Courtier-Dutton
2004-02-04 19:35     ` Takashi Iwai
2004-02-04 23:03       ` James Courtier-Dutton
2004-02-05 18:49         ` Takashi Iwai
2004-02-05 19:42         ` Takashi Iwai [this message]
2004-02-05 22:28           ` James Courtier-Dutton
2004-02-06 11:29             ` Takashi Iwai
2004-02-06 20:05               ` James Courtier-Dutton
2004-02-09 10:56                 ` Takashi Iwai

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=s5hr7x98ga5.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=James@superbug.demon.co.uk \
    --cc=alsa-devel@alsa-project.org \
    /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