Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp813885pxb; Thu, 28 Jan 2021 00:17:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaaJ7NnYfvoaqMfgDQoVMunumk4XcY8TsHwzYknrknkTmExjGqMBWQ7aYrp3IAlJelyCny X-Received: by 2002:a05:6402:22a8:: with SMTP id cx8mr13139848edb.32.1611821860995; Thu, 28 Jan 2021 00:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611821860; cv=none; d=google.com; s=arc-20160816; b=AFbXACCDv9+bC1NcQ0dmsaMkR4Jid1utaOMFBk9se1sT7F5Q1ko+2lryADf13ricIc 8cWSUTLNHRIQYrR3L88SnX/ZOtCZDoXowdqHeff+Nv42kYs5qA/DcniKJgFN10nFk2IN HeHK3LVsyu0e3Mid6hM3vFxp52jwM9rfKq2oP01r6cDiVeo20LOdeIwEyS8FHQzvPD3v 32chMo7hT/50wbIIZ5H1orbHU1yLaY7L5Hs8dOe8Ke3vvYfAiDr14A6QTb2rUM6xJdbx yRCZ3hLYhAzPis4A4LHkUmFxxBLi4aCE+pL2Qyp+0IU5EV4pH/iJIYYkEAc4MSr4Gl76 Ntcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=npBoJHUyDIoP0AaWV09xjto53fPPvArZmQZUhrzQfTU=; b=0/2rA8vZSwT+30d3C03t9O0edss/gozo9MxeYXmYAreiWo8lv/zFqbUkFwo42GK7ch 5rytxSFst4RxOV00SWVVU8y7V+y5JUHwJBSLocqBu5STPyNTjGatuEAUc4jKTFKmnw5Z M+mxp4CgnrlBVOpuom1u3Q4ntx1OXeLzxKwQXb16Ihrsck9ZkJpslF3RCQETkt4Eq8LD ztjZ4WgF5FcpcQlqI9S9zKMwtJvlGjQO3Ugq9k975YHvko2u/A728W9ZSGpbzhuOd8DF 5HZCJNmvbd0hZaS1dRx36bZbJmImwID7gCJdpR2RZa+pThYLdX+daZetxzpvKG1QnOeD V0vw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com 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.17.16; Thu, 28 Jan 2021 00:17:40 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231545AbhA1IQL (ORCPT + 99 others); Thu, 28 Jan 2021 03:16:11 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:60799 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbhA1IQI (ORCPT ); Thu, 28 Jan 2021 03:16:08 -0500 Received: from mail-lj1-f197.google.com ([209.85.208.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l52Sb-0001ip-Nz for linux-kernel@vger.kernel.org; Thu, 28 Jan 2021 08:15:25 +0000 Received: by mail-lj1-f197.google.com with SMTP id d27so2677599ljo.12 for ; Thu, 28 Jan 2021 00:15:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=npBoJHUyDIoP0AaWV09xjto53fPPvArZmQZUhrzQfTU=; b=R5Tau1xQqacLbWcgBi3fFfNVRYJfFPbyAKCZKkF6wFAL40Vi7LpvLum7uC9baJNdHW 4S9WbvbaPIxMIFuI0KTZew7tp698SY2leBTSq/FdFhzlaNVvQEeOkeedTKYt9iTpRAoF sr6LHVGrCYF8F6hqtvyZnVazkG75dTE5SsQOnQEyB644IsSi6zfaA+7jjc0hNe7Vxvs/ MkGmK65tsxNBdbTF3HzeXnwtbbMcMGzFXz2eVuFyUHzyij2a6+AJYlFhFVQ0KKE3hzEt jfSyZKhZI6em7Pb7wjErVkXMmZASIdK6cROgpPA2hH5zA2CF9YeqD0jovVYYWyjluEj3 CDZg== X-Gm-Message-State: AOAM530wwkHxkWVhrw5oJDZxr6gmk4G5ABy8ZYOwPlDQrEjLUVMrTR24 m9HvRWvjoFTFrL6SmfwGRN37ZBfC//S7S6RZ3VsJUF29rwFvlsQuci7S33sY1yP98jDgrBCvHrY rDN+Ei9+rABMiSPhJ127dgkj8LZIh25yvz2oU4QtbBbM8+KDRsERTh1T8BA== X-Received: by 2002:a19:f707:: with SMTP id z7mr7251303lfe.548.1611821725183; Thu, 28 Jan 2021 00:15:25 -0800 (PST) X-Received: by 2002:a19:f707:: with SMTP id z7mr7251289lfe.548.1611821724911; Thu, 28 Jan 2021 00:15:24 -0800 (PST) MIME-Version: 1.0 References: <20201231060319.137133-1-kai.heng.feng@canonical.com> In-Reply-To: From: Kai-Heng Feng Date: Thu, 28 Jan 2021 16:15:10 +0800 Message-ID: Subject: Re: [PATCH] PM: sleep: core: Resume suspended device if direct-complete is disabled To: Takashi Iwai Cc: "Rafael J. Wysocki" , "Kenneth R . Crudup" , Pavel Machek , Len Brown , Greg Kroah-Hartman , "open list:HIBERNATION (aka Software Suspend, aka swsusp)" , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 28, 2021 at 4:09 PM Takashi Iwai wrote: > > 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? No it's not needed anymore because "ALSA: hda: Balance runtime/system PM if direct-complete is disabled" is in place. > > The description mentions about HD-audio controller, while the recent > revert was the HD-audio codec, so I suppose it's still affected? Not affected anymore if above mentioned patch is applied. Kai-Heng > > > 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 > >