From patchwork Wed May 27 14:26:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 6490341 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 920B69F1C1 for ; Wed, 27 May 2015 14:26:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F6682066D for ; Wed, 27 May 2015 14:26:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1D590203A1 for ; Wed, 27 May 2015 14:26:40 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id AA2EE265CBB; Wed, 27 May 2015 16:26:38 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 202DF265AFC; Wed, 27 May 2015 16:26:31 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 35856265B04; Wed, 27 May 2015 16:26:29 +0200 (CEST) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 26714265AF3 for ; Wed, 27 May 2015 16:26:22 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C4C01ACEF; Wed, 27 May 2015 14:26:21 +0000 (UTC) Date: Wed, 27 May 2015 16:26:21 +0200 Message-ID: From: Takashi Iwai To: Adam Goode In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] OPL3 on cmipci doesn't survive suspend/resume X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }