Skip to contentSkip to conversation

2.6.3-rc1: snd_intel8x0 still too fast

DISCUSSION Meelis Roos 5 participants 15 messages Feb 7, 2004 – Feb 12, 2004 Sound

lore
Share & tools
lore
#0 lore raw

I tried 2.6.3-rc1 to see if the problems with intel 8x0 audio are fixed. Nope, the sound is still at least twice as fast as normal. KDE login sound, mplayer sound etc. This is I815 integrated audio on Intel D815EEA2 mainboard, Debian unstable up-to-date. 2.4.latest kernel with OSS is OK. 2.6 with ALSA was OK at about 2.6.0. 2.6 with OSS is also OK.

Also, I can load both i810_audio and snd_intel8x0 simultaneously in 2.6
- probably a resource management problem.

Signature · 1 line
Meelis Roos ([email protected])
#1 lore raw
Quoted 8 lines · Meelis Roos

I tried 2.6.3-rc1 to see if the problems with intel 8x0 audio are fixed. Nope, the sound is still at least twice as fast as normal. KDE login sound, mplayer sound etc. This is I815 integrated audio on Intel D815EEA2 mainboard, Debian unstable up-to-date. 2.4.latest kernel with OSS is OK. 2.6 with ALSA was OK at about 2.6.0. 2.6 with OSS is also OK.

Also, I can load both i810_audio and snd_intel8x0 simultaneously in 2.6
- probably a resource management problem.

Odd, I only have the problem with xmms, mplayer works fine.

Signature · 3 lines
bill davidsen <[email protected]>
  CTO TMR Associates, Inc
  Doing interesting things with small computers since 1979
#2 lore raw
In reply to Meelis Roos

At Sat, 7 Feb 2004 17:10:31 +0200 (EET),

Quoted 6 lines · Meelis Roos

I tried 2.6.3-rc1 to see if the problems with intel 8x0 audio are fixed. Nope, the sound is still at least twice as fast as normal. KDE login sound, mplayer sound etc. This is I815 integrated audio on Intel D815EEA2 mainboard, Debian unstable up-to-date. 2.4.latest kernel with OSS is OK. 2.6 with ALSA was OK at about 2.6.0. 2.6 with OSS is also OK.

which ac97 codec chip? check /proc/asound/card0/codec97#0/* files. also, you must have seen a kernel message like

	intel8x0: clocking to 48000

check which value was detected.

Quoted 2 lines

Also, I can load both i810_audio and snd_intel8x0 simultaneously in 2.6
- probably a resource management problem.

hmm, i810_audio.c doesn't check the return value of request_region()...

--
Takashi Iwai <[email protected]> ALSA Developer - www.alsa-project.org

#3 lore raw

Today mplayer was OK when I tested, didn't retry KDE login. But the kernel is the same, I have not rebooted inbetween.

Quoted 1 line

which ac97 codec chip? check /proc/asound/card0/codec97#0/* files.

i810_audio that I have currently loaded tells it's
ac97_codec: AC97 Audio codec, id: ADS96 (Analog Devices AD1885)

ALSA loaded, from /proc/asound/card0/codec97#0/ac97#0-0

0-0/0: Analog Devices AD1885

Capabilities : -headphone out-
DAC resolution : 16-bit
ADC resolution : 16-bit
3D enhancement : Analog Devices Phat Stereo

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 DSA=0 VRA
Extended status : VRA
PCM front DAC : 48000Hz
PCM ADC : 48000Hz

AD18XX configuration
Unchained : 0x1000,0x0000,0x0000
Chained : 0x0000,0x0000,0x0000

And +regs:

