Skip to contentSkip to conversation

vanilla 2.6.0-test11 and CS4236 card

DISCUSSION Joseph Pingenot 4 participants 12 messages Dec 2, 2003 – Dec 4, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Howdy.

I'm having problems getting the CS4236+ driver to recognize my
CS4236B card. pnp finds it on boot:
isapnp: Scanning for PnP cards...
isapnp: Card 'CS4236B'
isapnp: 1 Plug & Play card detected total

but the ALSA driver doesn't pick it up.
isapnp detection failed and probing for CS4236+ is not supported CS4236+ soundcard not found or device busy

Furthermore, after fudging with manually setting it up via modprobe
options, it's still not loading:
CS4236+ soundcard not found or device busy

This used to work in the 2.4 series kernel without any modprobe.conf
settings; the OSS driver would pick it up.

Any assistance would be greatly appreciated; this is the only thing holding
me back from 2.6 goodness. ;)

[config, pnpdump, and other information available on request] -Joseph

Signature · 5 lines
trelane@digitasaru.net--------------------------------------------------
"We continue to live in a world where all our know-how is locked into
 binary files in an unknown format. If our documents are our corporate
 memory, Microsoft still has us all condemned to Alzheimer's."
    --Simon Phipps, http://theregister.com/content/4/30410.html
#1 lore raw

At Tue, 2 Dec 2003 11:06:39 -0600,

Quoted 17 lines · Joseph Pingenot

Howdy.

I'm having problems getting the CS4236+ driver to recognize my
CS4236B card. pnp finds it on boot:
isapnp: Scanning for PnP cards...
isapnp: Card 'CS4236B'
isapnp: 1 Plug & Play card detected total

but the ALSA driver doesn't pick it up.
isapnp detection failed and probing for CS4236+ is not supported CS4236+ soundcard not found or device busy

Furthermore, after fudging with manually setting it up via modprobe
options, it's still not loading:
CS4236+ soundcard not found or device busy

Quoted 5 lines

This used to work in the 2.4 series kernel without any modprobe.conf
settings; the OSS driver would pick it up.

Any assistance would be greatly appreciated; this is the only thing holding
me back from 2.6 goodness. ;)

