[alsa-devel] OPL3 on cmipci doesn't survive suspend/resume
Hi,
I have this card:
05:00.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10) Subsystem: C-Media Electronics Inc CMI8738/C3DX PCI Audio Device Flags: bus master, stepping, medium devsel, latency 32, IRQ 19 I/O ports at d000 [size=256] Capabilities: [c0] Power Management version 2 Kernel driver in use: snd_cmipci Kernel modules: snd_cmipci
When I suspend/resume, the sound from the OPL3 is permanently distorted. It sounds like not all of the operators are active. I can fix this by doing a full PCI remove/rescan cycle: the driver correctly initializes the card at this time.
Any ideas before I peek into the code?
Thanks,
Adam
At Wed, 27 May 2015 09:23:17 -0400, Adam Goode wrote:
Hi,
I have this card:
05:00.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10) Subsystem: C-Media Electronics Inc CMI8738/C3DX PCI Audio Device Flags: bus master, stepping, medium devsel, latency 32, IRQ 19 I/O ports at d000 [size=256] Capabilities: [c0] Power Management version 2 Kernel driver in use: snd_cmipci Kernel modules: snd_cmipci
When I suspend/resume, the sound from the OPL3 is permanently distorted. It sounds like not all of the operators are active. I can fix this by doing a full PCI remove/rescan cycle: the driver correctly initializes the card at this time.
Any ideas before I peek into the code?
OPL3 stuff lacks of PM code completely. Maybe calling snd_opl3_init() again should enable the minimal stuff. Drum and voice patches might be reloaded, too.
Takashi
Thanks,
Adam _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Wed, 27 May 2015 15:31:02 +0200, Takashi Iwai wrote:
At Wed, 27 May 2015 09:23:17 -0400, Adam Goode wrote:
Hi,
I have this card:
05:00.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10) Subsystem: C-Media Electronics Inc CMI8738/C3DX PCI Audio Device Flags: bus master, stepping, medium devsel, latency 32, IRQ 19 I/O ports at d000 [size=256] Capabilities: [c0] Power Management version 2 Kernel driver in use: snd_cmipci Kernel modules: snd_cmipci
When I suspend/resume, the sound from the OPL3 is permanently distorted. It sounds like not all of the operators are active. I can fix this by doing a full PCI remove/rescan cycle: the driver correctly initializes the card at this time.
Any ideas before I peek into the code?
OPL3 stuff lacks of PM code completely. Maybe calling snd_opl3_init() again should enable the minimal stuff.
That said, a patch like below. The whole synth setup still needs to be reset, I suppose.
Takashi
--- diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 6cf464d9043d..f03fd5f2e043 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -498,6 +498,8 @@ struct cmipci { /* external MIDI */ struct snd_rawmidi *rmidi;
+ struct snd_opl3 *opl3; + #ifdef SUPPORT_JOYSTICK struct gameport *gameport; #endif @@ -3005,6 +3007,7 @@ static int snd_cmipci_create_fm(struct cmipci *cm, long fm_port) dev_err(cm->card->dev, "cannot create OPL3 hwdep\n"); return err; } + cm->opl3 = opl3; return 0;
disable_fm: @@ -3386,6 +3389,8 @@ static int snd_cmipci_resume(struct device *dev) for (i = 0; i < ARRAY_SIZE(saved_mixers); i++) snd_cmipci_mixer_write(cm, saved_mixers[i], cm->saved_mixers[i]);
+ if (cm->opl3) + snd_opl3_init(cm->opl3); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; }
On Wed, May 27, 2015 at 10:26 AM, Takashi Iwai tiwai@suse.de wrote:
At Wed, 27 May 2015 15:31:02 +0200, Takashi Iwai wrote:
At Wed, 27 May 2015 09:23:17 -0400, Adam Goode wrote:
Hi,
I have this card:
05:00.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10) Subsystem: C-Media Electronics Inc CMI8738/C3DX PCI Audio Device Flags: bus master, stepping, medium devsel, latency 32, IRQ 19 I/O ports at d000 [size=256] Capabilities: [c0] Power Management version 2 Kernel driver in use: snd_cmipci Kernel modules: snd_cmipci
When I suspend/resume, the sound from the OPL3 is permanently distorted. It sounds like not all of the operators are active. I can fix this by doing a full PCI remove/rescan cycle: the driver correctly initializes the card at this time.
Any ideas before I peek into the code?
OPL3 stuff lacks of PM code completely. Maybe calling snd_opl3_init() again should enable the minimal stuff.
That said, a patch like below. The whole synth setup still needs to be reset, I suppose.
Takashi
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 6cf464d9043d..f03fd5f2e043 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -498,6 +498,8 @@ struct cmipci { /* external MIDI */ struct snd_rawmidi *rmidi;
struct snd_opl3 *opl3;
#ifdef SUPPORT_JOYSTICK struct gameport *gameport; #endif @@ -3005,6 +3007,7 @@ static int snd_cmipci_create_fm(struct cmipci *cm, long fm_port) dev_err(cm->card->dev, "cannot create OPL3 hwdep\n"); return err; }
cm->opl3 = opl3; return 0;
disable_fm:
@@ -3386,6 +3389,8 @@ static int snd_cmipci_resume(struct device *dev) for (i = 0; i < ARRAY_SIZE(saved_mixers); i++) snd_cmipci_mixer_write(cm, saved_mixers[i], cm->saved_mixers[i]);
if (cm->opl3)
snd_opl3_init(cm->opl3); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0;
}
Yes, it is better with this patch. I still get the same distorted sounds after resume, but a subsequent sbiload will restore the instruments correctly. Before the patch, sbiload had no effect and I had to remove/rescan the card..
Ideally, suspend/resume would restore the patches so that sbiload would not be necessary. But this is exactly as urgent as it seems. :)
Thanks,
Adam
On Wed, 27 May 2015, Adam Goode wrote:
05:00.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10) ...
When I suspend/resume, the sound from the OPL3 is permanently distorted. It sounds like not all of the operators are active. I can fix this by doing a full PCI remove/rescan cycle: the driver correctly initializes the card at this time.
Any ideas before I peek into the code?
Not really, except that it is a very old card by now. No real work has been done in the driver for many years.
(I still have one around in an ancient Linux box, for its S/PDIF capability (for which it was very good value for money in its day).)
/Ricard
On Wed, May 27, 2015 at 9:31 AM, Ricard Wanderlof ricard.wanderlof@axis.com wrote:
On Wed, 27 May 2015, Adam Goode wrote:
05:00.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 PCI Audio (rev 10) ...
When I suspend/resume, the sound from the OPL3 is permanently distorted. It sounds like not all of the operators are active. I can fix this by doing a full PCI remove/rescan cycle: the driver correctly initializes the card at this time.
Any ideas before I peek into the code?
Not really, except that it is a very old card by now. No real work has been done in the driver for many years.
(I still have one around in an ancient Linux box, for its S/PDIF capability (for which it was very good value for money in its day).)
Thanks! I'm surprised it works at all.
I have this card, which is still in production (and with a gameport + MIDI UART even!): http://www.amazon.com/gp/product/B001KUSYSO
Adam
On Wed, 27 May 2015, Adam Goode wrote:
Any ideas before I peek into the code?
Not really, except that it is a very old card by now. No real work has been done in the driver for many years.
(I still have one around in an ancient Linux box, for its S/PDIF capability (for which it was very good value for money in its day).)
Thanks! I'm surprised it works at all.
I have this card, which is still in production (and with a gameport + MIDI UART even!): http://www.amazon.com/gp/product/B001KUSYSO
The one I have is a Zoltrix Nightingale Pro6 which has the digital I/O (S/PDIF coax and TOSLINK) on a separate sister card. http://www.zoltrix.com/products/audio/8SB87386CHGMX.htm
I agree it's amazing that the driver still works (although the box in question still runs Debian Squeeze so I haven't kept up to date with anything that's happened since then).
I have a patch that fixes some issue with using the S/PDIF port for digital stereo I/O, but I fear it is not mergable as I think it would break applications which use the upsteam version.
(Getting far off OPL3 land here. Sorry. I've never used the OPL3 synth in the chip).
/Ricard
participants (3)
-
Adam Goode
-
Ricard Wanderlof
-
Takashi Iwai