0:00 = 0410
0:02 = bf3f
0:04 = bf3f
0:06 = 801f
0:08 = 0000
0:0a = 801e
0:0c = 801f
0:0e = 801f
0:10 = 9f1f
0:12 = 9f1f
0:14 = 9f1f
0:16 = 9f1f
0:18 = 9f1f
0:1a = 0000
0:1c = 0000
0:1e = 0000
0:20 = 0000
0:22 = 0000
0:24 = 0000
0:26 = 000f
0:28 = 0001
0:2a = 0001
0:2c = bb80
0:2e = 0000
0:30 = 0000
0:32 = bb80
0:34 = 0000
0:36 = 0000
0:38 = 0000
0:3a = 0000
0:3c = 0000
0:3e = 0000
0:40 = 0000
0:42 = 0000
0:44 = 0000
0:46 = 0000
0:48 = 0000
0:4a = 0000
0:4c = 0000
0:4e = 0000
0:50 = 0000
0:52 = 0000
0:54 = 0000
0:56 = 0000
0:58 = 0000
0:5a = 0000
0:5c = 0000
0:5e = 0000
0:60 = 0000
0:62 = 0000
0:64 = 0000
0:66 = 0000
0:68 = 0000
0:6a = 0000
0:6c = 0000
0:6e = 0000
0:70 = 2000
0:72 = 0300
0:74 = 1000
0:76 = 0404
0:78 = bb80
0:7a = bb80
0:7c = 4144
0:7e = 5360

Quoted 2 lines

also, you must have seen a kernel message like

	intel8x0: clocking to 48000

Did try twice:

intel8x0_measure_ac97_clock: measured 50040 usecs
intel8x0: clocking to 41146

intel8x0_measure_ac97_clock: measured 49395 usecs
intel8x0: clocking to 41145

Signature · 1 line
Meelis Roos ([email protected])
#4 lore raw

At Mon, 9 Feb 2004 20:35:12 +0200 (EET),

Quoted 3 lines · Meelis Roos

Today mplayer was OK when I tested, didn't retry KDE login. But the kernel is the same, I have not rebooted inbetween.

weird... cpufreq is running?

Quoted 10 lines
Quoted 2 lines

also, you must have seen a kernel message like

	intel8x0: clocking to 48000

Did try twice:

intel8x0_measure_ac97_clock: measured 50040 usecs
intel8x0: clocking to 41146

intel8x0_measure_ac97_clock: measured 49395 usecs
intel8x0: clocking to 41145

and now you got the correct output?
if so, you can pass the value via ac97_clock option.

i guess the high pitch playback occured because of the wrong detection of ac97 clock by some reason.

--
Takashi Iwai <[email protected]> ALSA Developer - www.alsa-project.org

#5 lore raw
Quoted 4 lines
Quoted 2 lines

Today mplayer was OK when I tested, didn't retry KDE login. But the kernel is the same, I have not rebooted inbetween.

weird... cpufreq is running?

No, it's a desktop Celeron 900.

Quoted 10 lines
Quoted 7 lines

Did try twice:

intel8x0_measure_ac97_clock: measured 50040 usecs
intel8x0: clocking to 41146

intel8x0_measure_ac97_clock: measured 49395 usecs
intel8x0: clocking to 41145

and now you got the correct output?
if so, you can pass the value via ac97_clock option.

I did retest things more toroughly today after I booted up 2.6.3-rc2. I focused on testing KDE login since this is known to break. Startup scripts (discover) loaded also i810_audio, I unloaded it.

Plain bootup gave
PCI: Setting latency timer of device 0000:00:1f.5 to 64 intel8x0_measure_ac97_clock: measured 49671 usecs
intel8x0: clocking to 41136

and it did not work. Unloading and reloading snd-intel8x0 gave
PCI: Setting latency timer of device 0000:00:1f.5 to 64 intel8x0_measure_ac97_clock: measured 49281 usecs
intel8x0: clocking to 41139

and it still did not work (way too fast, probably even more than twice). Now I tried
modprobe snd-intel8x0 ac97_clock=41140
It loads silently but still does not work.

Now I started to suspect that loading i810_audio might screw things up. Removed the module and rebooted, no i810_audio loaded, still the same.

Reproduced the problem with mplayer too. It depends on the input file bitrate!

mplayer /usr/share/sounds/KDE_Startup.wav
gives the same very fast sound since it's a 22 KHz mono sample.