does the attached patch work? (it's untested at all...)

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

drivers/pnp/card.c renamed from drivers/pnp/card.c-dist +19 -2
@@ -26,8 +26,25 @@
 {
 	const struct pnp_card_device_id * drv_id = drv->id_table;
 	while (*drv_id->id){
-		if (compare_pnp_id(card->id,drv_id->id))
-			return drv_id;
+		if (compare_pnp_id(card->id,drv_id->id)) {
+			int i = 0;
+			for (;;) {
+				int found;
+				struct pnp_dev *dev;
+				if (i == PNP_MAX_DEVICES || ! *drv_id->devs[i].id)
+					return drv_id;
+				found = 0;
+				card_for_each_dev(card, dev) {
+					if (compare_pnp_id(dev->id, drv_id->devs[i].id)) {
+						found = 1;
+						break;
+					}
+				}
+				if (! found)
+					break;
+				i++;
+			}
+		}
 		drv_id++;
 	}
 	return NULL;
#2 lore raw
Quoted 1 line

From Takashi Iwai on Tuesday, 02 December, 2003:

Thanks. I'm trying to track it down via diagnostic printk statements;
right now, it's failing at least somewhere in snd_cs4231_lib (am at cs4231_probe atm; is failing right there atm).
I'll test the patch when I can.

-Joseph

Signature · 5 lines
trelane@digitasaru.net--------------------------------------------------
"We continue to live in a world where all our know-how is locked into
 binary files in an unknown format. If our documents are our corporate
 memory, Microsoft still has us all condemned to Alzheimer's."
    --Simon Phipps, http://theregister.com/content/4/30410.html
#3 lore raw
In reply to Takashi Iwai

An update. I've traced the problems down into snd_cs4231_probe(). After adding diagnostic printk statements, I get the following:

     *vcs4231_inb() returned 0xff
     *val is now 0x80
     *cs4231_inb & CS4231_INIT returned TRUE
     cs4231: port = 0x530, id = 0x0
     id is incorrect (id=0x00, but should be 0x0a)
    err in call to snd_cs4231_probe

err in call to snd_cs4231_create!
err running snd_cs4236_create!
CS4236+ soundcard not found or device busy
[all but the last line are mine]. the stuff prefixed by "*" comes from
here in snd_cs4231_probe:

	for (i = 0; i < 50; i++) {
		mb();
		val = cs4231_inb(chip, CS4231P(REGSEL));
		printk("     *vcs4231_inb() returned 0x%0x\n", val);
		val &= CS4231_INIT;
		printk("     *val is now 0x%0x\n", val);
		/*if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) {*/
		if (val) {
		  printk("     *cs4231_inb & CS4231_INIT returned TRUE\n");
			udelay(2000);
		} else {
			spin_lock_irqsave(&chip->reg_lock, flags);
			snd_cs4231_out(chip, CS4231_MISC_INFO, CS4231_MODE2);
			id = snd_cs4231_in(chip, CS4231_MISC_INFO) & 0x0f;
			printk("     *detecting id: id=%02x\n", id);
			spin_unlock_irqrestore(&chip->reg_lock, flags);
			if (id == 0x0a)
				break;	/* this is valid value */
		}
	}

Anyone know what the io port here does, and what the different return
values are? Pointers to documentation is more than welcome! :)

Thanks!

-Joseph

Signature · 5 lines
trelane@digitasaru.net--------------------------------------------------
"We continue to live in a world where all our know-how is locked into
 binary files in an unknown format. If our documents are our corporate
 memory, Microsoft still has us all condemned to Alzheimer's."
    --Simon Phipps, http://theregister.com/content/4/30410.html
#4 lore raw
In reply to Takashi Iwai

Well, I applied the patch and it worked beautifully.

THE GOOD NEWS:
--------------

The patch worked great; the problem (as you had very likely surmised)
was that it wasn't being activated by the Plug-n-Play system, and so the card wasn't talking. [Sorry; I am new to ISA programming (well, systems programming in general. At least I learned some cool stuff] After I had run isapnp on the module sans your patch, or rebooted with your patch, there was a big POP! and the card was detected and ready. It even played music!

THE BAD NEWS:
-------------

Both times (with your patch and with isapnp), I had the following problems:
a) xmms wouldn't talk straight to the card even after selecting the alsa output plugin
b) I started esd (the alsa version) and then told xmms to talk to esd. It worked out well for a couple of seconds, but then it crashed (both with your patch and with the manually activated (isapnp) one)

It crashed HARD.

It crashed so hard that it wiped out some files, like apt, I presume
when it was cleaning "orphans" in /; the net result is that my box is semi-hosed, since things like tr and apt-get and route are now full of '\0' characters instead of their actual contents.

Sound played for about a second, then the machine hung hard (I don't think
that the Magic SysRq keys even did anything), and the last couple of tenths of a second of sound just repeated over and over and over until I hit reset. I don't have an oops; it was highly hosed.

When I can pull my system back together, I can try again. Please help
me find this new bug, so that the cs4236 driver is safe for other Dell P410 users! :)

-Joseph

Signature · 7 lines
Joseph===============================================trelane@digitasaru.net
"Asked by CollabNet CTO Brian Behlendorf whether Microsoft will enforce its
 patents against open source projects, Mundie replied, 'Yes, absolutely.'
 An audience member pointed out that many open source projects aren't
 funded and so can't afford legal representation to rival Microsoft's. 'Oh
 well,' said Mundie. 'Get your money, and let's go to court.' 
Microsoft's patents only defensive? http://swpat.ffii.org/players/microsoft
#7 lore raw
In reply to Takashi Iwai
Quoted 49 lines · Takashi Iwai

At Tue, 2 Dec 2003 11:06:39 -0600,

Quoted 17 lines · Joseph Pingenot

Howdy.

I'm having problems getting the CS4236+ driver to recognize my
CS4236B card. pnp finds it on boot:
isapnp: Scanning for PnP cards...
isapnp: Card 'CS4236B'
isapnp: 1 Plug & Play card detected total

but the ALSA driver doesn't pick it up.
isapnp detection failed and probing for CS4236+ is not supported CS4236+ soundcard not found or device busy

