[alsa-devel] OPL3 on cmipci doesn't survive suspend/resume

Takashi Iwai tiwai at suse.de
Wed May 27 16:26:21 CEST 2015


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;
 }


More information about the Alsa-devel mailing list