linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: bhelgaas@google.com
Cc: Aaron Ma <aaron.ma@canonical.com>,
	Kai-Heng Feng <kai.heng.feng@canonical.com>,
	linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 2/3] PCI: Set AMD Renoir USB controller to D3 when shutdown
Date: Fri, 26 Feb 2021 01:40:39 +0800	[thread overview]
Message-ID: <20210225174041.405739-2-kai.heng.feng@canonical.com> (raw)
In-Reply-To: <20210225174041.405739-1-kai.heng.feng@canonical.com>

From: Aaron Ma <aaron.ma@canonical.com>

On AMD Renoir/Cezanne platforms, when set "Always on USB" to "On" in BIOS,
USB controller will consume more power than 0.03w.

Set it to D3cold when shutdown, S5 power consumption will be 0.03w lower.
The USB can charge other devices as before.
USB controller works fine after power on and reboot.

Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/pci/quirks.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 1f94fafc6920..0a848ef0b7db 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -28,6 +28,7 @@
 #include <linux/platform_data/x86/apple.h>
 #include <linux/pm_runtime.h>
 #include <linux/switchtec.h>
+#include <linux/kexec.h>
 #include <asm/dma.h>	/* isa_dma_bridge_buggy */
 #include "pci.h"
 
@@ -5619,3 +5620,10 @@ static void apex_pci_fixup_class(struct pci_dev *pdev)
 }
 DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a,
 			       PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
+
+static void pci_fixup_shutdown_d3(struct pci_dev *pdev)
+{
+	if (!kexec_in_progress)
+		pci_set_power_state(pdev, PCI_D3cold);
+}
+DECLARE_PCI_FIXUP_SHUTDOWN(PCI_VENDOR_ID_AMD, 0x1639, pci_fixup_shutdown_d3);
-- 
2.30.0


  reply	other threads:[~2021-02-25 17:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25 17:40 [PATCH 1/3] PCI: Introduce quirk hook after driver shutdown callback Kai-Heng Feng
2021-02-25 17:40 ` Kai-Heng Feng [this message]
2021-02-25 17:40 ` [PATCH 3/3] PCI: Convert rtw88 power cycle quirk to shutdown quirk Kai-Heng Feng
2021-02-26  7:12   ` Kalle Valo
2021-02-26 12:10     ` Heiner Kallweit
2021-02-26 12:18       ` Kai-Heng Feng
2021-02-26 13:31         ` Heiner Kallweit
2021-02-26 13:40           ` Kalle Valo
2021-02-26 18:16           ` Bjorn Helgaas
2021-03-04  6:07             ` Kai-Heng Feng
2021-03-04 16:02               ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210225174041.405739-2-kai.heng.feng@canonical.com \
    --to=kai.heng.feng@canonical.com \
    --cc=aaron.ma@canonical.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).