Furthermore, after fudging with manually setting it up via modprobe
options, it's still not loading:
CS4236+ soundcard not found or device busy

Quoted 5 lines

This used to work in the 2.4 series kernel without any modprobe.conf
settings; the OSS driver would pick it up.

Any assistance would be greatly appreciated; this is the only thing holding
me back from 2.6 goodness. ;)

does the attached patch work? (it's untested at all...)

drivers/pnp/card.c renamed from drivers/pnp/card.c-dist +12 -2
@@ -26,8 +26,25 @@
 {
 	const struct pnp_card_device_id * drv_id = drv->id_table;
 	while (*drv_id->id){
-		if (compare_pnp_id(card->id,drv_id->id))
-			return drv_id;
+		if (compare_pnp_id(card->id,drv_id->id)) {
+			int i = 0;
+			for (;;) {
+				int found;
+				struct pnp_dev *dev;
+				if (i == PNP_MAX_DEVICES || ! *drv_id->devs[i].id)
+					return drv_id;
+				found = 0;
+				card_for_each_dev(card, dev) {
+					if (compare_pnp_id(dev->id, drv_id->devs[i].id)) {
+						found = 1;
+						break;

drivers/pnp/card.c line 50

Quoted 10 lines
drivers/pnp/card.c renamed from drivers/pnp/card.c-dist +7 -0
+					}
+				}
+				if (! found)
+					break;
+				i++;
+			}
+		}
 		drv_id++;
 	}
 	return NULL;

Here's a slight cleanup of the above patch -- tested with the cs4232 driver. Any additional testing would be appreciated.

drivers/pnp/card.c +12 -2
@@ -26,8 +26,18 @@
 {
 	const struct pnp_card_device_id * drv_id = drv->id_table;
 	while (*drv_id->id){
-		if (compare_pnp_id(card->id,drv_id->id))
-			return drv_id;
+		if (compare_pnp_id(card->id,drv_id->id)) {
+			int i = 0;
+			for (;;i++) {
+				struct pnp_dev *dev;
+				if (i == PNP_MAX_DEVICES || ! *drv_id->devs[i].id)
+					return drv_id;
+				card_for_each_dev(card, dev) {
+					if (!compare_pnp_id(dev->id, drv_id->devs[i].id))
+						break;
+				}
+			}
+		}
 		drv_id++;
 	}
 	return NULL;

In this case we could also just continue if the MPU device isn't present. It would probably be a good convention to do so because if, for whatever reason (3rd party driver, resource conflicts, etc), the MPU device is busy in any matched card id set, the entire probe would fail.

How about something like this? (untested)

sound/isa/cs423x/cs4236.c +1 -6
@@ -294,13 +294,8 @@
 		kfree(cfg);
 		return -EBUSY;
 	}
-	if (id->devs[2].id[0]) {
+	if (id->devs[2].id[0])
 		acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
-		if (acard->mpu == NULL) {
-			kfree(cfg);
-			return -EBUSY;
-		}
-	}
 
 	/* WSS initialization */
 	pdev = acard->wss;

Thanks,
Adam

#8 lore raw

Hi Adam,

At Tue, 2 Dec 2003 23:44:32 +0000,

Quoted 18 lines · Adam Belay

Here's a slight cleanup of the above patch -- tested with the cs4232 driver. Any additional testing would be appreciated.

drivers/pnp/card.c +5 -2
@@ -26,8 +26,18 @@
 {
 	const struct pnp_card_device_id * drv_id = drv->id_table;
 	while (*drv_id->id){
-		if (compare_pnp_id(card->id,drv_id->id))
-			return drv_id;
+		if (compare_pnp_id(card->id,drv_id->id)) {
+			int i = 0;
+			for (;;i++) {
+				struct pnp_dev *dev;
+				if (i == PNP_MAX_DEVICES || ! *drv_id->devs[i].id)

drivers/pnp/card.c line 43

Quoted 10 lines
drivers/pnp/card.c +7 -0
+					return drv_id;
+				card_for_each_dev(card, dev) {
+					if (!compare_pnp_id(dev->id, drv_id->devs[i].id))
+						break;
+				}
+			}
+		}
 		drv_id++;
 	}
 	return NULL;

i think the patch above doesn't work properly since it will continue even if no devices match. so, the loop after comparison of card id makes no sense.

Quoted 14 lines

In this case we could also just continue if the MPU device isn't present. It would probably be a good convention to do so because if, for whatever reason (3rd party driver, resource conflicts, etc), the MPU device is busy in any matched card id set, the entire probe would fail.

How about something like this? (untested)

sound/isa/cs423x/cs4236.c +0 -1
@@ -294,13 +294,8 @@
 		kfree(cfg);
 		return -EBUSY;
 	}
-	if (id->devs[2].id[0]) {

sound/isa/cs423x/cs4236.c line 301

Quoted 10 lines
sound/isa/cs423x/cs4236.c +1 -5
+	if (id->devs[2].id[0])
 		acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
-		if (acard->mpu == NULL) {
-			kfree(cfg);
-			return -EBUSY;
-		}
-	}
 
 	/* WSS initialization */
 	pdev = acard->wss;

this looks fine to me.

ciao,

Takashi

#5 lore raw
In reply to Joseph Pingenot

Hi,

At Tue, 2 Dec 2003 21:17:51 -0600,

Quoted 7 lines · Joseph Pingenot

THE BAD NEWS:
-------------

Both times (with your patch and with isapnp), I had the following problems:
a) xmms wouldn't talk straight to the card even after selecting the alsa output plugin

what was the error exactly?

Quoted 5 lines

b) I started esd (the alsa version) and then told xmms to talk to esd. It worked out well for a couple of seconds, but then it crashed (both with your patch and with the manually activated (isapnp) one)

