Re: CMI8738, accessing MIDI port causes sudden system reboot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 16 Dec 2019 17:06:14 +0100,
Patrick May wrote:
> 
> Hello,
> 
> I have a C-Media CMI8738 soundcard. I'm using it because it has a
> special feature that I want: the OPL3 synth.
> 
> It creates two ALSA MIDI ports. In my case, these are '20:0, C-Media
> CMI8738, C-Media CMI8738 MIDI' and '21:0, OPL3 FM synth, OPL3 FM
> Port'.
> The first one is completely useless - this soundcard actually has no
> game/midi port connector on it. The second one is what I really want.
> 
> The problem I have is that the first port has a weird problem in that
> if you access it in some way (eg. play a midi file through it with
> aplaymidi) it has a very high chance of making the computer reboot
> suddenly and without warning. This seems to be different from a kernel
> panic because my system is configured not to automatically reboot on
> panic, and I don't get the capslock/scroll lock lights flashing - the
> system just reboots suddenly and without warning.
> 
> I can't simply avoid using that MIDI port - music software I use, such
> as Rosegarden, seems to automatically connect to all MIDI ports as
> part of its initialisation routine. I discovered the problem because
> it was happening (my system was unexpectedly rebooting) every few
> times I opened a project file in Rosegarden.
> 
> So I'm looking for a workaround that will remove/destroy/eliminate
> this unwanted and unused MIDI port so that nothing can make my system
> reboot by accident. So far I have tried this:
> 
> * load snd_cmipci with parameter 'mpu_port=0'. This didn't work, the
> unwanted port was still created and still caused the reboot when I
> tested it.
> * prevent snd_mpu401_uart from loading. This didn't work - snd_cmipci
> refused to load without it.
> 
> Does anyone have any ideas or suggestions?
> Maybe this is something that the ALSA driver developers should be made
> aware of, but I thought I should ask about it here first.

A patch like below should make mpu_port=0 option working to disable
for the MIDI port.  Give it a try.


Takashi

diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 4bfab21c53f4..92610ab3290d 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738},"
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable switches */
-static long mpu_port[SNDRV_CARDS];
+static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
 static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
 static bool soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
 #ifdef SUPPORT_JOYSTICK
@@ -3132,7 +3132,8 @@ static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
 	if (cm->chip_version >= 39) {
 		val = snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1);
 		if (val != 0x00 && val != 0xff) {
-			iomidi = cm->iobase + CM_REG_MPU_PCI;
+			if (mpu_port[dev])
+				iomidi = cm->iobase + CM_REG_MPU_PCI;
 			integrated_midi = 1;
 		}
 	}


_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user



[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux