Bug 7467 - snd-atiixp driver does not load on DFI rs482 mainboard
Summary: snd-atiixp driver does not load on DFI rs482 mainboard
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: i386 Linux
: P2 high
Assignee: Dan Carpenter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-07 11:57 UTC by Marcin Juszkiewicz
Modified: 2007-03-08 01:24 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.19-rc4
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
dmesg -s40000 output (14.78 KB, text/plain)
2006-11-07 11:58 UTC, Marcin Juszkiewicz
Details
lspci -vv output (11.97 KB, text/plain)
2006-11-07 11:59 UTC, Marcin Juszkiewicz
Details
kernel config from my kernel (35.02 KB, text/plain)
2006-11-07 11:59 UTC, Marcin Juszkiewicz
Details
One read the register one time. Restore old behavior. (366 bytes, patch)
2006-11-09 07:02 UTC, Dan Carpenter
Details | Diff
dmesg output from boot (13.57 KB, text/plain)
2006-11-09 10:54 UTC, Marcin Juszkiewicz
Details
dmesg with CONFIG_SND_DEBUG* (34.24 KB, text/plain)
2006-11-12 12:00 UTC, Marcin Juszkiewicz
Details
Short circuit the proper probing and test all 3 codecs (376 bytes, patch)
2006-11-12 12:49 UTC, Dan Carpenter
Details | Diff
dmesg with IRQ_HANDLED patch (16.71 KB, text/plain)
2006-11-12 13:46 UTC, Marcin Juszkiewicz
Details
Add a parameter ac97_codec (1.35 KB, patch)
2006-11-12 14:19 UTC, Dan Carpenter
Details | Diff
Add a parameter ac97_codec [take 2] (1.36 KB, patch)
2006-11-12 16:06 UTC, Dan Carpenter
Details | Diff
Add a parameter ac97_codec [take 3] (2.01 KB, patch)
2006-11-14 01:03 UTC, Dan Carpenter
Details | Diff
Add a parameter ac97_codec [take 4] (3.30 KB, patch)
2006-11-14 22:22 UTC, Dan Carpenter
Details | Diff
toggm: dmesg (178 bytes, text/plain)
2006-11-23 12:51 UTC, toggm
Details
toggm: lscpi (339 bytes, text/plain)
2006-11-23 12:54 UTC, toggm
Details

Description Marcin Juszkiewicz 2006-11-07 11:57:05 UTC
Most recent kernel where this bug did not occur: unknown 
(booted 2.6.17/Debian-amd64, 2.6.18/Debian-amd64, 2.6.19-rc4/own-amd64, 
2.6.19-rc4/own-i386)

Distribution: Debian 'sid' amd64 (now), i386 (first)

Hardware Environment: DFI RS482 mainboard, Athlon64 3200+

Software Environment: Debian 'sid' + selfmade kernel

Problem Description:
Loading 'snd-atiixp' kernel module gives:
-----------------------------------------------------------
atiixp: codec read timeout (reg 0)
atiixp: codec read timeout (reg 3c)
atiixp: codec read timeout (reg 1c)
AC'97 2 does not respond - RESET
AC'97 2 access is not valid [0xffffffff], removing mixer.
atiixp: no codec available
ACPI: PCI interrupt for device 0000:00:14.5 disabled
-----------------------------------------------------------
'codec read timeout' lines are repeating many times. Due to 
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=2081 it is ACPI problem. 

I tried pci=noacpi, acpi=off, pci=routeirq, irqpoll (last one was needed to get 
NIC working with i386 kernel) - each time same results.


Steps to reproduce:
Boot kernel, modprobe snd-atiixp module.
Comment 1 Marcin Juszkiewicz 2006-11-07 11:58:18 UTC
Created attachment 9426 [details]
dmesg -s40000 output
Comment 2 Marcin Juszkiewicz 2006-11-07 11:59:03 UTC
Created attachment 9427 [details]
lspci -vv output
Comment 3 Marcin Juszkiewicz 2006-11-07 11:59:46 UTC
Created attachment 9428 [details]
kernel config from my kernel
Comment 4 Andrew Morton 2006-11-07 12:43:22 UTC
Why is this thought to be an acpi problem?

From the bugtrack.alsa-project.org report I see no confirmation
that acpi is involved?

Comment 5 Marcin Juszkiewicz 2006-11-07 13:05:27 UTC
Most of informations which I found related to this bug cames with suggestions 
that this is related to ACPI.
Comment 6 Dan Carpenter 2006-11-09 06:59:37 UTC
There was an accidental code change in:
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff_plain;h=ee42381e71c56328db9e9d64d19a4de7a2f09a93;hp=dc4cafbadad1ae2322e598f2cb72720ef4095fee

In snd_ac97_try_volume_mix(struct snd_ac97 * ac97, int reg) it now reads
register twice in a row which seems pointless.

I'll attach a patch.
Comment 7 Dan Carpenter 2006-11-09 07:02:43 UTC
Created attachment 9442 [details]
One read the register one time.  Restore old behavior.
Comment 8 Takashi Iwai 2006-11-09 08:03:43 UTC
No, reading twice is intentional.  Some hardwares require a dummy fetch first
for reflecting the real value.

I'm wondering whether your patch fixes your problem.  Does it?
Comment 9 Marcin Juszkiewicz 2006-11-09 08:19:20 UTC
ALSA sound/pci/atiixp.c:458: atiixp: codec read timeout (reg 3c)
ALSA sound/pci/atiixp.c:458: atiixp: codec read timeout (reg 1c)
ALSA sound/pci/atiixp.c:458: atiixp: codec read timeout (reg 0)
ALSA sound/pci/atiixp.c:458: atiixp: codec read timeout (reg 3c)
ALSA sound/pci/atiixp.c:458: atiixp: codec read timeout (reg 1c)
ALSA sound/pci/ac97/ac97_codec.c:2030: AC'97 2 does not respond - RESET
ALSA sound/pci/ac97/ac97_codec.c:2039: AC'97 2 access is not valid 
[0xffffffff], removing mixer.
ALSA sound/pci/atiixp.c:1404: atiixp: codec 2 not available for audio
ALSA sound/pci/atiixp.c:1411: atiixp: no codec available
ACPI: PCI interrupt for device 0000:00:14.5 disabled

normal boot with 2.6.19-rc5 + modified snd-ac97-codec ;(
Comment 10 Dan Carpenter 2006-11-09 08:33:17 UTC
I don't actually have the hardware, I was just grovelling through the code to
see what changed recently.

But actually it seems like this sound card didn't use to work with old kernels.
> Most recent kernel where this bug did not occur: unknown

Marcin, we're missing most of the dmesg output before the module was loaded. 
Could you post that?  You've got that proprietary ATI module as well but that is
getting loaded after the errors occur so probably that's not the problem.  

Comment 11 Marcin Juszkiewicz 2006-11-09 10:54:02 UTC
Created attachment 9446 [details]
dmesg output from boot

dmesg output from boot begin to 'single' login (before loading snd-atiixp
module)
Comment 12 Marcin Juszkiewicz 2006-11-09 10:56:37 UTC
btw - booted 2.6.12/i386 - card was not working too
Comment 13 Jaroslav Kysela 2006-11-10 01:19:51 UTC
See https://bugzilla.novell.com/show_bug.cgi?id=200476 , could you try APIC
setup as suggested marcel@hilzinger.hu :

-----
I had similar problems with snd_atiixp on several Suse machines (10.0/10.1).
Yesterday I could resolve on: I had to change APIC interrupt routing in the
BIOS from Disabled to Enabled. So perhaps it's not a ACPI, but an APIC
problem.

Perhaps booting with the 'noapic' or 'nolapic' options helps.
-----
Comment 14 Marcin Juszkiewicz 2006-11-10 14:12:36 UTC
I enabled APIC and ACPI in first day. Today I tried with APIC disabled in BIOS, 
but still no change.

Booted 2.6.19-rc5 with noacpi, noapic, nolapic, pci=biosirq - nothing changed.
Comment 15 Dan Carpenter 2006-11-10 19:57:05 UTC
You had those APIC messages going on at the end.  I've seen those messages
before and normally they don't impact performance at all but obviously it's
worth while to check.

You seem pretty serious about fixing this, try compiling with:
CONFIG_SND_DEBUG=y
CONFIG_SND_DEBUG_DETECT=y

The messages that you are scrolling by are from snd_ac97_mixer()
atiixp: codec read timeout (reg 0)
#define AC97_RESET		0x00	/* Reset */
atiixp: codec read timeout (reg 3c)
#define AC97_EXTENDED_MID	0x3c	/* Extended Modem ID */
atiixp: codec read timeout (reg 1c)
#define AC97_REC_GAIN		0x1c	/* Record Gain */

The ACPI line:
> ACPI: PCI interrupt for device 0000:00:14.5 disabled
That actually comes from pci_disable_device() in snd_atiixp_create().  The call
tree is:  pci_disable_device() -> pcibios_disable_device() ->
pcibios_disable_irq() -> acpi_pci_irq_disable().

Anyway, compile with debug enabled and post your dmesg again.
Comment 16 Marcin Juszkiewicz 2006-11-12 12:00:28 UTC
Created attachment 9475 [details]
dmesg with CONFIG_SND_DEBUG*

> You seem pretty serious about fixing this

I will get this sound working or will have to buy PCI soundcard (which I want
to avoid because I have only one free PCI slot).

> CONFIG_SND_DEBUG=y
> CONFIG_SND_DEBUG_DETECT=y

Both flags were already set - dmesg attached is from 'modprobe
snd-atiixp-modem;insmod snd-atiixp.ko-' (module renamed to not full dmesg with
errors on boot).
Comment 17 Dan Carpenter 2006-11-12 12:47:02 UTC
So there are three codecs that it probes for.  Codecs 0 and 1 come back as not
ready in snd_atiixp_interrupt() and we probe for 2 and it generates all the
error messages.

