Skip to contentSkip to conversation

au88x0 Init before create components

PATCH Alan Horstmann 3 participants 9 messages Apr 26, 2006 – May 3, 2006

lore
Share & tools
lore
#0 lore raw

Patch as suggested by Raymond in one of his copious bug-track notes.

Change the order in vortex_probe to init the card details before creating the components, meaning for example that card->shortname is available when registering the midi port.

I have also added extra to card->shortname, and a line to overwrite the midi name following snd_mpu401_uart_new, for consideration.

Do I have the correct address to cc mjander?

au88x0-init-before-comps-et-al.patch

alsa-kernel/pci/au88x0/au88x0.c +22 -22
diff -ru alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c
@@ -261,7 +261,28 @@
 		return err;
 	}
 	snd_vortex_workaround(pci, pcifix[dev]);
-	// (4) Alloc components.
+	// (4)
+	strcpy(card->driver, CARD_NAME_SHORT);
+	sprintf(card->shortname, "Aureal Vortex %s", CARD_NAME_SHORT);
+	sprintf(card->longname, "%s at 0x%lx irq %i",
+		card->shortname, chip->io, chip->irq);
+
+	if ((err = pci_read_config_word(pci, PCI_DEVICE_ID,
+				  &(chip->device))) < 0) {
+		snd_card_free(card);
+		return err;
+	}
+	if ((err = pci_read_config_word(pci, PCI_VENDOR_ID,
+				  &(chip->vendor))) < 0) {
+		snd_card_free(card);
+		return err;
+	}
+	if ((err = pci_read_config_byte(pci, PCI_REVISION_ID,
+				  &(chip->rev))) < 0) {
+		snd_card_free(card);
+		return err;
+	}
+	// (5) Alloc components.
 	// ADB pcm.
 	if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_ADB)) < 0) {
 		snd_card_free(card);
@@ -322,27 +343,6 @@
 	}
 #endif
 
-	// (5)
-	strcpy(card->driver, CARD_NAME_SHORT);
-	strcpy(card->shortname, CARD_NAME_SHORT);
-	sprintf(card->longname, "%s at 0x%lx irq %i",
-		card->shortname, chip->io, chip->irq);
-
-	if ((err = pci_read_config_word(pci, PCI_DEVICE_ID,
-				  &(chip->device))) < 0) {
-		snd_card_free(card);
-		return err;
-	}	
-	if ((err = pci_read_config_word(pci, PCI_VENDOR_ID,
-				  &(chip->vendor))) < 0) {
-		snd_card_free(card);
-		return err;
-	}
-	if ((err = pci_read_config_byte(pci, PCI_REVISION_ID,
-				  &(chip->rev))) < 0) {
-		snd_card_free(card);
-		return err;
-	}
 #ifdef CHIP_AU8830
 	if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) {
 		printk(KERN_ALERT
alsa-kernel/pci/au88x0/au88x0_mpu401.c +3 -0
diff -ru alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c
@@ -107,6 +107,9 @@
 	mpu = rmidi->private_data;
 	mpu->cport = (unsigned long)(vortex->mmio + VORTEX_MIDI_CMD);
 #endif
+	/* Overwrite MIDI name */
+	snprintf(rmidi->name, sizeof(rmidi->name), "MIDI %s %d", CARD_NAME_SHORT , vortex->card->number);
+
 	vortex->rmidi = rmidi;
 	return 0;
 }
#1 lore raw

At Wed, 26 Apr 2006 14:14:52 +0100,

Quoted 6 lines · Alan Horstmann

Patch as suggested by Raymond in one of his copious bug-track notes.

Change the order in vortex_probe to init the card details before creating the components, meaning for example that card->shortname is available when registering the midi port.

The detection of vendor, device and rev is irrelevant with the definition of driver, shortname and longname.

Looking at the code a bit carefully, we can find that chip->vendor and chip->device are not really used in the code. The only referring part is IS_BAD_CHIP() macro in au88x0.h, and it's used nowhere. Moreover, the values are identical with pci->device and pci->vendor. So, basically we can remove these fields. But it's another story.

Anyway, I'd suggest to move the definition of driver, shortname and longname there with a short comment that it's needed for mpu401 instance, and keep the rest as it is.

Also, I feel "Aureal au8810 MIDI 0" is more intuitive than "MIDI Aureal au8810 0". It's a matter of taste, though...

Thanks,

Takashi

Quoted 75 lines

I have also added extra to card->shortname, and a line to overwrite the midi name following snd_mpu401_uart_new, for consideration.

Do I have the correct address to cc mjander?

au88x0-init-before-comps-et-al.patch

[2 au88x0-init-before-comps-et-al.patch <text/x-diff; us-ascii (7bit)>]

diff -ru alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c

alsa-kernel/pci/au88x0/au88x0.c +22 -22
@@ -261,7 +261,28 @@
 		return err;
 	}
 	snd_vortex_workaround(pci, pcifix[dev]);
