Skip to contentSkip to conversation

Intel8x0 problems with rc1

DISCUSSION Thomas Charbonnel 3 participants 16 messages Dec 1, 2003 – Dec 3, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

I'm testing rc1, and I have problems with my laptop's internal intel8x0
soundcard :
* Using OSS emulation, after between 19 and 20 seconds of playing the
sound gets garbled for a few seconds and then comes back to normal. This
happens each time I stop and start playback again.
* Using alsa natively there is a performance problem : running jack with the card (-p 1024) I get 3 or 4 xruns per second (I used to run this card with -p 64 with previous alsa versions !). With -p 4096 I get c.a. 1 xrun/second, so there seems to be a constant ratio, like 1 xrun every 10 buffers.

No problem in the same conditions using the hdsp.

Thomas

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#1 lore raw

At Mon, 01 Dec 2003 19:15:59 +0100,

Quoted 11 lines · Thomas Charbonnel

Hi,

I'm testing rc1, and I have problems with my laptop's internal intel8x0 soundcard :
* Using OSS emulation, after between 19 and 20 seconds of playing the sound gets garbled for a few seconds and then comes back to normal. This happens each time I stop and start playback again.
* Using alsa natively there is a performance problem : running jack with the card (-p 1024) I get 3 or 4 xruns per second (I used to run this card with -p 64 with previous alsa versions !).

could you give the specific version which ran properly?

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#2 lore raw

At Mon, 01 Dec 2003 19:30:07 +0100,

Quoted 15 lines · I wrote:

At Mon, 01 Dec 2003 19:15:59 +0100,

Quoted 11 lines · Thomas Charbonnel

Hi,

I'm testing rc1, and I have problems with my laptop's internal intel8x0 soundcard :
* Using OSS emulation, after between 19 and 20 seconds of playing the sound gets garbled for a few seconds and then comes back to normal. This happens each time I stop and start playback again.
* Using alsa natively there is a performance problem : running jack with the card (-p 1024) I get 3 or 4 xruns per second (I used to run this card with -p 64 with previous alsa versions !).

Quoted 1 line

could you give the specific version which ran properly?

does the attached patch make difference (if you give use_civ=0 option) ?

Takashi

Index: alsa-kernel/pci/intel8x0.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/intel8x0.c,v retrieving revision 1.102

pci/intel8x0.c +10 -1
diff -u -r1.102 intel8x0.c
@@ -75,6 +75,7 @@
 #ifdef SUPPORT_MIDI
 static int mpu_port[SNDRV_CARDS]; /* disabled */
 #endif