mplayer -srate 48000 /usr/share/sounds/KDE_Startup.wav works fine. Same applies to all files.

So maybe it's a userspace resampling issue? I see that the hardware talks 44 KHz.

Signature · 1 line
Meelis Roos ([email protected])
#6 lore raw

At Tue, 10 Feb 2004 13:22:25 +0200 (EET),

Quoted 16 lines · Meelis Roos
Quoted 5 lines
Quoted 3 lines

Today mplayer was OK when I tested, didn't retry KDE login. But the kernel is the same, I have not rebooted inbetween.

weird... cpufreq is running?

No, it's a desktop Celeron 900.

Quoted 8 lines
Quoted 7 lines

Did try twice:

intel8x0_measure_ac97_clock: measured 50040 usecs
intel8x0: clocking to 41146

intel8x0_measure_ac97_clock: measured 49395 usecs
intel8x0: clocking to 41145

Quoted 6 lines
Quoted 2 lines

and now you got the correct output?
if so, you can pass the value via ac97_clock option.

I did retest things more toroughly today after I booted up 2.6.3-rc2. I focused on testing KDE login since this is known to break. Startup scripts (discover) loaded also i810_audio, I unloaded it.

oh never load two these modules at the same time!
it can crash the system.
it must be a bug of i810_audio that can coexist with ALSA driver.

Quoted 18 lines

Plain bootup gave
PCI: Setting latency timer of device 0000:00:1f.5 to 64 intel8x0_measure_ac97_clock: measured 49671 usecs
intel8x0: clocking to 41136

and it did not work. Unloading and reloading snd-intel8x0 gave
PCI: Setting latency timer of device 0000:00:1f.5 to 64 intel8x0_measure_ac97_clock: measured 49281 usecs
intel8x0: clocking to 41139

and it still did not work (way too fast, probably even more than twice). Now I tried
modprobe snd-intel8x0 ac97_clock=41140
It loads silently but still does not work.

Now I started to suspect that loading i810_audio might screw things up. Removed the module and rebooted, no i810_audio loaded, still the same.

Quoted 8 lines

Reproduced the problem with mplayer too. It depends on the input file bitrate!

mplayer /usr/share/sounds/KDE_Startup.wav
gives the same very fast sound since it's a 22 KHz mono sample.

mplayer -srate 48000 /usr/share/sounds/KDE_Startup.wav works fine. Same applies to all files.

then VRA of ac97 seems not working correctly.
check /proc/asound/card0/codec97#0/* files for each case whether the DAC rate is set correctly. (it must be tuned with the detected ac97 clock, i.e. rate * clock / 48000).

--
Takashi Iwai <[email protected]> ALSA Developer - www.alsa-project.org

#7 lore raw
Quoted 10 lines
Quoted 5 lines

mplayer /usr/share/sounds/KDE_Startup.wav
gives the same very fast sound since it's a 22 KHz mono sample.

mplayer -srate 48000 /usr/share/sounds/KDE_Startup.wav works fine. Same applies to all files.

then VRA of ac97 seems not working correctly.
check /proc/asound/card0/codec97#0/* files for each case whether the DAC rate is set correctly. (it must be tuned with the detected ac97 clock, i.e. rate * clock / 48000).

PCM front DAC : 41133Hz
PCM ADC : 48000Hz

This is with "intel8x0: clocking to 41133" and playing with mplayer -srate 48000 ...

PCM front DAC : 18895Hz
PCM ADC : 48000Hz

This is with mplayer with no options, it tells itself

Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 22050 Hz, 1 ch, 16 bit (0x10), ratio: 44100->44100 (352,8 kbit) Selected audio codec: [pcm] afm:pcm (Uncompressed PCM)
==========================================================================
Checking audio filter chain for 22050Hz/1ch/16bit -> 22050Hz/2ch/16bit...
AF_pre: af format: 2 bps, 1 ch, 22050 hz, little endian signed int
AF_pre: 22050Hz 1ch Signed 16-bit (Little-Endian)
SDL: Samplerate: 22050Hz Channels: Stereo Format Signed 16-bit (Little-Endian)
AO: [sdl] 22050Hz 2ch Signed 16-bit (Little-Endian) (2 bps) Building audio filter chain for 22050Hz/1ch/16bit -> 22050Hz/2ch/16bit...