-	// (4) Alloc components.
+	// (4)
+	strcpy(card->driver, CARD_NAME_SHORT);
+	sprintf(card->shortname, "Aureal Vortex %s", CARD_NAME_SHORT);
+	sprintf(card->longname, "%s at 0x%lx irq %i",
+		card->shortname, chip->io, chip->irq);
+
+	if ((err = pci_read_config_word(pci, PCI_DEVICE_ID,
+				  &(chip->device))) < 0) {
+		snd_card_free(card);
+		return err;
+	}
+	if ((err = pci_read_config_word(pci, PCI_VENDOR_ID,
+				  &(chip->vendor))) < 0) {
+		snd_card_free(card);
+		return err;
+	}
+	if ((err = pci_read_config_byte(pci, PCI_REVISION_ID,
+				  &(chip->rev))) < 0) {
+		snd_card_free(card);
+		return err;
+	}
+	// (5) Alloc components.
 	// ADB pcm.
 	if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_ADB)) < 0) {
 		snd_card_free(card);
@@ -322,27 +343,6 @@
 	}
 #endif
 
-	// (5)
-	strcpy(card->driver, CARD_NAME_SHORT);
-	strcpy(card->shortname, CARD_NAME_SHORT);
-	sprintf(card->longname, "%s at 0x%lx irq %i",
-		card->shortname, chip->io, chip->irq);
-
-	if ((err = pci_read_config_word(pci, PCI_DEVICE_ID,
-				  &(chip->device))) < 0) {
-		snd_card_free(card);
-		return err;
-	}	
-	if ((err = pci_read_config_word(pci, PCI_VENDOR_ID,
-				  &(chip->vendor))) < 0) {
-		snd_card_free(card);
-		return err;
-	}
-	if ((err = pci_read_config_byte(pci, PCI_REVISION_ID,
-				  &(chip->rev))) < 0) {
-		snd_card_free(card);
-		return err;
-	}
 #ifdef CHIP_AU8830
 	if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) {
 		printk(KERN_ALERT

diff -ru alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c

alsa-kernel/pci/au88x0/au88x0_mpu401.c line 115

Quoted 9 lines
alsa-kernel/pci/au88x0/au88x0_mpu401.c +3 -0
@@ -107,6 +107,9 @@
 	mpu = rmidi->private_data;
 	mpu->cport = (unsigned long)(vortex->mmio + VORTEX_MIDI_CMD);
 #endif
+	/* Overwrite MIDI name */
+	snprintf(rmidi->name, sizeof(rmidi->name), "MIDI %s %d", CARD_NAME_SHORT , vortex->card->number);
+
 	vortex->rmidi = rmidi;
 	return 0;
 }

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#2 lore raw
Quoted 5 lines

At Wed, 26 Apr 2006 14:14:52 +0100,

Quoted 2 lines · Alan Horstmann

I have also added extra to card->shortname, and a line to overwrite the midi name following snd_mpu401_uart_new, for consideration.

Quoted 3 lines · Raymond

Refer to au88x0-init-before-comps-et-al.patch,
You should not change the card->shortname
THis shortname is used to access the /usr/share/alsa/conf/AU88X0.conf

Or is it card->driver that accesses .conf files? Other cards operate with shortnames different from .conf file name. (And of course it works fine in my tests)

Alan

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#3 lore raw

At Wed, 26 Apr 2006 21:00:58 +0100,

Quoted 9 lines · Alan Horstmann
Quoted 6 lines

At Wed, 26 Apr 2006 14:14:52 +0100,

Quoted 2 lines · Alan Horstmann

I have also added extra to card->shortname, and a line to overwrite the midi name following snd_mpu401_uart_new, for consideration.

Raymond wrote:

Quoted 7 lines
Quoted 3 lines

Refer to au88x0-init-before-comps-et-al.patch,
You should not change the card->shortname
THis shortname is used to access the /usr/share/alsa/conf/AU88X0.conf

Or is it card->driver that accesses .conf files? Other cards operate with shortnames different from .conf file name. (And of course it works fine in my tests)

Yes, it is card->driver. shortname isn't referred from the config file. The change of shortname is safe (so far).

Takashi

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#4 lore raw
In reply to Takashi Iwai
Quoted 7 lines · you

Anyway, I'd suggest to move the definition of driver, shortname and longname there with a short comment that it's needed for mpu401 instance, and keep the rest as it is.

Also, I feel "Aureal au8810 MIDI 0" is more intuitive than "MIDI Aureal au8810 0". It's a matter of taste, though...

Reduced patch is attached

Regards Alan

Change the order in vortex_probe to set the card details before creating the components, meaning for example that card->shortname is available when registering the midi port.

I have also added extra to card->shortname, and a line to overwrite the midi name following snd_mpu401_uart_new.

au88x0-card-details-midi-name.patch

alsa-kernel/pci/au88x0/au88x0.c +7 -0
diff -ru alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0.c
@@ -261,6 +261,13 @@
 		return err;
 	}
 	snd_vortex_workaround(pci, pcifix[dev]);
