lkml.org 
[lkml]   [2004]   [Jan]   [11]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateSun, 11 Jan 2004 06:33:36 +0100
FromRene Herman <>
Subject[PATCH] Re: ALSA in 2.6 failing to find the OPL chip of the sb cards
Rene Herman wrote:

NOTE: I seem unable to contact Adam Belay; his ISP is not accepting mail 
from mine. Takashi, if you agree attached patch is a correct fix, could 
you relay it to Adam?

>> ALSA sound/drivers/opl3/opl3_lib.c:444: OPL2/3 chip not detected at 
>> 0x388/0x38a
>> ALSA sound/isa/sb/sb16.c:484: sb16: no OPL device at 0x388-0x38a
>>
>> I think I have already said that in 2.4 it works, and I have tested both
>> alsa in the kernel plus alsa sources downloaded from alsa-project, 
>> this last
>> one works in 2.4 but doesn't work in 2.6.
> 
> I'm seeing the same behaviour with a Sound Blaster AWE64 Gold. It seems 
> it's not an ALSA problem though, but ISA-PnP.

Assuming ALSA isn't misusing the PnP API, it's indeed not ALSA, but PnP.

It also isn't actually an OPL3 issue, but MPU401. Trouble is that sb16.c 
doesn't set mpu_port to SNDRV_DEFAULT_PORT, but hardcodes the values for 
the first two cards as 0x330 and 0x300 (Takashi: why is that, by the 
way? At least for ISA-PnP cards SNDRV_DEFAULT_PORT would seem better?). 
This causes the initialisation code to call pnp_resource_change() for 
the MPU port resource, which clears IORESOURCE_AUTO for that resource.

The rest of the PnP layer, seeing IORESOURCE_AUTO clear, then never 
touches that resource again, but at that point IORESOURCE_IO (indicating 
an I/O port resource) hasn't yet been set, so that when it later gets to 
isapnp_set_resources(), that function bails out believing it has reached 
the end of the I/O port resources for the device. Since SB is resource 
0, MPU401 resource 1 and OPL3 resource 2 for the device, only SB gets 
enabled, MPU401 and OPL3 do not.

Making sure IORESOURCE_IO gets set fixes it. Having 
pnp_init_resource_table() do this seems proper.

The attached patch works for me:

rene@7ixe4:~$ sbiload -l
  Port     Client name                       Port name
  64:0     Rawmidi 0 - MPU-401 (UART) 0-0    MPU-401 (UART) 0-0
  65:0     Emu8000 WaveTable                 Emu8000 Port 0
  65:1     Emu8000 WaveTable                 Emu8000 Port 1
  65:2     Emu8000 WaveTable                 Emu8000 Port 2
  65:3     Emu8000 WaveTable                 Emu8000 Port 3
  66:0     OPL3 FM synth                     OPL3 FM Port

Rene.
--- linux-2.6.1/drivers/pnp/manager.c.orig	2004-01-11 05:32:34.000000000 +0100
+++ linux-2.6.1/drivers/pnp/manager.c	2004-01-11 05:15:36.000000000 +0100
@@ -223,25 +223,25 @@
 		table->irq_resource[idx].name = NULL;
 		table->irq_resource[idx].start = -1;
 		table->irq_resource[idx].end = -1;
-		table->irq_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
+		table->irq_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET | IORESOURCE_IRQ;
 	}
 	for (idx = 0; idx < PNP_MAX_DMA; idx++) {
 		table->dma_resource[idx].name = NULL;
 		table->dma_resource[idx].start = -1;
 		table->dma_resource[idx].end = -1;
-		table->dma_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
+		table->dma_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET | IORESOURCE_DMA;
 	}
 	for (idx = 0; idx < PNP_MAX_PORT; idx++) {
 		table->port_resource[idx].name = NULL;
 		table->port_resource[idx].start = 0;
 		table->port_resource[idx].end = 0;
-		table->port_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
+		table->port_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET | IORESOURCE_IO;
 	}
 	for (idx = 0; idx < PNP_MAX_MEM; idx++) {
 		table->mem_resource[idx].name = NULL;
 		table->mem_resource[idx].start = 0;
 		table->mem_resource[idx].end = 0;
-		table->mem_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET;
+		table->mem_resource[idx].flags = IORESOURCE_AUTO | IORESOURCE_UNSET | IORESOURCE_MEM;
 	}
 }
 
\
 
 \ /
  Last update: 2005-03-22 13:00    [W:0.343 / U:0.260 seconds]
©2003-2008 Jasper Spaans