Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2878408pxu; Sat, 19 Dec 2020 05:06:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJzL/E0RhWTgSaOqphmFAV1YawzIQl8fVb5u27CRb825O8UKBlsI8L+iS7mhSDSMZxUJMqzM X-Received: by 2002:a17:906:a244:: with SMTP id bi4mr8361763ejb.59.1608383200675; Sat, 19 Dec 2020 05:06:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608383200; cv=none; d=google.com; s=arc-20160816; b=buxW0MEJwmlhoScgFUXyOqfAYIZ+ZidYpSbC5Q2LHYpHLfRhyXONgHyCSizx+V5Uvx DM+Lx3Q7KbfiXW/1RZYHAUvwqqN5hkjG8TYQx8qnz5l6YmLNGofdxuM/cC16dWfuVxBt YKDPBVKZKKUEK3ROkKFhEDscuKCAIQ8Gp8JzQ1b+Z34Dy/3NjtAtcnXXWnJ788AaUzRm jpPvnhnV4J1ta6iN4jnRvLbGGaQfN94lper/W+iwB6Vz6YQk0UxxJoX6/YgZMDLW7aJ6 jb+tMk48KUh0En8/BZHWa0V1zMzWjpgtoNT6s28y/7icIt4c+glUDZUo32Y31pXbt5hn 8s1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=1vCJSkv0ZMLqe09SFcBpI7cog8Y7sCBZsfrEEjLyUjU=; b=nRnb+QsMAHFNZgboAsAdW2MZ92SdCmgjl7lBOecdIEaYDuFiq7QVdmDK8f1a6Ud0CU SLNmJksPF6nOgLINKG+RVO/gw8gnOtSOW+303jTnpETzwOEemTttilq+zqen7H+wDFYZ 7jsJGjV5g8DY5qNySqDU6O7nxPpuvoW1Nsd3sSlkuvpCc/FaEpPInqKFFcQ3HKDe5mFv ZprztAEkCMTKHSmluffKtWKpiNXXCFqXPyIKIQxw+tfLBaOI9ZImmxuwAapWTYZP1cCh 3ct6BJzbQJjtws1K/DTwYnGlSk+ZJpjfPgSzEKtVBM59Gm1SRvOKtJwvc5Ps+3kIM0BX 5BRg== 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y26si8026599edo.273.2020.12.19.05.06.18; Sat, 19 Dec 2020 05:06:40 -0800 (PST) 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728840AbgLSNEY (ORCPT + 99 others); Sat, 19 Dec 2020 08:04:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:52052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728788AbgLSNEO (ORCPT ); Sat, 19 Dec 2020 08:04:14 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Jun , Mathias Nyman Subject: [PATCH 5.4 24/34] xhci: Give USB2 ports time to enter U3 in bus suspend Date: Sat, 19 Dec 2020 14:03:21 +0100 Message-Id: <20201219125342.580937696@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125341.384025953@linuxfoundation.org> References: <20201219125341.384025953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Li Jun commit c1373f10479b624fb6dba0805d673e860f1b421d upstream. 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 Link: https://lore.kernel.org/r/20201208092912.1773650-6-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-hub.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -1705,6 +1705,10 @@ retry: 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; }