It crashed HARD.

oh, that's bad.

Quoted 5 lines

It crashed so hard that it wiped out some files, like apt, I presume
when it was cleaning "orphans" in /; the net result is that my box is semi-hosed, since things like tr and apt-get and route are now full of '\0' characters instead of their actual contents.

Quoted 8 lines

Sound played for about a second, then the machine hung hard (I don't think
that the Magic SysRq keys even did anything), and the last couple of tenths of a second of sound just repeated over and over and over until I hit reset. I don't have an oops; it was highly hosed.

When I can pull my system back together, I can try again. Please help
me find this new bug, so that the cs4236 driver is safe for other Dell P410 users! :)

i'm puzzled because cs4236's pcm code is basically identical with cs4231, and cs4232 seems working (at least the last time i tested). anyway, please show the kernel config and check any other apps do similar oops / crash.

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

#6 lore raw
Quoted 10 lines

From Takashi Iwai on Wednesday, 03 December, 2003:
Hi,
At Tue, 2 Dec 2003 21:17:51 -0600,

Quoted 5 lines · Joseph Pingenot

THE BAD NEWS:
-------------
Both times (with your patch and with isapnp), I had the following problems:
a) xmms wouldn't talk straight to the card even after selecting the alsa output plugin

what was the error exactly?

Standard thing when it can't talk to the sound card:

"Please check that:
1. You have the correct output plugin selected
2. No other programs is(sic) blocking the soundcard
3. Your soundcard is configured properly

         [OK]"

FWIW, ALSA for the cs4281 chip on my home box works 100%, and xmms can talk
to it without problem. These are different distros (gentoo@home, debian@work) so it may also be a problem in Debian, but I don't think so.

Quoted 6 lines
Quoted 5 lines

b) I started esd (the alsa version) and then told xmms to talk to esd. It worked out well for a couple of seconds, but then it crashed (both with your patch and with the manually activated (isapnp) one)

It crashed HARD.

oh, that's bad.

Ja. I'm gonna have to sort it out whenever I can get my homework done.
Either this afternoon or tomorrow. Just gotta copy some files over by floppy (e.g. route) and then tar them over from another machine.

Quoted 10 lines
Quoted 10 lines

It crashed so hard that it wiped out some files, like apt, I presume
when it was cleaning "orphans" in /; the net result is that my box is semi-hosed, since things like tr and apt-get and route are now full of '\0' characters instead of their actual contents.

Sound played for about a second, then the machine hung hard (I don't think
that the Magic SysRq keys even did anything), and the last couple of tenths of a second of sound just repeated over and over and over until I hit reset. I don't have an oops; it was highly hosed.

