Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp270140ybg; Tue, 9 Jun 2020 23:47:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOWb9q61YVSFnW1D9VgJdcavZ07CzEMx3Q1KVo3+wLXsONcfircBvT4DQ9yJ4l2iwOtq8e X-Received: by 2002:a50:e881:: with SMTP id f1mr1199365edn.98.1591771631854; Tue, 09 Jun 2020 23:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591771631; cv=none; d=google.com; s=arc-20160816; b=VgCAsqSkSZtGkaspIQ/1ehFwkDomi635y85tl32uXiLK9s8ATryZyfMyxkVlsgetbi MU0f/xVMXhngutpwYTR4OwuVr7/90VrbIMAUegXCiSIjc2Syjz4edBWL8h5rBCtvMns1 FXllVCoyZbKPoYkcEax1m/AlRduqhxDbYxGrblv7lkA8/vwmSMOcykdm2bRX6F5YDhEJ mXrJ3mqD/ZE6SmnriID9dITjfexUP3hf3e7P8arn2iAp3qSoH7YcQmrqVCWl8oObT+k/ 44kBPrJgHnSOpdeiFxyD84MBJBMeEO+TvnHyIKC+jmeqJKNOV9hSjrv+4cq17235J33n wMRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=DM4Gb5N7225jvKzN/PmYueM8xVad7xmKd3mHeHjF2vk=; b=tKmDtZWy0Te5r6s6l9cBD2VxQUOBnha6gXo2ArU6FTrgko4Y2LMJULoblPkbLjfO38 C+op03Sw15Owg06r3Z63pP43mJ88hlpO8Na4T2/Z6Y6QJHjkmzigXcmBSnISbI9mpGPR m8eJq14vNe9+GlByvrdtS5bC7HzfJePusH570m0xoIZ57dyAzuhEppN9xVMxWs9xhn5n 1u/hWMdJxfaEcbeGo9Ye4vzqNsV3pKpxbyfCzY10CwzLT46LjvhXQi5WLRLcsfEpOrnD LABMDfPFLvnwiDC/1sjaq6EKLcjAMbECpAaPZ10GXzA1vFHeJ9clgWz2Rprl/tLCidYP tgxA== 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 o19si11847265eja.256.2020.06.09.23.46.49; Tue, 09 Jun 2020 23:47:11 -0700 (PDT) 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 S1726262AbgFJGm5 (ORCPT + 99 others); Wed, 10 Jun 2020 02:42:57 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:51362 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbgFJGm5 (ORCPT ); Wed, 10 Jun 2020 02:42:57 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jiuRd-0001Sn-96; Wed, 10 Jun 2020 06:42:42 +0000 From: Kai-Heng Feng To: mathias.nyman@intel.com Cc: Kai-Heng Feng , Greg Kroah-Hartman , Alan Stern , Eugeniu Rosca , Qi Zhou , Hardik Gajjar , Keiya Nobuta , Jason Yan , David Heinzelmann , linux-usb@vger.kernel.org (open list:USB SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/2] USB: hub: Suspend and resume port with LPM enabled Date: Wed, 10 Jun 2020 14:42:31 +0800 Message-Id: <20200610064231.9454-2-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200610064231.9454-1-kai.heng.feng@canonical.com> References: <20200610064231.9454-1-kai.heng.feng@canonical.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org USB2 devices with LPM enabled may interrupt the system suspend: [ 932.510475] usb 1-7: usb suspend, wakeup 0 [ 932.510549] hub 1-0:1.0: hub_suspend [ 932.510581] usb usb1: bus suspend, wakeup 0 [ 932.510590] xhci_hcd 0000:00:14.0: port 9 not suspended [ 932.510593] xhci_hcd 0000:00:14.0: port 8 not suspended .. [ 932.520323] xhci_hcd 0000:00:14.0: Port change event, 1-7, id 7, portsc: 0x400e03 .. [ 932.591405] PM: pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16 [ 932.591414] PM: dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -16 [ 932.591418] PM: Device 0000:00:14.0 failed to suspend async: error -16 During system suspend, USB core will let HC suspends the device if it doesn't have remote wakeup enabled and doesn't have any children. However, from the log above we can see that the usb 1-7 doesn't get bus suspended due to not in U0, because it requires a longer period for disabling LPM. After a while the port finished its U2 -> U0 transition, interrupts the suspend process. Though PLC shouldn't be set for U2 -> U0 case, we can avoid all that by directly put the port from U0/U1/U2 to U3, and solves this issue. Suggested-by: Mathias Nyman Signed-off-by: Kai-Heng Feng --- drivers/usb/core/hub.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b1e14beaac5f..882b54df6ef5 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3285,9 +3285,6 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) } } - /* disable USB2 hardware LPM */ - usb_disable_usb2_hardware_lpm(udev); - if (usb_disable_ltm(udev)) { dev_err(&udev->dev, "Failed to disable LTM before suspend\n"); status = -ENOMEM; @@ -3323,9 +3320,6 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) /* Try to enable USB3 LTM again */ usb_enable_ltm(udev); err_ltm: - /* Try to enable USB2 hardware LPM again */ - usb_enable_usb2_hardware_lpm(udev); - if (udev->do_remote_wakeup) (void) usb_disable_remote_wakeup(udev); err_wakeup: @@ -3606,9 +3600,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) dev_dbg(&udev->dev, "can't resume, status %d\n", status); hub_port_logical_disconnect(hub, port1); } else { - /* Try to enable USB2 hardware LPM */ - usb_enable_usb2_hardware_lpm(udev); - /* Try to enable USB3 LTM */ usb_enable_ltm(udev); } -- 2.17.1