+
+	// Card details needed in snd_vortex_midi
+	strcpy(card->driver, CARD_NAME_SHORT);
+	sprintf(card->shortname, "Aureal Vortex %s", CARD_NAME_SHORT);
+	sprintf(card->longname, "%s at 0x%lx irq %i",
+		card->shortname, chip->io, chip->irq);
+
	// (4) Alloc components.

// ADB pcm.
if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_ADB)) < 0) {
@@ -323,11 +330,6 @@
#endif

	// (5)

- strcpy(card->driver, CARD_NAME_SHORT);
- strcpy(card->shortname, CARD_NAME_SHORT);
- sprintf(card->longname, "%s at 0x%lx irq %i",
- card->shortname, chip->io, chip->irq);
-

	if ((err = pci_read_config_word(pci, PCI_DEVICE_ID,
				  &(chip->device))) < 0) {
		snd_card_free(card);
alsa-kernel/pci/au88x0/au88x0_mpu401.c +3 -0
diff -ru alsa-driver-orig-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c alsa-driver-1.0.11rc3/alsa-kernel/pci/au88x0/au88x0_mpu401.c
@@ -107,6 +107,9 @@
 	mpu = rmidi->private_data;
 	mpu->cport = (unsigned long)(vortex->mmio + VORTEX_MIDI_CMD);
 #endif
+	/* Overwrite MIDI name */
+	snprintf(rmidi->name, sizeof(rmidi->name), "%s MIDI %d", CARD_NAME_SHORT , vortex->card->number);
+
 	vortex->rmidi = rmidi;
 	return 0;
 }
#5 lore raw

At Mon, 1 May 2006 22:17:48 +0100,

Quoted 4 lines · Alan Horstmann

[1 <text/plain; iso-8859-1 (7bit)>]

Quoted 1 line · you
Quoted 8 lines
Quoted 6 lines

Anyway, I'd suggest to move the definition of driver, shortname and longname there with a short comment that it's needed for mpu401 instance, and keep the rest as it is.

Also, I feel "Aureal au8810 MIDI 0" is more intuitive than "MIDI Aureal au8810 0". It's a matter of taste, though...

Reduced patch is attached

Thanks.

I think it's better to remove the card number from the shortname field. You can add it at copying to rmidi->name, instead.

If you have no objection, I'll change and commit it.

Takashi

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#6 lore raw
Quoted 8 lines · you

At Mon, 1 May 2006 22:17:48 +0100,

Quoted 2 lines · Alan Horstmann

Reduced patch is attached

I think it's better to remove the card number from the shortname field. You can add it at copying to rmidi->name, instead.

That is what the patch does -card number isn't added to shortname, but just rmidi->name.

Alan

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#7 lore raw

At Wed, 3 May 2006 15:55:57 +0100,

Quoted 6 lines · Alan Horstmann
Quoted 4 lines · you

At Mon, 1 May 2006 22:17:48 +0100,

Quoted 1 line · Alan Horstmann
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Reduced patch is attached

I think it's better to remove the card number from the shortname field. You can add it at copying to rmidi->name, instead.

That is what the patch does -card number isn't added to shortname, but just rmidi->name.

Ah OK, then it's fine.

thanks,

Takashi

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#8 lore raw
In reply to Alan Horstmann

Hi,

This is my current and hopefuly "for ever" email address. (hmm, hopefuly no spammer gets this one: _manuel_._jander_|@_gmail|.| com) (remove _ and | characters).
My address at embedded.cl no longer exists. A am very pleased about that someone is posting patches to the au88x0 drivers :)

By the way I'm living in Erlangen now, far close to the ALSA guys in Nürnberg.

Best Regards,
Manuel Jander

Quoted 6 lines · Alan Horstmann

Patch as suggested by Raymond in one of his copious bug-track notes.

Change the order in vortex_probe to init the card details before creating the components, meaning for example that card->shortname is available when registering the midi port.

Quoted 8 lines

I have also added extra to card->shortname, and a line to overwrite the midi name following snd_mpu401_uart_new, for consideration.

Do I have the correct address to cc mjander?

au88x0-init-before-comps-et-al.patch

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642