← Back to team overview

kernel-packages team mailing list archive

[Bug 1328746] Re: Soundblaster Audigy front panel MIDI fails to initialize

 

** Description changed:

  This bug has been around for a while. I have seen it in the forums circa
  2007, and I have provided a solution in 2009. Since the modified code
  never found its way into the mainstream kernels, I am issuing the fix as
  a bug report.
  
  The bug concerns the Soundblaster Audigy cards with the emu10k1 chip in
  both i386 and amd64 architectures, in any kernel (standard, RT etc).
  They have on-board joystick MIDI. There is an optional front-panel
- module, which provides its own MIDI UART. Under Liunux, the front MIDI
- does not work. People wuth dual-boot systems have reported that booting
+ module, which provides its own MIDI UART. Under Linux, the front MIDI
+ does not work. People with dual-boot systems have reported that booting
  Windows first, then rebooting into Linux makes the UART function
  properly.
  
  The cause for the bug lies in the fact that the front panel MIDI is
  routed through a microcontroller (resides in the front panel module),
- and this microcontroller needs a defined reset signal. Up to this point,
- the GPIO _levels_ are initialized correctly, but the reset pulse is
- never issued.
+ and this microcontroller needs a defined reset signal once after power-
+ up. Up to this point, the GPIO _levels_ are initialized correctly, but
+ the reset _pulse_ is never issued. Essentially, the emu10k1 chip's GPIO2
+ needs to be pulled high for a brief interval.
  
  The bug can be fixed in the file linux-
  source-3.13.0/sound/pci/emu10k1/emumpu401.c in the function
  snd_emu10k1_audigy_midi(). The proposed patch follows right after the
- present initialization of the second UART:
- 
+ present initialization of the second UART (note the added variable "val"
+ to store the GPIO bits):
  
  int snd_emu10k1_audigy_midi(struct snd_emu10k1 *emu)
  {
- 	struct snd_emu10k1_midi *midi;
- 	int err;
- 	unsigned int val;		/* Needed in GPOUT2 pulse initialization */
+  struct snd_emu10k1_midi *midi;
+  int err;
+  unsigned int val;		/* Needed in GPOUT2 pulse initialization */
  
- 	midi = &emu->midi;
- 	if ((err = emu10k1_midi_init(emu, midi, 0, "Audigy MPU-401 (UART)")) < 0)
- 		return err;
+  midi = &emu->midi;
+  if ((err = emu10k1_midi_init(emu, midi, 0, "Audigy MPU-401 (UART)")) < 0)
+   return err;
  
- 	midi->tx_enable = INTE_MIDITXENABLE;
- 	midi->rx_enable = INTE_MIDIRXENABLE;
- 	midi->port = A_MUDATA1;
- 	midi->ipr_tx = IPR_MIDITRANSBUFEMPTY;
- 	midi->ipr_rx = IPR_MIDIRECVBUFEMPTY;
- 	midi->interrupt = snd_emu10k1_midi_interrupt;
+  midi->tx_enable = INTE_MIDITXENABLE;
+  midi->rx_enable = INTE_MIDIRXENABLE;
+  midi->port = A_MUDATA1;
+  midi->ipr_tx = IPR_MIDITRANSBUFEMPTY;
+  midi->ipr_rx = IPR_MIDIRECVBUFEMPTY;
+  midi->interrupt = snd_emu10k1_midi_interrupt;
  
- 	midi = &emu->midi2;
- 	if ((err = emu10k1_midi_init(emu, midi, 1, "Audigy MPU-401 #2")) < 0)
- 		return err;
+  midi = &emu->midi2;
+  if ((err = emu10k1_midi_init(emu, midi, 1, "Audigy MPU-401 #2")) < 0)
+   return err;
  
- 	midi->tx_enable = INTE_A_MIDITXENABLE2;
- 	midi->rx_enable = INTE_A_MIDIRXENABLE2;
- 	midi->port = A_MUDATA2;
- 	midi->ipr_tx = IPR_A_MIDITRANSBUFEMPTY2;
- 	midi->ipr_rx = IPR_A_MIDIRECVBUFEMPTY2;
- 	midi->interrupt = snd_emu10k1_midi_interrupt2;
+  midi->tx_enable = INTE_A_MIDITXENABLE2;
+  midi->rx_enable = INTE_A_MIDIRXENABLE2;
+  midi->port = A_MUDATA2;
+  midi->ipr_tx = IPR_A_MIDITRANSBUFEMPTY2;
+  midi->ipr_rx = IPR_A_MIDIRECVBUFEMPTY2;
+  midi->interrupt = snd_emu10k1_midi_interrupt2;
  
-         /*** NEW CODE ***  Pulse reset line for the second UART */
+  /*** NEW CODE ***  Pulse reset line for the second UART */
  
- 	val = inl(emu->port + A_IOCFG);
- 	outl (val | A_IOCFG_GPOUT2, emu->port + A_IOCFG);
- 	udelay(10);		/* udelay is a bad kludge, but remember that this is called only once on startup */
- 	outl (val, emu->port + A_IOCFG);
+  val = inl(emu->port + A_IOCFG);
+  outl (val | A_IOCFG_GPOUT2, emu->port + A_IOCFG);
+  udelay(10);		/* udelay is a bad kludge, but remember that this is called only once on startup */
+  outl (val, emu->port + A_IOCFG);
  
- 	return 0;
+  return 0;
  }
  