Signature · 1 line
Meelis Roos ([email protected])
#8 lore raw

At Tue, 10 Feb 2004 14:03:40 +0200 (EET),

Quoted 12 lines · Meelis Roos
Quoted 11 lines
Quoted 6 lines

mplayer /usr/share/sounds/KDE_Startup.wav
gives the same very fast sound since it's a 22 KHz mono sample.

mplayer -srate 48000 /usr/share/sounds/KDE_Startup.wav works fine. Same applies to all files.

then VRA of ac97 seems not working correctly.
check /proc/asound/card0/codec97#0/* files for each case whether the DAC rate is set correctly. (it must be tuned with the detected ac97 clock, i.e. rate * clock / 48000).

Quoted 8 lines

PCM front DAC : 41133Hz
PCM ADC : 48000Hz

This is with "intel8x0: clocking to 41133" and playing with mplayer -srate 48000 ...

PCM front DAC : 18895Hz
PCM ADC : 48000Hz

does the attached patch improve?

if it still doesn't help, try the following:

- stop ALSA once
- remove /etc/asound.state
- restart ALSA and tune up mixer again

Takashi

sound/pci/ac97/ac97_patch.c +3 -0
@@ -682,6 +682,9 @@
 	jack = snd_ac97_read(ac97, AC97_AD_JACK_SPDIF);
 	snd_ac97_write_cache(ac97, AC97_AD_JACK_SPDIF, jack | 0x0300);
 
+	/* set default */
+	snd_ac97_write_cache(ac97, AC97_AD_MISC, 0);
+
 	ac97->build_ops = &patch_ad1885_build_ops;
 	return 0;
 }
#9 lore raw
Quoted 1 line

does the attached patch improve?

Unfortunately not.

Quoted 5 lines

if it still doesn't help, try the following:

- stop ALSA once
- remove /etc/asound.state
- restart ALSA and tune up mixer again

Did that (with the new patched driver), still the same.

Signature · 1 line
Meelis Roos ([email protected])      http://www.cs.ut.ee/~mroos/
#10 lore raw

At Wed, 11 Feb 2004 18:40:36 +0200 (EET),

Quoted 5 lines · Meelis Roos
Quoted 2 lines

does the attached patch improve?

Unfortunately not.

Quoted 7 lines
Quoted 5 lines

if it still doesn't help, try the following:

- stop ALSA once
- remove /etc/asound.state
- restart ALSA and tune up mixer again

Did that (with the new patched driver), still the same.

hmm, please show /proc/asound/card0/codec97#0/ac97#0-0 and ac97#0-0+regs files again?

Takashi

#11 lore raw
Quoted 2 lines

hmm, please show /proc/asound/card0/codec97#0/ac97#0-0 and ac97#0-0+regs files again?

0-0/0: Analog Devices AD1885

Capabilities : -headphone out-
DAC resolution : 16-bit
ADC resolution : 16-bit
3D enhancement : Analog Devices Phat Stereo

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 DSA=0 VRA
Extended status : VRA
PCM front DAC : 18901Hz
PCM ADC : 48000Hz

AD18XX configuration
Unchained : 0x1000,0x0000,0x0000
Chained : 0x0000,0x0000,0x0000

(this is after playing it 22 KHz)