+static int use_civ[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
 
 MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard.");
@@ -98,6 +99,9 @@
 MODULE_PARM_DESC(mpu_port, "MPU401 port # for Intel i8x0 driver.");
 MODULE_PARM_SYNTAX(mpu_port, SNDRV_ENABLED ",allows:{{0},{0x330},{0x300}},dialog:list");
 #endif
+MODULE_PARM(use_civ, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+MODULE_PARM_DESC(use_civ, "Read CIV register for updating the stream position.");
+MODULE_PARM_SYNTAX(use_civ, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);
 
 /*
  *  Direct registers
@@ -401,6 +405,7 @@
 	    smp20bit: 1;
 	int in_ac97_init: 1,
 	    in_sdin_init: 1;
+	int use_civ: 1;
 
 	ac97_bus_t *ac97_bus;
 	ac97_t *ac97[3];
@@ -728,9 +733,10 @@
 static inline void snd_intel8x0_update(intel8x0_t *chip, ichdev_t *ichdev)
 {
 	unsigned long port = ichdev->reg_offset;
-	int civ, i, step;
+	int civ, i, step = 1;
 	int ack = 0;
 
+	if (chip->use_civ) {
 	civ = igetbyte(chip, port + ICH_REG_OFF_CIV);
 	if (civ == ichdev->civ) {
 		// snd_printd("civ same %d\n", civ);
@@ -745,6 +751,7 @@
 		//	snd_printd("step = %d, %d -> %d\n", step, ichdev->civ, civ);
 		ichdev->civ = civ;
 	}
+	}
 
 	ichdev->position += step * ichdev->fragsize1;
 	ichdev->position %= ichdev->size;
@@ -2546,6 +2553,8 @@
 	} else
 		mpu_port[dev] = 0;
 
+	chip->use_civ = use_civ[dev];
+
 	sprintf(card->longname, "%s at 0x%lx, irq %i",
 		card->shortname, chip->addr, chip->irq);
 
#3 lore raw
Quoted 15 lines · Takashi Iwai

At Mon, 01 Dec 2003 19:30:07 +0100,

Quoted 12 lines · I wrote:

At Mon, 01 Dec 2003 19:15:59 +0100,

Quoted 8 lines · Thomas Charbonnel

Hi,

I'm testing rc1, and I have problems with my laptop's internal intel8x0
soundcard :
* Using OSS emulation, after between 19 and 20 seconds of playing the
sound gets garbled for a few seconds and then comes back to normal. This
happens each time I stop and start playback again.
* Using alsa natively there is a performance problem : running jack with the card (-p 1024) I get 3 or 4 xruns per second (I used to run this card with -p 64 with previous alsa versions !).

Quoted 6 lines
Quoted 1 line

could you give the specific version which ran properly?

does the attached patch make difference (if you give use_civ=0 option) ?

Sorry, it does not make a difference. Incidentally I tried to run the card at 48000 Hz, and everything works as expected. Running at 44100 Hz results in the problems I mentioned above.

Thomas

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#4 lore raw

At Tue, 02 Dec 2003 13:00:04 +0100,

Quoted 22 lines · Thomas Charbonnel
Quoted 20 lines · Takashi Iwai

At Mon, 01 Dec 2003 19:30:07 +0100,

Quoted 15 lines · I wrote:

At Mon, 01 Dec 2003 19:15:59 +0100,

Quoted 10 lines · Thomas Charbonnel

Hi,

I'm testing rc1, and I have problems with my laptop's internal intel8x0 soundcard :
* Using OSS emulation, after between 19 and 20 seconds of playing the sound gets garbled for a few seconds and then comes back to normal. This happens each time I stop and start playback again.
* Using alsa natively there is a performance problem : running jack with the card (-p 1024) I get 3 or 4 xruns per second (I used to run this card with -p 64 with previous alsa versions !).

could you give the specific version which ran properly?

Quoted 7 lines
Quoted 3 lines

does the attached patch make difference (if you give use_civ=0 option) ?

Sorry, it does not make a difference. Incidentally I tried to run the card at 48000 Hz, and everything works as expected. Running at 44100 Hz results in the problems I mentioned above.

ok, then please check /proc/asound/card0/codec97#0/* files whether VRA is properly set to 44100Hz during the playback.

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#5 lore raw
Quoted 7 lines · Takashi Iwai

ok, then please check /proc/asound/card0/codec97#0/* files whether VRA is properly set to 44100Hz during the playback.

Takashi

Bingo, it seems it's not, indeed :

thomas@satellite thomas $ cat /proc/asound/card0/codec97#0/* 0-0/0: Cirrus Logic CS4299 rev 4

Capabilities : -headphone out-
DAC resolution : 20-bit
ADC resolution : 18-bit
3D enhancement : Crystal Semi 3D Stereo Enhancement

Current setup
Mic gain : +0dB [+0dB]
POP path : pre 3D
Sim. stereo : off

3D enhancement   : off
Loudness         : off
Mono output      : MIX
Mic select       : Mic1

ADC/DAC loopback : off
Extended ID : codec=0 rev=0 AMAP DSA=0 VRA
Extended status : VRA
PCM front DAC : 48000Hz
PCM ADC : 44100Hz
SPDIF Control : Consumer PCM Copyright Category=0x22 Generation=1 Rate=48kHz

Thomas

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#6 lore raw

At Tue, 02 Dec 2003 14:57:29 +0100,

Quoted 7 lines · Thomas Charbonnel
Quoted 4 lines · Takashi Iwai

ok, then please check /proc/asound/card0/codec97#0/* files whether VRA is properly set to 44100Hz during the playback.

Quoted 5 lines
Quoted 3 lines

Takashi

Bingo, it seems it's not, indeed :

please try the attached patch.
possibly this isn't a fix, but it will print debug messages while probing and opening the pcm.

Takashi

Index: alsa-kernel/include/ac97_codec.h
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/include/ac97_codec.h,v retrieving revision 1.35

include/ac97_codec.h +2 -1
diff -u -r1.35 ac97_codec.h
@@ -345,7 +345,8 @@
 	ac97_bus_t *bus;
 	unsigned int stream: 1,	   	   /* stream type: 1 = capture */
 		     exclusive: 1,	   /* exclusive mode, don't override with other pcms */
-		     copy_flag: 1;	   /* lowlevel driver must fill all entries */
+		     copy_flag: 1,	   /* lowlevel driver must fill all entries */
+		     spdif: 1;		   /* spdif pcm */
 	unsigned short aslots;		   /* active slots */
 	unsigned int rates;		   /* available rates */
 	struct {

Index: alsa-kernel/pci/intel8x0.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/intel8x0.c,v retrieving revision 1.102

pci/intel8x0.c +7 -4
diff -u -r1.102 intel8x0.c
@@ -886,6 +886,7 @@
 static int snd_intel8x0_hw_params(snd_pcm_substream_t * substream,
 				  snd_pcm_hw_params_t * hw_params)
 {
+	intel8x0_t *chip = snd_pcm_substream_chip(substream);
 	ichdev_t *ichdev = get_ichdev(substream);
 	int err;
 
@@ -899,8 +900,12 @@
 	err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params),
 				params_channels(hw_params),
 				ichdev->pcm->r[0].slots);
-	if (err >= 0)
+	if (err >= 0) {
 		ichdev->pcm_open_flag = 1;
+		/* FIXME: hack to enable spdif support */
+		if (ichdev->ichd == ICHD_PCMOUT && chip->device_type == DEVICE_SIS)
+			snd_ac97_set_rate(ichdev->pcm->r[0].codec[0], AC97_SPDIF, params_rate(hw_params));
+	}
 	return err;
 }
 
@@ -963,9 +968,6 @@
 		snd_intel8x0_setup_multi_channels(chip, runtime->channels);
 		spin_unlock(&chip->reg_lock);
 	}