I did a google search and it turns out that there are a bunch of windows users
having the same problem you are.  I wonder if the chip is maybe returning wrong
information in snd_atiixp_interrupt().  Just for grins, what happens if you use
the attached patch?

Comment 18 Dan Carpenter 2006-11-12 12:49:38 UTC
Created attachment 9476 [details]
Short circuit the proper probing and test all 3 codecs
Comment 19 Marcin Juszkiewicz 2006-11-12 13:46:24 UTC
Created attachment 9477 [details]
dmesg with IRQ_HANDLED patch

After patch applied I got this in /proc/asound/cards:
 0 [IXP 	   ]: ATIIXP - ATI IXP
		      ATI IXP rev 80 with ALC850 at 0xfe029000, irq 17

And sound works :)

But I got many APIC errors (they are common on this machine) and driver was
eating interrupts so:
- my PS/2->USB adapter which I use for mouse was reattached many times
- MPlayer with 320x240 DivX few times said that this machine is too slow.

/proc/interrupts:
	   CPU0
  0:   10907864    <NULL>-edge	    timer
  1:	  25931   IO-APIC-edge	    i8042
  8:	      0   IO-APIC-edge	    rtc
  9:	      0   IO-APIC-fasteoi   acpi
 12:	      3   IO-APIC-edge	    i8042
 14:	 224820   IO-APIC-edge	    libata
 15:	 236605   IO-APIC-edge	    libata
 17:   21174813   IO-APIC-fasteoi   bttv0, fglrx, ATI IXP
 19:	2217380   IO-APIC-fasteoi   ehci_hcd:usb1, ohci_hcd:usb2, ohci_hcd:usb3

 21:	 211406   IO-APIC-fasteoi   eth0
NMI:	   8910
LOC:   10948064
ERR:	    663
Comment 20 Marcin Juszkiewicz 2006-11-12 14:07:23 UTC
Booted with 'irqpoll noapic nolapic' and loaded patched driver.

With 'cat /dev/urandom > /dev/null' working MPlayer sound output was skipping 
like I would try to play MP3 on 386DX.
Comment 21 Dan Carpenter 2006-11-12 14:19:00 UTC
Created attachment 9478 [details]
Add a parameter ac97_codec

That last patch was just for testing.

I've created a new patch that adds a parameter to let you hard code what ac97
codec to use.  Add "ac97_codec=0" the snd-atiixp line in /etc/modprobe.conf

I've compile tested it only, but I think it should get rid of the crud in
dmesg.	Don't boot with 'irqpoll noapic nolapic'.  It shouldn't be needed.
Comment 22 Marcin Juszkiewicz 2006-11-12 14:38:27 UTC
irqpoll is needed for my network card (it I do not use then sooner or later 
card die - for example after remove/insert bttv).

Booted with 'irqpoll' and then 'modprobe snd-ac97-codec;insmod snd-atiixp.ko 
ac97_codec=0':

Nov 12 23:36:31 localhost kernel: ACPI: PCI Interrupt 0000:00:14.5[B] -> GSI 17 
(level, low) -> IRQ 17
Nov 12 23:36:31 localhost kernel: ALSA sound/pci/atiixp.c:575: atiixp: no codec 
detected!
Nov 12 23:36:31 localhost kernel: ACPI: PCI interrupt for device 0000:00:14.5 
disabled
Comment 23 Dan Carpenter 2006-11-12 16:06:57 UTC
Created attachment 9479 [details]
Add a parameter ac97_codec [take 2]

Found a bug in the other patch.  Try the next one.  Sooner or later it's got to
start working...  ;)
Comment 24 Marcin Juszkiewicz 2006-11-12 23:37:13 UTC
Dan, you are great ;)

With #9479 patch sound is working:

ACPI: PCI Interrupt 0000:00:14.5[B] -> GSI 17 (level, low) -> IRQ 17

MPlayer is able to play video with sync with 'cat /dev/urandom>/dev/null' in 
background.

