Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp812750pxb; Thu, 28 Jan 2021 00:15:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyS+37Icejhf6FUfLyRRlcctbjwIu1KXYkOj6YdRpkbGWXIVtxNxueZfWH64Lz/2JmNM3KC X-Received: by 2002:a17:906:dbe7:: with SMTP id yd7mr10015861ejb.71.1611821731555; Thu, 28 Jan 2021 00:15:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611821731; cv=none; d=google.com; s=arc-20160816; b=txGrpUsPx28Ju5s9XZtacyJBlLnVh68MttgUHhzyCh+0R5oamRbfQsdUPBvOwHQ+AR eUPXTz00iqvOgsSOyiZ6/dwea/hjEmB6CypbADR5y/rnObasdxry86uej8w0wIOkL+rO RMnCD3BiVeNBZ0PnLr5jRHac+P7RKA6yXkHgigtXvMzrL1+eaFY76pT1MTkuuQ7nffv9 0/7BKAc5tFe82nuZjavDDAkrB1r1gkcvT4D22/Ql9C+4PpBeno4zProY4VWDiKLjGun5 fE9I2JGYLiFm7qCHZy1RtA2a4Q5sMKrj5NAP/HFlfJvJmCBaC2eetJuzUUTF7sKqM/1g oeYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=uiM1F99vSk91dWeZLGG2n4F9TUoYxTddHKAqJ6gcjW8=; b=pbcmxr/JpI57IvbHs8OXrsz9itYkl603RQxw4SVmfioZquLylXGzrj6bqfkUASka2G ZnfIEmk6l4AjS9JZDibiXvl1U4clJ0JDIr4Enmu0hUt5fZByAJ0/M3EKNOmimTP13ZUO hLRFPbI9NkkmAK7WkKd/uicEEP+JFmMRIUPls+ipse9/aNkwypw6KZ2rzMT6CAuyKgaQ XukSMl2+znMFE7ZMjZOu4xbrJhiCz6nDb63LXltCnyiep7rY60J3l1hPubpQELj16ZIr +ZVCo0GilzfCKsMfKIUgGgurq/ThiPdSaVPDUKCn/LFnU4waoaoFFPjqGScw0GL/ORhq 7uaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d27si2119822ejt.58.2021.01.28.00.15.06; Thu, 28 Jan 2021 00:15:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231410AbhA1IMM (ORCPT + 99 others); Thu, 28 Jan 2021 03:12:12 -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 >