Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1199884ybl; Wed, 28 Aug 2019 11:04:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUXVEZjETxJHhi3Y3MgRB+QRwqp/m+UvL7+ipKwljfxkdrko++RX++fC/RxCeTQeYZ4dc5 X-Received: by 2002:a63:a302:: with SMTP id s2mr4585505pge.125.1567015459285; Wed, 28 Aug 2019 11:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567015459; cv=none; d=google.com; s=arc-20160816; b=fRPuEs+SO44A3J6npp3OE9OUGKCFoWH8CZuYB3nt3ZIruX7aXJqMZTza8Gnt3pUtcv 0AYzH5WRSF9E9agVbF/1nU3toAzpV6ju1KyXF3izwV+ON+xc2bQox77nqb7i89wNAWd3 KiIKSHAyLxna9S8UPtkOkrk3q7CVmzZVKuJtRY/eXnf4a8DWYJZ8AiphI1X0fHRBXvfM SoqryP8mO+p4NqZx5Q5QUCySBD2SBwWKPqqC2ofd3q8Xhcl/2yjlVRb/f+N/kDTi2adW PSqk8+4jWe8B485QZI0F62A3BaR1tFrMCBQooHjJfVu7AuLtPXIRCR584JYSjaf56Yfn 9lmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lt4gfkmyPnmsCcdGGWfWDsLq/8wrjnNT1xJU+aJ5Y1k=; b=NUW7oB2Ni1eHpjvNViOMGTWeCN7/Pk8DPCW5Py/rJOcisPAbi8iZJscR7YhNvV06EX UmIv6RlR8FExIBuavINDbR2NsnSJlN53PbfpB+fd8WcX9Lt8sto1eqePvDGUaofs8pPH RfAz9nvejpDya6jNmLL+uLkWM1SLK7QbFVwLF+46o6oDmXkO3PCpdzry+pCeonTW6pua k+PQG1FvWgYoyS0unva26chEFLPueDaPlOjOrIAJ8meiUrUFnOJyzY26OL+td62UtLHE Syu+LrOwnsVnZtZqZtdaYeyq0oP/zmKEDcIHjmfZvJVycu3phQpQ5O6RaZRqw3yl82sL GG2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id o185si3255185pfb.206.2019.08.28.11.04.01; Wed, 28 Aug 2019 11:04:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727007AbfH1SBi (ORCPT + 99 others); Wed, 28 Aug 2019 14:01:38 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51841 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726725AbfH1SBi (ORCPT ); Wed, 28 Aug 2019 14:01:38 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1i32GF-0007ef-An; Wed, 28 Aug 2019 18:01:35 +0000 From: Kai-Heng Feng To: bhelgaas@google.com, tiwai@suse.com Cc: linux-pci@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Kai-Heng Feng Subject: [PATCH v2 2/2] ALSA: hda: Allow HDA to be runtime suspended when dGPU is not bound Date: Thu, 29 Aug 2019 02:01:28 +0800 Message-Id: <20190828180128.1732-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827134756.10807-2-kai.heng.feng@canonical.com> References: <20190827134756.10807-2-kai.heng.feng@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's a common practice to let dGPU unbound and use PCI platform power management to disable its power through _OFF method of power resource, which is listed by _PR3. When the dGPU comes with an HDA function, the HDA won't be suspended if the dGPU is unbound, so the power resource can't be turned off. Commit 37a3a98ef601 ("ALSA: hda - Enable runtime PM only for discrete GPU") only allows HDA to be runtime-suspended once GPU is bound, to keep APU's HDA working. However, HDA on dGPU isn't that useful if dGPU is unbound. So let's relax the runtime suspend requirement for dGPU's HDA function, to save lots of power. BugLink: https://bugs.launchpad.net/bugs/1840835 Fixes: b516ea586d71 ("PCI: Enable NVIDIA HDA controllers”) Signed-off-by: Kai-Heng Feng --- v2: - Change wording. - Rebase to Tiwai's branch. sound/pci/hda/hda_intel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 91e71be42fa4..c3654d22795a 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1284,7 +1284,11 @@ static void init_vga_switcheroo(struct azx *chip) dev_info(chip->card->dev, "Handle vga_switcheroo audio client\n"); hda->use_vga_switcheroo = 1; - chip->bus.keep_power = 1; /* cleared in either gpu_bound op or codec probe */ + + /* cleared in either gpu_bound op or codec probe, or when its + * root port has _PR3 (i.e. dGPU). + */ + chip->bus.keep_power = !pci_pr3_present(p); chip->driver_caps |= AZX_DCAPS_PM_RUNTIME; pci_dev_put(p); } -- 2.17.1