- 
- I suspect that my use of udelay would make a real kernel hacker cringe, but the level of GPOUT2 needs to remain high for a few microseconds to provide a stable RESET signal.
+ I suspect that my use of udelay would make a real kernel hacker cringe,
+ but the level of GPOUT2 needs to remain high for a few microseconds to
+ provide a stable RESET signal.
  
  Anyway, this fixes the problem. I have applied the patch for pretty much
  every major upgrade of the kernel. It is sufficient to compile the
  module snd-emu10k1.ko and replace it in the module tree.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1328746

Title:
  Soundblaster Audigy front panel MIDI fails to initialize

Status in “linux” package in Ubuntu:
  Incomplete

Bug description:
  This bug has been around for a while. I have seen it in the forums
  circa 2007, and I have provided a solution in 2009. Since the modified
  code never found its way into the mainstream kernels, I am issuing the
  fix as a bug report.

  The bug concerns the Soundblaster Audigy cards with the emu10k1 chip
  in both i386 and amd64 architectures, in any kernel (standard, RT
  etc). They have on-board joystick MIDI. There is an optional front-
  panel module, which provides its own MIDI UART. Under Linux, the front
  MIDI does not work. People with dual-boot systems have reported that
  booting Windows first, then rebooting into Linux makes the UART
  function properly.

  The cause for the bug lies in the fact that the front panel MIDI is
  routed through a microcontroller (resides in the front panel module),
  and this microcontroller needs a defined reset signal once after
  power-up. Up to this point, the GPIO _levels_ are initialized
  correctly, but the reset _pulse_ is never issued. Essentially, the
  emu10k1 chip's GPIO2 needs to be pulled high for a brief interval.

  The bug can be fixed in the file linux-
  source-3.13.0/sound/pci/emu10k1/emumpu401.c in the function
  snd_emu10k1_audigy_midi(). The proposed patch follows right after the
  present initialization of the second UART (note the added variable
  "val" to store the GPIO bits):

  int snd_emu10k1_audigy_midi(struct snd_emu10k1 *emu)
  {
   struct snd_emu10k1_midi *midi;
   int err;
   unsigned int val;		/* Needed in GPOUT2 pulse initialization */

   midi = &emu->midi;
   if ((err = emu10k1_midi_init(emu, midi, 0, "Audigy MPU-401 (UART)")) < 0)
    return err;

   midi->tx_enable = INTE_MIDITXENABLE;
   midi->rx_enable = INTE_MIDIRXENABLE;
   midi->port = A_MUDATA1;
   midi->ipr_tx = IPR_MIDITRANSBUFEMPTY;
   midi->ipr_rx = IPR_MIDIRECVBUFEMPTY;
   midi->interrupt = snd_emu10k1_midi_interrupt;

   midi = &emu->midi2;
   if ((err = emu10k1_midi_init(emu, midi, 1, "Audigy MPU-401 #2")) < 0)
    return err;

   midi->tx_enable = INTE_A_MIDITXENABLE2;
   midi->rx_enable = INTE_A_MIDIRXENABLE2;
   midi->port = A_MUDATA2;
   midi->ipr_tx = IPR_A_MIDITRANSBUFEMPTY2;
   midi->ipr_rx = IPR_A_MIDIRECVBUFEMPTY2;
   midi->interrupt = snd_emu10k1_midi_interrupt2;

   /*** NEW CODE ***  Pulse reset line for the second UART */

   val = inl(emu->port + A_IOCFG);
   outl (val | A_IOCFG_GPOUT2, emu->port + A_IOCFG);
   udelay(10);		/* udelay is a bad kludge, but remember that this is called only once on startup */
   outl (val, emu->port + A_IOCFG);

   return 0;
  }

  I suspect that my use of udelay would make a real kernel hacker
  cringe, but the level of GPOUT2 needs to remain high for a few
  microseconds to provide a stable RESET signal.

  Anyway, this fixes the problem. I have applied the patch for pretty
  much every major upgrade of the kernel. It is sufficient to compile
  the module snd-emu10k1.ko and replace it in the module tree.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1328746/+subscriptions


References