Skip to contentSkip to conversation

Patch: MSI-K8T-Neo2-Fir OnboardSound and additional Soundcard

PATCH Johannes Goecke 3 participants 5 messages Mar 11, 2006 – Mar 13, 2006 PCI

lore
Share & tools
lore
#0 lore raw

Hello *,

i have a small patch for a Problem that i had.

On the MSI-K8T-NEO2 FIR ( Athlon-64, Socket 939 with VIA-K8T800- Chipset and onboard Sound,... ) the BIOS lets you choose "DISABLED" or "AUTO" for the On-Board Sound Device.

If you add another PCI-Sound-Card the BIOS disables the on-board device.

So far I have a Quirk, that does set the correspondent BIT in the PCI-registers to enable the soundcard.

But i have another 2 problems:

- how to enshure that the code is executed ONLY on excactly this kind of boards (not any other with similar Chipset)?

- what to do to (hopefully) integrate that pice of code into one of the next Kernel Releases?

Johannes Goecke

drivers/pci/quirks.c +31 -0
diff -u -r linux-2.6.15.6/drivers/pci/quirks.c linux-2.6.15.6-jg/drivers/pci/quirks.c
@@ -861,6 +861,41 @@
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82375,	quirk_eisa_bridge );
 
+/* 
+ * On the MSI-K8T-Neo2Fir Board, the internal Soundcard is disabled
+ * when a PCI-Soundcard is added. The BIOS only gives Options 
+ * "Disabled" and "AUTO". This Quirk Sets the corresponding
+ * Register-Value to enable the Soundcard.
+ */
+static void __init k8t_sound_hostbridge(struct pci_dev *dev) 
+{
+	printk(KERN_INFO "PCI: Quirk-MSI-K8T Soundcard On\n");
+
+	unsigned char val;
+
+	pci_read_config_byte(dev, 0x50, &val);
+
+	if ((val == 0x88) || (val == 0xc8)) {
+		pci_write_config_byte(dev, 0x50, val & (~0x40));
+
+		/* Verify the Change for Status output */
+		pci_read_config_byte(dev, 0x50, &val);
+		if (val & 0x40)
+			printk(KERN_INFO "PCI: MSI-K8T soundcard still off\n");
+		else
+			printk(KERN_INFO "PCI: MSI-K8T soundcard on\n");
+	} else {
+		printk(KERN_INFO "PCI: Unexpected Value in PCI-Register : no Change!\n");
+	}
+
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA,	PCI_DEVICE_ID_VIA_8237,	k8t_sound_hostbridge );
+
+
 /*
  * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
  * is not activated. The myth is that Asus said that they do not want the
#1 lore raw
Quoted 7 lines · Johannes Goecke

- how to enshure that the code is executed ONLY on excactly this kind of boards
(not any other with similar Chipset)?

- what to do to (hopefully) integrate that pice of code into one of the next Kernel Releases?

This has been discussed on LKML recently, it's not 2.6.16 material because it might break working setups when the previously disabled device becomes the default sound card. Of course the same setup would have broken if we added a driver for a previously unsupported soundcard, so I'm not sure how this fits in with the "don't break userspace" rule.

IMHO it should be merged post 2.6.16.

Lee

#2 lore raw
Quoted 9 lines · Lee Revell
Quoted 7 lines · Johannes Goecke

- how to enshure that the code is executed ONLY on excactly this kind of boards
(not any other with similar Chipset)?

- what to do to (hopefully) integrate that pice of code into one of the next Kernel Releases?

Quoted 5 lines

This has been discussed on LKML recently, it's not 2.6.16 material because it might break working setups when the previously disabled device becomes the default sound card. Of course the same setup would have broken if we added a driver for a previously unsupported soundcard, so I'm not sure how this fits in with the "don't break userspace" rule.

would it be useful to add a compile-time-option and additionally a kernel-command-line option for some bogus-code like

if ( commandline-enable || compiletime-enable )

{
	/* Enable all Soundcards- Found */
}

?

- no default behaviour is changed
- general purpose Kernels can have Quirks integrated if needed

Quoted 5 lines

IMHO it should be merged post 2.6.16.

Lee

Johannes Goecke

PS:
can someone give me a (kernel-programming-beginner-level) hint, for the first question how to ensure to only execute if running on the right Mother-board? Af far as I believe the quirk so-far only checks the cipset, so it might behave wrong on other Mainborads!

#3 lore raw
Quoted 8 lines · Johannes Goecke
Quoted 6 lines · Lee Revell

On Sat, 2006-03-11 at 20:28 +0100, Johannes Goecke wrote:
This has been discussed on LKML recently, it's not 2.6.16 material because it might break working setups when the previously disabled device becomes the default sound card. Of course the same setup would have broken if we added a driver for a previously unsupported soundcard, so I'm not sure how this fits in with the "don't break userspace" rule.

Quoted 7 lines

would it be useful to add a compile-time-option and additionally a kernel-command-line option for some bogus-code like

if ( commandline-enable || compiletime-enable )

{
	/* Enable all Soundcards- Found */
}

Well, the whole collection of Quirks isn't based on a device-type model, but purely on IDs. So either there's a workaround for some oddity, or there isn't.

Though it may make sense to re-submit if right after 2.6.16 is out.

Quoted 4 lines

can someone give me a (kernel-programming-beginner-level) hint, for the first question how to ensure to only execute if running on the right Mother-board? Af far as I believe the quirk so-far only checks the cipset, so it might behave wrong on other Mainborads!

That depends on wether the soundchip is inside the chipset. If it is, you can just ignore that and run the quirk if the proper device was found (as you do it right now.) If you really need to verify the mainboard (as per name/vendor), have a look at ./arch/i386/kernel/{reboot,apm}.c . They both are DMI users.

MfG, JBG

Signature · 4 lines
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
#4 lore raw
In reply to Johannes Goecke
Quoted 7 lines · Johannes Goecke

can someone give me a (kernel-programming-beginner-level) hint, for the first
question how to ensure to only execute if running on the right Mother-board?
Af far as I believe the quirk so-far only checks the cipset, so it might
behave wrong on other Mainborads!

I believe a proper fix was already posted for this, the thread was called:

[PATCH 001/001] PCI: PCI quirk for Asus A8V and A8V Deluxe motherboards

Simply add your board to the IDs.

Lee