Now I can listen to radio streams during digging into mail...
Comment 25 Marcin Juszkiewicz 2006-11-12 23:45:51 UTC
http://www.hrw.one.pl/2006/11/13/sound-is-working-on-dfi-rs482/ for those who 
has same problem.
Comment 26 Takashi Iwai 2006-11-13 02:40:20 UTC
Great to hear it's working now.
But I would check the option rather in snd_atiixp_codec_detect() instead of
checking in irq handler.  It's much safer.

Dan, care to rewrite the patch?  If it's confirmed to work, I'll add it to ALSA
tree.  So, please don't forget to add a description of the new option in
Documentation/sound/alsa/ALSA-Configuration.txt and sign-off of the patch, too.
 Thanks.
Comment 27 Dan Carpenter 2006-11-14 01:03:02 UTC
Created attachment 9501 [details]
Add a parameter ac97_codec [take 3]

No problem.  I've attached the modified patch.	Marcin, you've been a trooper,
could you give this one a test?
Comment 28 Jaroslav Kysela 2006-11-14 01:13:02 UTC
The patch looks good for manual tests, but I would suggest to add also automatic
detection for problematic machines using the subdevice PCI ID. A short notice
for syslog informing that a workaround has been activated would be nice, too.
It's just idea to improve situation.
Comment 29 Marcin Juszkiewicz 2006-11-14 10:40:47 UTC
#9501 patch also works.

lspci -n output for soundcard:

00:14.5 0401: 1002:4370 (rev 80)
        Subsystem: 15bd:3100
        Flags: bus master, 66MHz, slow devsel, latency 64, IRQ 17
        Memory at fe029000 (32-bit, non-prefetchable) [size=256]
        Capabilities: [40] Message Signalled Interrupts: Mask- 64bit- Queue=0/0 
Enable-
Comment 30 Dan Carpenter 2006-11-14 22:22:20 UTC
Created attachment 9515 [details]
Add a parameter ac97_codec [take 4]

15bd:3100 eh?

No problem.  This patch should detect that automatically so you don't have to
specify the codec anymore.  If someone else needs to they still can or if you
want to force probing then use "ac97_codec=-2".
Comment 31 Marcin Juszkiewicz 2006-11-14 22:36:42 UTC
ACPI: PCI Interrupt 0000:00:14.5[B] -> GSI 17 (level, low) -> IRQ 17
Atiixp quirk for DFI RS482.  Forcing codec 0

Thx a lot guys.
Comment 32 Takashi Iwai 2006-11-20 07:36:42 UTC
Thanks, I included the patch (take4) to ALSA HG/git tree.
This shall be merged to the next mm tree.
Comment 33 toggm 2006-11-22 13:34:45 UTC
Installed nightly build from ALSA HG Tree which should fix this problem. Module
now load successfully, alsamixer runs fine. But I've got still no sound on my
SPDIF. Unmuted all channels. Any suggestions?
Comment 34 Dan Carpenter 2006-11-22 15:28:05 UTC
toggm, could you compile with
CONFIG_SND_DEBUG=y
CONFIG_SND_DEBUG_DETECT=y

and post your dmesg from the point where it loads the module?
Also post the `lspci -n` output for the sound card.
Comment 35 toggm 2006-11-23 12:51:48 UTC
Created attachment 9610 [details]
toggm: dmesg

Attached output of dmesg and lspci. Couldn't compbile with CONFIG_SND_DEBUG=y
because I'm using the newest ALSA HG Tree modules. But compiled with
--debug-level=full.
Comment 36 toggm 2006-11-23 12:54:05 UTC
Created attachment 9611 [details]
toggm: lscpi

toggm: lspci
Comment 37 Dan Carpenter 2006-11-24 16:06:29 UTC
What happens if you "modprobe snd-atiixp spdif_aclink=0"?

Comment 38 toggm 2006-11-25 10:15:32 UTC
Still no sound on SPDIF. It only deactivates controls in alsamixer. 
Comment 39 toggm 2006-11-27 10:00:35 UTC
Got sound working. After a few hours playing with alsamixer settings I found the
control adjusting AC97-SPSA. Setting this to zero activated sound on SPDIF.
Comment 40 Andrew Morton 2007-01-31 00:13:41 UTC
From mny reading of this bug record, everyone's bugs got fixed.  Correct?
Comment 41 Marcin Juszkiewicz 2007-01-31 00:34:10 UTC
Works great for me. Listening to Eric Clapton via Last.fm right now.
Comment 42 Andrew Morton 2007-01-31 00:43:49 UTC
ok, thanks - I'll close it.  Say Hi to Eric for me ;)

Note You need to log in before you can comment on or make changes to this bug.