From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00F76C433E0 for ; Thu, 31 Dec 2020 10:56:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1D79223C8 for ; Thu, 31 Dec 2020 10:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbgLaKzw (ORCPT ); Thu, 31 Dec 2020 05:55:52 -0500 Received: from mx2.suse.de ([195.135.220.15]:52870 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbgLaKzw (ORCPT ); Thu, 31 Dec 2020 05:55:52 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 897B2AE76; Thu, 31 Dec 2020 10:55:10 +0000 (UTC) Date: Thu, 31 Dec 2020 11:55:10 +0100 Message-ID: From: Takashi Iwai To: Kai-Heng Feng Cc: pierre-louis.bossart@linux.intel.com, lgirdwood@gmail.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, daniel.baluta@nxp.com, Mark Brown , Jaroslav Kysela , Takashi Iwai , Keyon Jie , Kuninori Morimoto , Marcin Rajwa , Payal Kshirsagar , sound-open-firmware@alsa-project.org (moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS), alsa-devel@alsa-project.org (moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...), linux-kernel@vger.kernel.org (open list) Subject: Re: [PATCH 2/2] ASoC: SOF: Intel: hda: Avoid checking jack on system suspend In-Reply-To: <20201229133817.190160-2-kai.heng.feng@canonical.com> References: <20201229133817.190160-1-kai.heng.feng@canonical.com> <20201229133817.190160-2-kai.heng.feng@canonical.com> 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/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 29 Dec 2020 14:38:15 +0100, Kai-Heng Feng wrote: > > System takes a very long time to suspend after commit 215a22ed31a1 > ("ALSA: hda: Refactor codec PM to use direct-complete optimization"): > [ 90.065964] PM: suspend entry (s2idle) > [ 90.067337] Filesystems sync: 0.001 seconds > [ 90.185758] Freezing user space processes ... (elapsed 0.002 seconds) done. > [ 90.188713] OOM killer disabled. > [ 90.188714] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. > [ 90.190024] printk: Suspending console(s) (use no_console_suspend to debug) > [ 90.904912] intel_pch_thermal 0000:00:12.0: CPU-PCH is cool [49C], continue to suspend > [ 321.262505] snd_hda_codec_realtek ehdaudio0D0: Unable to sync register 0x2b8000. -5 > [ 328.426919] snd_hda_codec_realtek ehdaudio0D0: Unable to sync register 0x2b8000. -5 > [ 329.490933] ACPI: EC: interrupt blocked > > That commit keeps codec suspended during the system suspend. However, > SOF driver's runtime resume, which is for system suspend, calls > hda_codec_jack_check() and schedules jackpoll_work. The jackpoll > work uses snd_hda_power_up_pm() which tries to resume the codec in > system suspend path, hence blocking the suspend process. > > So only check jack status if it's not in system PM process. After your previous patch set, the legacy HDA does queue the jackpoll_work only if jackpoll_interval is set. I suppose rather the same rule would be applied? thanks, Takashi > > Fixes: 215a22ed31a1 ("ALSA: hda: Refactor codec PM to use direct-complete optimization") > Signed-off-by: Kai-Heng Feng > --- > sound/soc/sof/intel/hda-dsp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c > index 7d00107cf3b2..1c5e05b88a90 100644 > --- a/sound/soc/sof/intel/hda-dsp.c > +++ b/sound/soc/sof/intel/hda-dsp.c > @@ -685,7 +685,8 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume) > /* check jack status */ > if (runtime_resume) { > hda_codec_jack_wake_enable(sdev, false); > - hda_codec_jack_check(sdev); > + if (sdev->system_suspend_target == SOF_SUSPEND_NONE) > + hda_codec_jack_check(sdev); > } > > /* turn off the links that were off before suspend */ > -- > 2.29.2 >