isapnp problems with opl3sa2
Hi,
first of all, I don't know C and I am no expert, so please apologize if some of
my questions/comments are stupid.
I have a yamaha based sound card which works with the opl3sa2 driver. However,
the isapnp activation of this card fails (this has been broken ever since the 2.4 series).
So I did some investigations and eventually found out that the reason is the following
check from isapnp_check_dma(..) in isapnp.c:
-------------
/* Some machines allow DMA 0, but others don't. In fact on some
boxes DMA 0 is the memory refresh. Play safe */
if (dma < 1 || dma = 4 || dma > 7)
return 1;--------------
However, the opl3sa2 card insists on dma=0,dma2=1. In particular, if I change
"(dma < 1 || dma = 4 || dma > 7)" to "(dma < 0 || dma = 4 || dma > 7)" everything
works fine.
Now I am wondering what should be done:
1) Make the above change to isapnp.c. According to the above comment this will break
some other boxes, so probably this should be configurable via /proc/isapnp.
2) Change opl3sa2.c and force isapnp to use dma=0 (a patch can be found at the end of this
message).
What do the experts think is the right way to fix this problem?
A few further remarks concerning my patch:
*) The patch also adds a line "opl3sa2_state[card].activated = 1" which is an
obvious omission in the original driver.
*) I have to force the driver to use both dma=0 and dma2=1. From what I understand dma=0 should be sufficient, but this will not work. Looks like a bug in isapnp.c to me. However, this should do no harm since according to /proc/isapnp, the card only offers these values anyway.
Thanks for your comments,
Gerald
-----------------------------------------------
sound/opl3sa2.c Sun Jun 2 15:19:44 2002 renamed from sound/opl3sa2.c.orig Thu May 2 23:36:45 2002 +2 -0
@@ -57,6 +57,7 @@ * (Jan 7, 2001) * Zwane Mwaikambo Added PM support. (Dec 4 2001) * Zwane Mwaikambo Code, data structure cleanups. (Feb 15 2002) + * Gerald Teschl Fixed ISA PnP activate. (Jun 02 2002) * */
@@ -868,8 +869,15 @@ opl3sa2_state[card].activated = 1; } else { + /* isapnp.c disallows dma=0 but the opl3sa2 card only
accepts this value */
+ if (!dev->ro) {
+ isapnp_resource_change(&dev->dma_resource[0], 0, 1);
+ isapnp_resource_change(&dev->dma_resource[1], 1, 1);
+ }
+ opl3sa2_state[card].activated = 1;
+
if(dev->activate(dev) < 0) {
- printk(KERN_WARNING PFX "ISA PnP activate
failed\n");
+ printk(KERN_WARNING PFX "ISA PnP activate
failed.\n");
opl3sa2_state[card].activated = 0;
return -ENODEV;
}------------------------------------------------
Quoted 4 lines · Gerald Teschl
the isapnp activation of this card fails (this has been broken ever since the 2.4 series).So I did some investigations and eventually found out that the reason is the following check from
isapnp_check_dma(..)inisapnp.c:
You should be able to load it without any parameters with ISAPNP, i have a box at home with that card which only requires a modprobe opl3sa2. Could you show me how you're loading it as well as dmesg and /proc/isapnp output after loading.
Quoted 3 lines
A few further remarks concerning my patch:
*) The patch also adds a line "opl3sa2_state[card].activated = 1" which is an obvious omission in the original driver.
Thanks, put it right at the end before the return and i'll be happy.
Quoted 4 lines
*) I have to force the driver to use both dma=0 and dma2=1. From what I understand dma=0 should be sufficient, but this will not work. Looks like a bug in
isapnp.cto me. However, this should do no harm since according to/proc/isapnp, the card only offers these values anyway.
isapnp.c is fine
sound/opl3sa2.c Sun Jun 2 15:19:44 2002
Quoted 3 lines
-----------------------------------------------
sound/opl3sa2.c Sun Jun 2 15:19:44 2002 renamed from sound/opl3sa2.c.orig Thu May 2 23:36:45 2002 +0
-0
When you rediff, can you diff so that the patch can be applied with a strip of '1' ie diff -u linux/drivers...
Cheers,
Zwane Mwaikambo
Signature · 1 line
http://function.linuxpower.ca
Quoted 5 lines · Zwane Mwaikambo
You should be able to load it without any parameters with ISAPNP, i have a box at home with that card which only requires a modprobe opl3sa2. Could you show me how you're loading it as well as dmesg and
/proc/isapnpoutput after loading.
I use redhat-7.3 (kernel-2.4.18-4) and this is an ASUS L7300 laptop. In /etc/modules.conf I have
alias sound-slot-0 opl3sa2
options sound dmabuf=1
alias synth0 opl3
options opl3 io=0x388
options opl3sa2 ymode=2 isapnp=1
and /proc/isapnp looks like
-------------------------------------------------
Card 1 'YMH0800:YAMAHA OPL3-SAx Audio System' PnP version 1.0
Logical device 0 'YMH0021:Unknown'
Device is not active
Active DMA 0,0
Resources 0
Priority preferred
Port 0x220-0x220, align 0xf, size 0x10, 16-bit address decoding Port 0x530-0x530, align 0x7, size 0x8, 16-bit address decoding Port 0x388-0x388, align 0x7, size 0x8, 16-bit address decoding Port 0x330-0x330, align 0x1, size 0x2, 16-bit address decoding Port 0x370-0x370, align 0x1, size 0x2, 16-bit address decoding IRQ 5 High-Edge
DMA 0 8-bit byte-count type-A
DMA 1 8-bit byte-count type-A
Alternate resources 0:1
...........
---------------------------------------------
before inserting the module. If I insert the (original) module using "modporbe opl3sa2" dmesg read:
ad1848/cs4248 codec driver Copyright (C) by Hannu Savolainen 1993-1996
ad1848: No ISAPnP cards found, trying standard ones...
opl3sa2: ISA PnP activate failed
opl3sa2: No PnP cards found
opl3sa2: 0 PnP card(s) found.
and /proc/isapnp looks as before. My investigations showed that the error occures inisapnp_valid_dma() invoked from isapnp_config_activate() in isapnp.c.
If I insert my patched module I get
opl3sa2: Activated ISA PnP card 0 (active=1)
opl3sa2: chipset version = 0x4
opl3sa2: Found OPL3-SA3 (YMF715E or YMF719E)
ad1848: Interrupt test failed (IRQ5)
opl3sa2: 1 PnP card(s) found.
and /proc/isapnp looks like
-------------------------------------------
Card 1 'YMH0800:YAMAHA OPL3-SAx Audio System' PnP version 1.0
Logical device 0 'YMH0021:Unknown'
Device is active
Active port 0x220,0x530,0x388,0x330,0x370
Active IRQ 5 [0x2]
Active DMA 0,1
Resources 0
.................-------------------------------------------
Quoted 9 lines
Quoted 6 lines
A few further remarks concerning my patch:
*) The patch also adds a line "opl3sa2_state[card].activated = 1" which is an obvious omission in the original driver.Thanks, put it right at the end before the return and i'll be happy.
Yes, you are right, probably more readable.
Quoted 10 lines
Quoted 7 lines
*) I have to force the driver to use both dma=0 and dma2=1. From what I understand dma=0 should be sufficient, but this will not work. Looks like a bug in
isapnp.cto me. However, this should do no harm since according to/proc/isapnp, the card only offers these values anyway.
isapnp.cis fine
I still think this might affect other hardware as well. Does your card use the same
irq/prot/dma settings? Does your /proc/isapnp look the same as mine? I don't quite understand why it works for you.
Quoted 3 lines
When you rediff, can you diff so that the patch can be applied with a strip of '1' ie diff -u linux/drivers...
No problem.
Thanks for your help!
Gerald