0:00 = 0410
0:02 = bf3f
0:04 = 1010
0:06 = 801f
0:08 = 0000
0:0a = 801e
0:0c = 801f
0:0e = 801f
0:10 = 9f1f
0:12 = 9f1f
0:14 = 9f1f
0:16 = 9f1f
0:18 = 0909
0:1a = 0000
0:1c = 0000
0:1e = 0000
0:20 = 0000
0:22 = 0000
0:24 = 0000
0:26 = 000f
0:28 = 0001
0:2a = 0001
0:2c = 49d5
0:2e = 0000
0:30 = 0000
0:32 = bb80
0:34 = 0000
0:36 = 0000
0:38 = 0000
0:3a = 0000
0:3c = 0000
0:3e = 0000
0:40 = 0000
0:42 = 0000
0:44 = 0000
0:46 = 0000
0:48 = 0000
0:4a = 0000
0:4c = 0000
0:4e = 0000
0:50 = 0000
0:52 = 0000
0:54 = 0000
0:56 = 0000
0:58 = 0000
0:5a = 0000
0:5c = 0000
0:5e = 0000
0:60 = 0000
0:62 = 0000
0:64 = 0000
0:66 = 0000
0:68 = 0000
0:6a = 0000
0:6c = 0000
0:6e = 0000
0:70 = 2000
0:72 = 0300
0:74 = 1000
0:76 = 0000
0:78 = bb80
0:7a = 49d5
0:7c = 4144
0:7e = 5360

And after playing a 48 KHz sound, it changes to
PCM front DAC : 41147Hz
PCM ADC : 48000Hz

and regs changes to
0:2c = a0bb
0:7a = 49d5

Signature · 1 line
Meelis Roos ([email protected])
#12 lore raw

At Wed, 11 Feb 2004 18:49:36 +0200 (EET),

Quoted 3 lines · Meelis Roos
Quoted 3 lines

hmm, please show /proc/asound/card0/codec97#0/ac97#0-0 and ac97#0-0+regs files again?

oops, the patch was wrong. could you try this one (and remove /etc/asound.state before starting ALSA?)

also, if it still doesn't work, try to change the ADC VRA. for example, run "arecord -fS16_LE -r44100 foo.wav" once before playing 44100 samples.

also, to make sure that it's a hardware problem, please avoid mono samples but use 16bit stereo samples only.

Takashi

sound/pci/ac97/ac97_patch.c +4 -1
@@ -652,7 +652,7 @@
 
 static const snd_kcontrol_new_t snd_ac97_controls_ad1885[] = {
 	AC97_SINGLE("Digital Mono Direct", AC97_AD_MISC, 11, 1, 0),
-	AC97_SINGLE("Digital Audio Mode", AC97_AD_MISC, 12, 1, 0),
+	/* AC97_SINGLE("Digital Audio Mode", AC97_AD_MISC, 12, 1, 0), */ /* seems problematic */
 	AC97_SINGLE("Low Power Mixer", AC97_AD_MISC, 14, 1, 0),
 	AC97_SINGLE("Zero Fill DAC", AC97_AD_MISC, 15, 1, 0),
 };
@@ -682,6 +682,9 @@
 	jack = snd_ac97_read(ac97, AC97_AD_JACK_SPDIF);
 	snd_ac97_write_cache(ac97, AC97_AD_JACK_SPDIF, jack | 0x0300);
 
+	/* set default */
+	snd_ac97_write_cache(ac97, AC97_AD_MISC, 0x0404);
+
 	ac97->build_ops = &patch_ad1885_build_ops;
 	return 0;
 }
#13 lore raw
Quoted 2 lines

oops, the patch was wrong. could you try this one (and remove /etc/asound.state before starting ALSA?)

This one works, thanks!

Signature · 1 line
Meelis Roos ([email protected])
#14 lore raw
In reply to Meelis Roos
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

"Meelis" == Meelis Roos <[email protected]> writes:

Today mplayer was OK when I tested, didn't retry KDE login. But

the > kernel is the same, I have not rebooted inbetween.

weird... cpufreq is running?

Meelis> mplayer /usr/share/sounds/KDE_Startup.wav gives the same very Meelis> fast sound since it's a 22 KHz mono sample.

It's a mono/stereo thing. I've seen the same problem here: the quick workaround is to convert mono to stereo before playing.

--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au The technical we do immediately, the political takes *forever*