From: Takashi Iwai Subject: Re: [PATCH bugfix v3.4] ALSA: hda - fix "silence after S3" regression Date: Tue, 08 May 2012 15:25:30 +0200 Message-ID: References: <4FA91A27.3030801@openvz.org> <20120508130810.17396.27499.stgit@zurg> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id C8A0424421 for ; Tue, 8 May 2012 15:25:31 +0200 (CEST) In-Reply-To: <20120508130810.17396.27499.stgit@zurg> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Konstantin Khlebnikov Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, David Henningsson List-Id: alsa-devel@alsa-project.org At Tue, 08 May 2012 17:08:10 +0400, Konstantin Khlebnikov wrote: > > This fixes regression in shd-hda-codec after 785f857d1cb0856b612b46a0545b74aa2 > ("ALSA: hda - Set codec to D3 forcibly even if not used") > > hda_set_power_state() call must be explicitly protected against recursive > snd_hda_power_up/down() calls, otherwise it accidentally switches device into > D0 right before suspend. As result after resume sound device stays in D3 state > and does not works because driver believes that the device is on already. > > Signed-off-by: Konstantin Khlebnikov Hrm, does this really fix your problem? The path is called only during the suspend. Then, in the resume path, the codec is all powered up anyway. If the race between the leftover power-save work is really a culprit, the fix would be just calling cancel_delayed_work_sync() before that point... thanks, Takashi > --- > sound/pci/hda/hda_codec.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c > index 7a8fcc4..a0ea9d6 100644 > --- a/sound/pci/hda/hda_codec.c > +++ b/sound/pci/hda/hda_codec.c > @@ -5444,10 +5444,14 @@ int snd_hda_suspend(struct hda_bus *bus) > list_for_each_entry(codec, &bus->codec_list, list) { > if (hda_codec_is_power_on(codec)) > hda_call_codec_suspend(codec); > - else /* forcibly change the power to D3 even if not used */ > + else { > + /* forcibly change the power to D3 even if not used */ > + codec->power_transition = 1; > hda_set_power_state(codec, > codec->afg ? codec->afg : codec->mfg, > AC_PWRST_D3); > + codec->power_transition = 0; > + } > if (codec->patch_ops.post_suspend) > codec->patch_ops.post_suspend(codec); > } >