[RFC 1/3] thunderbolt: Allow XHCI device links to enter runtime pm

From: Mario Limonciello
Date: Tue Oct 04 2022 - 00:13:19 EST


Both on Intel's and AMD's USB4 designs it's important that the device
link to the XHCI controller used for tunneling is able to go into D3
for appropriate low power consumption features as well as for system
suspend states such as s0i3.

Historically this is accomplished by adding to a hardcoded list in the
XHCI driver, but this requires a change for every single platform.

We have a very good proxy that it's safe to do this since the firmware
has indicated the device link needs to be made. So opt all XHCI
controllers with these device links into runtime PM.

Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
---
drivers/thunderbolt/acpi.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/thunderbolt/acpi.c b/drivers/thunderbolt/acpi.c
index b1f0dc8df47cd..5ffca085a47e3 100644
--- a/drivers/thunderbolt/acpi.c
+++ b/drivers/thunderbolt/acpi.c
@@ -75,6 +75,9 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,
pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM))) {
const struct device_link *link;

+ if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI)
+ pm_runtime_allow(&pdev->dev);
+
/*
* Make them both active first to make sure the NHI does
* not runtime suspend before the consumer. The
--
2.34.1