All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cs4236.c, kernel 2.6.11
@ 2005-05-31 23:33 Christoph Schulz
  0 siblings, 0 replies; only message in thread
From: Christoph Schulz @ 2005-05-31 23:33 UTC (permalink / raw)
  To: perex; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3559 bytes --]

Hello,

please consider attached patch for the cs4236.c driver module, located
in sound/isa/cs423x/ in the Linux 2.6.11 kernel.

Background: The card/chipset supports an external MIDI interrupt. By
default, this interrupt isn't used (because the isapnp mechanism chooses
a configuration without an assigned interrupt). If the user wishes to
explicitly select an interrupt via the mpu_irq parameter for such a
configured device, it doesn't work: The driver always shows:

isapnp MPU: port=0x330, irq=-1

(note the "irq=-1")

Problem: The driver only allows to set the irq if pnp_irq_valid returns
true for this particular pnp device. This, however, is only true if an
interrupt has already been assigned (pnp_valid_irq returns true if the
flag IORESOURCE_IRQ is set and IORESOURCE_UNSET is not set). If no
interrupt has been assigned so far, IORESOURCE_UNSET is set and
pnp_irq_valid returns false, thereby inhibiting the selection of a valid
irq.

Solution: Don't check for a valid (= already assigned) irq at the point
of calling pnp_resource_change.

Tested successfully on Linux 2.6.11.

Before applying the patch:

May 30 10:50:15 fenrir kernel: pnp: Device 01:01.00 activated.
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:325:
isapnp WSS: wss port=0x534, fm port=0x388, sb port=0x220
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:327:
isapnp WSS: irq=5, dma1=1, dma2=3
May 30 10:50:15 fenrir kernel: pnp: Device 01:01.02 activated.
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:344:
isapnp CTRL: control port=0x120
May 30 10:50:15 fenrir kernel: pnp: Device 01:01.03 activated.
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:372:
isapnp MPU: port=0x330, irq=-1
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1053:
cs4231: port = 0x534, id = 0xa
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1059:
CS4231: VERSION (I25) = 0x3
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1128:
CS4231: ext version; rev = 0xeb, id = 0xeb
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236_lib.c:300:
CS4236: [0x120] C1 (version) = 0xeb, ext = 0xeb

After applying the patch:

May 30 12:06:46 fenrir kernel: pnp: Device 01:01.00 activated.
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:325:
isapnp WSS: wss port=0x534, fm port=0x388, sb port=0x220
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:327:
isapnp WSS: irq=5, dma1=1, dma2=3
May 30 12:06:46 fenrir kernel: pnp: Device 01:01.02 activated.
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:344:
isapnp CTRL: control port=0x120
May 30 12:06:46 fenrir kernel: pnp: Device 01:01.03 activated.
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:371:
isapnp MPU: port=0x330, irq=11
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1053:
cs4231: port = 0x534, id = 0xa
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1059:
CS4231: VERSION (I25) = 0x3
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1128:
CS4231: ext version; rev = 0xeb, id = 0xeb
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236_lib.c:300:
CS4236: [0x120] C1 (version) = 0xeb, ext = 0xeb

(note the "irq=11" after applying the patch)

I am not a kernel developer, so I cannot guarantee that my observations
are correct. Please feel free to contact me for further information
and/or if I should have missed something. Please cc: to me if possible.


Regards,

Christoph Schulz
E-Mail: develop@kristov.de


[-- Attachment #2: cs4236-irq.patch --]
[-- Type: text/plain, Size: 702 bytes --]

diff -ur linux-2.6.11/sound/isa/cs423x/cs4236.c linux-2.6.11-patched/sound/isa/cs423x/cs4236.c
--- linux-2.6.11/sound/isa/cs423x/cs4236.c	2005-03-02 07:37:48.000000000 +0100
+++ linux-2.6.11-patched/sound/isa/cs423x/cs4236.c	2005-05-31 14:31:07.040130710 +0200
@@ -349,8 +349,7 @@
 		pnp_init_resource_table(cfg);
 		if (mpu_port[dev] != SNDRV_AUTO_PORT)
 			pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
-		if (mpu_irq[dev] != SNDRV_AUTO_IRQ && mpu_irq[dev] >= 0 &&
-		    pnp_irq_valid(pdev, 0))
+		if (mpu_irq[dev] != SNDRV_AUTO_IRQ && mpu_irq[dev] >= 0)
 			pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
 		err = pnp_manual_config_dev(pdev, cfg, 0);
 		if (err < 0)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-31 23:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-31 23:33 [PATCH] cs4236.c, kernel 2.6.11 Christoph Schulz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.