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.7 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=unavailable 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 54FFFC433E6 for ; Thu, 28 Jan 2021 08:12:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F019060C41 for ; Thu, 28 Jan 2021 08:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231744AbhA1IMV (ORCPT ); Thu, 28 Jan 2021 03:12:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:36610 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231428AbhA1IKl (ORCPT ); Thu, 28 Jan 2021 03:10:41 -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 2E3F2ABC4; Thu, 28 Jan 2021 08:09:59 +0000 (UTC) Date: Thu, 28 Jan 2021 09:09:59 +0100 Message-ID: From: Takashi Iwai To: Kai-Heng Feng Cc: rjw@rjwysocki.net, kenny@panix.com, Pavel Machek , Len Brown , Greg Kroah-Hartman , linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software Suspend, aka swsusp)), linux-kernel@vger.kernel.org (open list) Subject: Re: [PATCH] PM: sleep: core: Resume suspended device if direct-complete is disabled In-Reply-To: <20201231060319.137133-1-kai.heng.feng@canonical.com> References: <20201231060319.137133-1-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 Thu, 31 Dec 2020 07:03:19 +0100, Kai-Heng Feng wrote: > > HDA controller can't be runtime-suspended after commit 215a22ed31a1 > ("ALSA: hda: Refactor codjc PM to use direct-complete optimization"), > which enables direct-complete for HDA codec. > > The HDA codec driver doesn't expect direct-complete will be disabled > after it returns a positive value from prepare() callback. So freeze() > is called directly when it's runtime-suspended, breaks the balance of > its internal codec_powered counting. > > So if a device is prepared for direct-complete but PM core breaks the > assumption, resume the device to keep PM operations balanced. > > Fixes: 215a22ed31a1 ("ALSA: hda: Refactor codec PM to use direct-complete optimization") > Signed-off-by: Kai-Heng Feng Kai-Heng, is this fix still needed for 5.11? The description mentions about HD-audio controller, while the recent revert was the HD-audio codec, so I suppose it's still affected? thanks, Takashi > --- > drivers/base/power/main.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c > index 46793276598d..9c0e25a92ad0 100644 > --- a/drivers/base/power/main.c > +++ b/drivers/base/power/main.c > @@ -1849,6 +1849,10 @@ static int device_prepare(struct device *dev, pm_message_t state) > (ret > 0 || dev->power.no_pm_callbacks) && > !dev_pm_test_driver_flags(dev, DPM_FLAG_NO_DIRECT_COMPLETE); > spin_unlock_irq(&dev->power.lock); > + > + if (ret > 0 && !dev->power.direct_complete) > + pm_runtime_resume(dev); > + > return 0; > } > > -- > 2.29.2 >