Quoted 7 lines
Quoted 3 lines

When I can pull my system back together, I can try again. Please help
me find this new bug, so that the cs4236 driver is safe for other Dell P410 users! :)

i'm puzzled because cs4236's pcm code is basically identical with cs4231, and cs4232 seems working (at least the last time i tested). anyway, please show the kernel config and check any other apps do similar oops / crash.

Hmm. I dunno. The only odd thing atm is that the nvidia driver was loaded
and had reported a couple of bugs. When the machine's up next time, I'll try it sans nvidia and see what we get. I don't suspect that's the problem, as everything but sound worked 100%, but we'll see.

Other than my diagnostic print statements or your pnp patch, everything
at runtime was vanilla (except nvidia of course)

-Joseph

Signature · 7 lines
Joseph===============================================trelane@digitasaru.net
"Asked by CollabNet CTO Brian Behlendorf whether Microsoft will enforce its
 patents against open source projects, Mundie replied, 'Yes, absolutely.'
 An audience member pointed out that many open source projects aren't
 funded and so can't afford legal representation to rival Microsoft's. 'Oh
 well,' said Mundie. 'Get your money, and let's go to court.' 
Microsoft's patents only defensive? http://swpat.ffii.org/players/microsoft
#9 lore raw
In reply to Takashi Iwai

I tested a combination of Takashi's version of the patch to drivers/pnp/card.c and Adam's patch to sound/isa/cs423x/cs4236.c applied to 2.6.0-test11 and report success. This is on a Dell Precision Workstation 410 which doesn't have a MPU device. The card has always been detected fine by ISAPNP and now when I modpobe snd-cs4236 the modules load just like they should. PCM output and input work fine. I exercised the audio system by running, at various times, xmms, aplay, alsamixer, and audacity and everything worked OK. No kernel-tainting modules were loaded. I would be happy to test the final version of these patches.

wes schreiner

#10 lore raw
Quoted 11 lines

From wes schreiner on Wednesday, 03 December, 2003:
I tested a combination of Takashi's version of the patch to drivers/pnp/card.c and Adam's patch to sound/isa/cs423x/cs4236.c applied to 2.6.0-test11 and report success. This is on a Dell Precision Workstation 410 which doesn't have a MPU device. The card has always been detected fine by ISAPNP and now when I modpobe snd-cs4236 the modules load just like they should. PCM output and input work fine. I exercised the audio system by running, at various times, xmms, aplay, alsamixer, and audacity and everything worked OK. No kernel-tainting modules were loaded. I would be happy to test the final version of these patches.

Sweet. Stupid NVidia drivers. Thanks for the help (I have exactly the
same system). I'll report back when I've recovered from NVidia driver's mess. :)

-Joseph

Signature · 7 lines
Joseph===============================================trelane@digitasaru.net
"Asked by CollabNet CTO Brian Behlendorf whether Microsoft will enforce its
 patents against open source projects, Mundie replied, 'Yes, absolutely.'
 An audience member pointed out that many open source projects aren't
 funded and so can't afford legal representation to rival Microsoft's. 'Oh
 well,' said Mundie. 'Get your money, and let's go to court.' 
Microsoft's patents only defensive? http://swpat.ffii.org/players/microsoft
#11 lore raw
In reply to Takashi Iwai

Status update.

I removed the nvida driver module (thus making it, contrary to what I
had considered vanilla) *truly* vanilla. [Sorry about that; I really didn't mean to mislead.]
Upon reboot, the cs4236B "card" works 100% (although, for some reason, the
xmms alsa drivers can't talk to it directly, but that's survivable; I'm using esd right now anyway; it's likely a debian problem or a Joe Confusigration problem).
My compliments and gratitude to all those who helped; I have now moved
my workstation to 2.6. I'll buy a student copy of SuSE when my laptop gets here next week. ;)

-Joseph

Signature · 5 lines
trelane@digitasaru.net--------------------------------------------------
"We continue to live in a world where all our know-how is locked into
 binary files in an unknown format. If our documents are our corporate
 memory, Microsoft still has us all condemned to Alzheimer's."
    --Simon Phipps, http://theregister.com/content/4/30410.html