Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2758384pxb; Mon, 1 Nov 2021 00:55:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTeYeTLN1ve77uIUNwd9JE01kYY/GXrPSpfr+OyTTzFqntsNE2Um//fb3giq7KGOVR0x5c X-Received: by 2002:a5d:9ed6:: with SMTP id a22mr19978755ioe.167.1635753318582; Mon, 01 Nov 2021 00:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635753318; cv=none; d=google.com; s=arc-20160816; b=HuyhsqbZCJqVh0FdqBz1RYcwhVgzBTXmdoMQQS6Q3c0Ee3SqHkRmqte+lONu5mjunx VnWs6uPqzlBNpu3UNsNa2ZL/nygNUeybNMbGQ2Fz2p2bBiLlx3Ocs2LOBcvxLQbNhU59 wncbOsnrBMdd06tLsU0gt5iIokP8DOaamKhVs8fr3WoEgoCm92dFZQatJTS5HqwzS+YD kAl3mrxKSmF9ms9VaoErXvENIfdOI/AEBoU7HrWNfTA2oIUVkLOfDTrufpXqU2I6lb9I hAtizGkiK+oWHIakO8g6moaInToiIX5ncN+CyMwKBqfKH9PSZShWJdo8DANEU7oDQE+N tnPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pvb268w8OMOwhmflSiRGofwQaZ5rzOsmDlFqJW7eBKw=; b=pONuAz25NOlGrOIPuHYQzd/p2iea7oAwqjGtlNa1+81B+ibqgqZeXyLUP0dkGqGzTG tD3uNkau4Ia+QI9ABD6mHhrLAIeFoZi7DaY+0DepbIS0SdEI2IStabr51s8NV4WjhiCz NR5Cz8Bng2tRyT7ednEj1l7ZkWlNtSTCV3BbCHu2FuulAo6uvmr1zFqwGlsdqaH5r9in SoWftz7uv1/zvHDRFrfoNhYpCxPsieTaiRw1T9yTDupP9+IteRv2gxfgWV7GlHCEpO5f r3OMEWfALOZWh714WWoehS3J2a6sojsfJuhX7JAOUChc/8SNCu9eKZtQJ7Zb89S5M2BQ HqCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=WUo35whD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si6718790ilm.153.2021.11.01.00.55.07; Mon, 01 Nov 2021 00:55:18 -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; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=WUo35whD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231358AbhKAH4l (ORCPT + 99 others); Mon, 1 Nov 2021 03:56:41 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:49575 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbhKAH4l (ORCPT ); Mon, 1 Nov 2021 03:56:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1635753248; x=1667289248; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=pvb268w8OMOwhmflSiRGofwQaZ5rzOsmDlFqJW7eBKw=; b=WUo35whDbIKb8Byv8cW3qKrDPYqyYJ8SmPyldHpw5zNrWo3IeguMbHdu RlXB2vlUhGOWGGpTQ5etXUcWSs4wCqoNOK5MmGDtrLeU6tbHAWFoFxbly WKfWVnrmjUVANy0yDbfEIy/gKuaWXVXl0Xxihv7/36JBRGmvNSSabeMU3 o=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 01 Nov 2021 00:54:08 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 00:54:07 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Mon, 1 Nov 2021 00:54:07 -0700 Received: from c-sanm-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Mon, 1 Nov 2021 00:54:03 -0700 From: Sandeep Maheswaram To: Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , "Matthias Kaehlcke" , Mathias Nyman CC: , , , , , Sandeep Maheswaram Subject: [PATCH v9 2/5] usb: dwc3: core: Host wake up support from system suspend Date: Mon, 1 Nov 2021 13:23:41 +0530 Message-ID: <1635753224-23975-3-git-send-email-quic_c_sanm@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1635753224-23975-1-git-send-email-quic_c_sanm@quicinc.com> References: <1635753224-23975-1-git-send-email-quic_c_sanm@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoiding phy powerdown when wakeup capable devices are connected by checking wakeup property of xhci plat device. Phy should be on to wake up the device from suspend using wakeup capable devices such as keyboard and mouse. Signed-off-by: Sandeep Maheswaram --- drivers/usb/dwc3/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 643239d..a6ad0ed 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1787,7 +1787,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) dwc3_core_exit(dwc); break; case DWC3_GCTL_PRTCAP_HOST: - if (!PMSG_IS_AUTO(msg)) { + if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(&dwc->xhci->dev)) { dwc3_core_exit(dwc); break; } @@ -1848,13 +1848,16 @@ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg) spin_unlock_irqrestore(&dwc->lock, flags); break; case DWC3_GCTL_PRTCAP_HOST: - if (!PMSG_IS_AUTO(msg)) { + if (!PMSG_IS_AUTO(msg) && !device_may_wakeup(&dwc->xhci->dev)) { ret = dwc3_core_init_for_resume(dwc); if (ret) return ret; dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); break; + } else { + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); } + /* Restore GUSB2PHYCFG bits that were modified in suspend */ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); if (dwc->dis_u2_susphy_quirk) -- 2.7.4