From patchwork Tue Dec 8 09:29:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 340965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EA9DC433FE for ; Tue, 8 Dec 2020 09:31:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CDCCA23A81 for ; Tue, 8 Dec 2020 09:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728192AbgLHJbH (ORCPT ); Tue, 8 Dec 2020 04:31:07 -0500 Received: from mga06.intel.com ([134.134.136.31]:9877 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727647AbgLHJbH (ORCPT ); Tue, 8 Dec 2020 04:31:07 -0500 IronPort-SDR: 7cJc4MpzznhSIZrEuyPD8IhYzBdaDQtitaYSUcqbVl7sVkE8CL288QjBzvuuWoUJMDDILv9b/6 STPqQBqtjYaw== X-IronPort-AV: E=McAfee;i="6000,8403,9828"; a="235460689" X-IronPort-AV: E=Sophos;i="5.78,402,1599548400"; d="scan'208";a="235460689" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 01:28:04 -0800 IronPort-SDR: oPaoZGDOzrTnZkayFGkNfnOVN5EKyxMuEaANrejIGzvPvJyyEaLT+2K4T2EV43zZIeSJkyr2JS 0igSbsO4w4oQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,402,1599548400"; d="scan'208";a="552165902" Received: from mattu-haswell.fi.intel.com ([10.237.72.170]) by orsmga005.jf.intel.com with ESMTP; 08 Dec 2020 01:28:02 -0800 From: Mathias Nyman To: Cc: , Hans de Goede , stable@vger.kernel.org, Mika Westerberg , Mathias Nyman Subject: [PATCH 3/5] xhci-pci: Allow host runtime PM as default for Intel Alpine Ridge LP Date: Tue, 8 Dec 2020 11:29:10 +0200 Message-Id: <20201208092912.1773650-4-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201208092912.1773650-1-mathias.nyman@linux.intel.com> References: <20201208092912.1773650-1-mathias.nyman@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hans de Goede The xHCI controller on Alpine Ridge LP keeps the whole Thunderbolt controller awake if the host controller is not allowed to sleep. This is the case even if no USB devices are connected to the host. Add the Intel Alpine Ridge LP product-id to the list of product-ids for which we allow runtime PM by default. Fixes: 2815ef7fe4d4 ("xhci-pci: allow host runtime PM as default for Intel Alpine and Titan Ridge") Cc: Reviewed-by: Mika Westerberg Signed-off-by: Hans de Goede Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index bf89172c43ca..5f94d7edeb37 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -47,6 +47,7 @@ #define PCI_DEVICE_ID_INTEL_DNV_XHCI 0x19d0 #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI 0x15b5 #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI 0x15b6 +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI 0x15c1 #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI 0x15db #define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI 0x15d4 #define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI 0x15e9 @@ -232,6 +233,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) if (pdev->vendor == PCI_VENDOR_ID_INTEL && (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI || + pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_XHCI || From patchwork Tue Dec 8 09:29:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathias Nyman X-Patchwork-Id: 340339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03ACFC4167B for ; Tue, 8 Dec 2020 09:31:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C851823A81 for ; Tue, 8 Dec 2020 09:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728710AbgLHJbL (ORCPT ); Tue, 8 Dec 2020 04:31:11 -0500 Received: from mga06.intel.com ([134.134.136.31]:9885 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727745AbgLHJbK (ORCPT ); Tue, 8 Dec 2020 04:31:10 -0500 IronPort-SDR: ParJaAwdKAH4TQOijb1YOiGowubC6P9+zAgYbHgjPDzJNg2hYB2FVmfaPYr7ztIcLYGWKaCa1u l9G4YqC2JXGg== X-IronPort-AV: E=McAfee;i="6000,8403,9828"; a="235460694" X-IronPort-AV: E=Sophos;i="5.78,402,1599548400"; d="scan'208";a="235460694" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 01:28:07 -0800 IronPort-SDR: LPAtSp8n01TZ0SQxsUNIICc9+Z+1evzMwfxRR7PtH5KdJhlb64yQX/X8/R2f1FQZ2KzJetFY6v GA+dLTQ8Cukg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,402,1599548400"; d="scan'208";a="552165913" Received: from mattu-haswell.fi.intel.com ([10.237.72.170]) by orsmga005.jf.intel.com with ESMTP; 08 Dec 2020 01:28:05 -0800 From: Mathias Nyman To: Cc: , Li Jun , stable@vger.kernel.org, Mathias Nyman Subject: [PATCH 5/5] xhci: Give USB2 ports time to enter U3 in bus suspend Date: Tue, 8 Dec 2020 11:29:12 +0200 Message-Id: <20201208092912.1773650-6-mathias.nyman@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201208092912.1773650-1-mathias.nyman@linux.intel.com> References: <20201208092912.1773650-1-mathias.nyman@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Li Jun If a USB2 device wakeup is not enabled/supported the link state may still be in U0 in xhci_bus_suspend(), where it's then manually put to suspended U3 state. Just as with selective suspend the device needs time to enter U3 suspend before continuing with further suspend operations (e.g. system suspend), otherwise we may enter system suspend with link state in U0. [commit message rewording -Mathias] Cc: Signed-off-by: Li Jun Signed-off-by: Mathias Nyman --- drivers/usb/host/xhci-hub.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index c799ca5361d4..74c497fd3476 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -1712,6 +1712,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd) hcd->state = HC_STATE_SUSPENDED; bus_state->next_statechange = jiffies + msecs_to_jiffies(10); spin_unlock_irqrestore(&xhci->lock, flags); + + if (bus_state->bus_suspended) + usleep_range(5000, 10000); + return 0; }