-	/* FIXME: hack to enable spdif support */
-	if (ichdev->ichd == ICHD_PCMOUT && chip->device_type == DEVICE_SIS)
-		snd_ac97_set_rate(ichdev->pcm->r[0].codec[0], AC97_SPDIF, runtime->rate);
 	snd_intel8x0_setup_periods(chip, ichdev);
 	return 0;
 }
@@ -1590,6 +1592,7 @@
 	/* S/PDIF PCM */
 	{
 		.exclusive = 1,
+		.spdif = 1,
 		.r = {	{
 				.slots = (1 << AC97_SLOT_SPDIF_LEFT2) |
 					 (1 << AC97_SLOT_SPDIF_RIGHT2)

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.7

pci/ac97/ac97_pcm.c +38 -19

170 lines not on this page · raw message

#7 lore raw
Quoted 7 lines · Takashi Iwai

please try the attached patch.
possibly this isn't a fix, but it will print debug messages while probing and opening the pcm.

Takashi

Takashi, I applied your patch but nothings shows up in my logs.
I even replaced all the KERN_DEBUG by KERN_EMERG, and still nothing.
The only thing I get is this :
ALSA intel8x0.c:568: codec_semaphore: semaphore is not ready [0x1][0x300100]
ALSA intel8x0.c:599: codec_read 0: semaphore is not ready for register 0x56
Is it possible that your code never gets called ? You seem also to be investigating about spdif, but my card does not have spdif output.

Thomas

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#8 lore raw

At Tue, 02 Dec 2003 23:46:22 +0100,

Quoted 7 lines · Thomas Charbonnel
Quoted 5 lines · Takashi Iwai

please try the attached patch.
possibly this isn't a fix, but it will print debug messages while probing and opening the pcm.

Quoted 8 lines
Quoted 2 lines

Takashi

Takashi, I applied your patch but nothings shows up in my logs. I even replaced all the KERN_DEBUG by KERN_EMERG, and still nothing. The only thing I get is this :
ALSA intel8x0.c:568: codec_semaphore: semaphore is not ready [0x1][0x300100] ALSA intel8x0.c:599: codec_read 0: semaphore is not ready for register 0x56

and the driver still works somehow?

Quoted 1 line

Is it possible that your code never gets called ?

if the driver works, it must not happen.

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#9 lore raw
Quoted 10 lines · Takashi Iwai
Quoted 5 lines

Takashi, I applied your patch but nothings shows up in my logs. I even replaced all the KERN_DEBUG by KERN_EMERG, and still nothing. The only thing I get is this :
ALSA intel8x0.c:568: codec_semaphore: semaphore is not ready [0x1][0x300100] ALSA intel8x0.c:599: codec_read 0: semaphore is not ready for register 0x56

and the driver still works somehow?

Quoted 7 lines
Quoted 1 line

Is it possible that your code never gets called ?

if the driver works, it must not happen.

Takashi

Ok, my fault, sorry Takashi, I stupidly reloaded only the snd-intel8x0 module and forgot snd-ac97-codec, here's the log :

ac97_pcm_open: rate = 48000, cfg = 2, slots = 0x198
setting ac97 reg 0x2c to rate 48000
setting ac97 reg 0x2e to rate 48000
ALSA ../../alsa-kernel/pci/ac97/ac97_pcm.c:561: error in snd_ac97_set_rate: cidx=0, reg=0x2e, rate=48000 , err=-22<0>ac97_pcm_open: rate = 48000, cfg = 2, slots = 0x198

(The file's rate was 44100 kHz)

Thomas

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#10 lore raw

At Wed, 03 Dec 2003 15:47:23 +0100,

Quoted 24 lines · Thomas Charbonnel
Quoted 10 lines · Takashi Iwai
Quoted 5 lines

Takashi, I applied your patch but nothings shows up in my logs. I even replaced all the KERN_DEBUG by KERN_EMERG, and still nothing. The only thing I get is this :
ALSA intel8x0.c:568: codec_semaphore: semaphore is not ready [0x1][0x300100] ALSA intel8x0.c:599: codec_read 0: semaphore is not ready for register 0x56

and the driver still works somehow?

Quoted 7 lines
Quoted 1 line

Is it possible that your code never gets called ?

if the driver works, it must not happen.

Takashi

Ok, my fault, sorry Takashi, I stupidly reloaded only the snd-intel8x0 module and forgot snd-ac97-codec, here's the log :

Quoted 8 lines

ac97_pcm_open: rate = 48000, cfg = 2, slots = 0x198 setting ac97 reg 0x2c to rate 48000
setting ac97 reg 0x2e to rate 48000
ALSA ../../alsa-kernel/pci/ac97/ac97_pcm.c:561: error in
snd_ac97_set_rate: cidx=0, reg=0x2e, rate=48000
, err=-22<0>ac97_pcm_open: rate = 48000, cfg = 2, slots = 0x198

(The file's rate was 44100 kHz)

didn't you get any messages before this?
it should be something like

checking codec 0, slot = 0xxx / 0xxx
probing pcm 0
....

Takashi

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#11 lore raw

there also appears to be a delay of upwards of 2 seconds before it starts playing

but I don't have anything more in my logs.

_J

Quoted 46 lines · Takashi Iwai

At Wed, 03 Dec 2003 15:47:23 +0100,

Quoted 24 lines · Thomas Charbonnel
Quoted 10 lines · Takashi Iwai
Quoted 5 lines

Takashi, I applied your patch but nothings shows up in my logs. I even replaced all the KERN_DEBUG by KERN_EMERG, and still nothing. The only thing I get is this :
ALSA intel8x0.c:568: codec_semaphore: semaphore is not ready [0x1][0x300100] ALSA intel8x0.c:599: codec_read 0: semaphore is not ready for register 0x56

and the driver still works somehow?

Quoted 7 lines
Quoted 1 line

Is it possible that your code never gets called ?

if the driver works, it must not happen.

Takashi

Ok, my fault, sorry Takashi, I stupidly reloaded only the snd-intel8x0 module and forgot snd-ac97-codec, here's the log :

Quoted 8 lines

ac97_pcm_open: rate = 48000, cfg = 2, slots = 0x198 setting ac97 reg 0x2c to rate 48000
setting ac97 reg 0x2e to rate 48000
ALSA ../../alsa-kernel/pci/ac97/ac97_pcm.c:561: error in
snd_ac97_set_rate: cidx=0, reg=0x2e, rate=48000
, err=-22<0>ac97_pcm_open: rate = 48000, cfg = 2, slots = 0x198

(The file's rate was 44100 kHz)

didn't you get any messages before this?
it should be something like

checking codec 0, slot = 0xxx / 0xxx
probing pcm 0
....

Takashi

Quoted 10 lines

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Alsa-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#12 lore raw

At Wed, 3 Dec 2003 11:41:23 -0500 (EST),

Quoted 5 lines · Jeremy Hall

there also appears to be a delay of upwards of 2 seconds before it starts playing

but I don't have anything more in my logs.

you're using the cvs version, right?
then apply the patch below.

Takashi

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.8

pci/ac97/ac97_pcm.c +11 -1
diff -u -r1.8 ac97_pcm.c
@@ -418,16 +418,19 @@
 			continue;
 		avail_slots[0][i] = get_pslots(codec, &rate_table[0][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 */
@@ -445,19 +448,23 @@
 		for (j = 0; j < 4 && slots; j++) {
 			if (!bus->codec[j])
 				continue;
+			printk(KERN_DEBUG ".. probing codec %d, slots = 0x%x\n", j, slots);
 			rates = ~0;
 			if (pcm->exclusive) {
 				/* exclusive access */
 				tmp = avail_slots[pcm->stream][j] & slots;
+				printk(KERN_DEBUG ".. 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);
 				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);
 					avail_slots[pcm->stream][j] &= ~tmp;
 				}
 			} else {
@@ -476,6 +483,7 @@
 		}
 		if (rpcm->rates == ~0)
 			rpcm->rates = 0; /* not used */
+		printk(KERN_DEBUG "--> slots = 0x%x, rates = 0x%x\n", rpcm->r[0].slots, rpcm->rates);
 	}
 	bus->pcms_count = pcms_count;
 	bus->pcms = rpcms;
@@ -500,6 +508,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;
@@ -548,9 +557,10 @@
 				}
 				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);
 				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\n, err=%d", cidx, reg, rate, err);
+					snd_printk(KERN_ERR "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err);
 				else
 					reg_ok |= (1 << (reg - AC97_PCM_FRONT_DAC_RATE));
 			}
#13 lore raw

ok, applying.

Quoted 83 lines · Takashi Iwai

At Wed, 3 Dec 2003 11:41:23 -0500 (EST),

Quoted 5 lines · Jeremy Hall

there also appears to be a delay of upwards of 2 seconds before it starts playing

but I don't have anything more in my logs.

you're using the cvs version, right?
then apply the patch below.

Takashi

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.8
diff -u -r1.8 ac97_pcm.c

pci/ac97/ac97_pcm.c +9 -0
@@ -418,16 +418,19 @@
 			continue;
 		avail_slots[0][i] = get_pslots(codec, &rate_table[0][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 */
@@ -445,19 +448,23 @@
 		for (j = 0; j < 4 && slots; j++) {
 			if (!bus->codec[j])
 				continue;
+			printk(KERN_DEBUG ".. probing codec %d, slots = 0x%x\n", j, slots);
 			rates = ~0;
 			if (pcm->exclusive) {
 				/* exclusive access */
 				tmp = avail_slots[pcm->stream][j] & slots;
+				printk(KERN_DEBUG ".. 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);
 				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);
 					avail_slots[pcm->stream][j] &= ~tmp;
 				}
 			} else {
@@ -476,6 +483,7 @@
 		}
 		if (rpcm->rates == ~0)
 			rpcm->rates = 0; /* not used */
+		printk(KERN_DEBUG "--> slots = 0x%x, rates = 0x%x\n", rpcm->r[0].slots, rpcm->rates);
 	}
 	bus->pcms_count = pcms_count;
 	bus->pcms = rpcms;
@@ -500,6 +508,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;
@@ -548,9 +557,10 @@
 				}

pci/ac97/ac97_pcm.c line 566

Quoted 10 lines
pci/ac97/ac97_pcm.c +2 -1
 				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);
 				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\n, err=%d", cidx, reg, rate, err);
+					snd_printk(KERN_ERR "error in snd_ac97_set_rate: cidx=%d, reg=0x%x, rate=%d, err=%d\n", cidx, reg, rate, err);
 				else
 					reg_ok |= (1 << (reg - AC97_PCM_FRONT_DAC_RATE));
 			}

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#14 lore raw
In reply to Takashi Iwai
Quoted 36 lines · Takashi Iwai

At Wed, 03 Dec 2003 15:47:23 +0100,

Quoted 24 lines · Thomas Charbonnel
Quoted 11 lines · Takashi Iwai
Quoted 5 lines

Takashi, I applied your patch but nothings shows up in my logs. I even replaced all the KERN_DEBUG by KERN_EMERG, and still nothing. The only thing I get is this :
ALSA intel8x0.c:568: codec_semaphore: semaphore is not ready [0x1][0x300100] ALSA intel8x0.c:599: codec_read 0: semaphore is not ready for register 0x56

and the driver still works somehow?

Quoted 7 lines
Quoted 1 line

Is it possible that your code never gets called ?

if the driver works, it must not happen.

Takashi

Ok, my fault, sorry Takashi, I stupidly reloaded only the snd-intel8x0 module and forgot snd-ac97-codec, here's the log :

Quoted 7 lines

ac97_pcm_open: rate = 48000, cfg = 2, slots = 0x198
setting ac97 reg 0x2c to rate 48000
setting ac97 reg 0x2e to rate 48000
ALSA ../../alsa-kernel/pci/ac97/ac97_pcm.c:561: error in snd_ac97_set_rate: cidx=0, reg=0x2e, rate=48000 , err=-22<0>ac97_pcm_open: rate = 48000, cfg = 2, slots = 0x198

(The file's rate was 44100 kHz)

Quoted 8 lines

didn't you get any messages before this?
it should be something like

checking codec 0, slot = 0xxx / 0xxx
probing pcm 0
....

Here it is :

PCI: Setting latency timer of device 00:1f.5 to 64 checking codec 0, slots = 0x198 / 0x58
-> capture slots = 0x58
probing pcm 0
.. probing codec 0, slots = 0x3d8
.. tmp = 0x198
.. tmp = 0x198
.. rslots = 0x198, rate_table = 0, rates = 0x0 --> slots = 0x198, rates = 0x0
probing pcm 1
.. probing codec 0, slots = 0x18
.. tmp = 0x18
.. tmp = 0x18
.. rslots = 0x18, rate_table = 0, rates = 0xfe --> slots = 0x18, rates = 0xfe
probing pcm 2
.. probing codec 0, slots = 0x40
.. tmp = 0x40
.. tmp = 0x40
.. rslots = 0x40, rate_table = 0, rates = 0x80 --> slots = 0x40, rates = 0x80
intel8x0: clocking to 48000

Thomas

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/

#15 lore raw
In reply to Takashi Iwai
Quoted 13 lines · Takashi Iwai

At Mon, 01 Dec 2003 19:15:59 +0100,

Quoted 8 lines · Thomas Charbonnel

Hi,

I'm testing rc1, and I have problems with my laptop's internal intel8x0
soundcard :
* Using OSS emulation, after between 19 and 20 seconds of playing the
sound gets garbled for a few seconds and then comes back to normal. This
happens each time I stop and start playback again.
* Using alsa natively there is a performance problem : running jack with the card (-p 1024) I get 3 or 4 xruns per second (I used to run this card with -p 64 with previous alsa versions !).

Quoted 2 lines

could you give the specific version which ran properly?

0.9.8 did run ok.

Thomas

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/