Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3461599pxv; Mon, 28 Jun 2021 05:11:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjr3WQ7EU48Z4VlSF2d85E9+I9VqCqv1G1EoADNhESDbwVNsQDxjaIQJLNP4ySxjk/r0/8 X-Received: by 2002:a05:6402:1c11:: with SMTP id ck17mr19581609edb.370.1624882266514; Mon, 28 Jun 2021 05:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624882266; cv=none; d=google.com; s=arc-20160816; b=wzVmdbanHS22p6tX0kJvRjxAmP0pWQxePBQ71rjsYvXecNnBbWznvMcMr99iVDWKhq kV4c2ec0d2NIW2gUTC4IGELOBg6alKpAUoPU8i576NzA8T9NFRoxylFSo+zGjKWDrOs1 cMFUlDZGRnGeRO7ydzk4ILGQWSnX8J1VrxGjkAL8oNEACAO88pVAQI7SwUldjXNHLS3r kTabfiP7Y3eaLHcfv/14x+wSaGhLxa7z8SwbPzt80dQhONWuzLtb0CSjm6c3+fyi9Z4/ YYeQT2T5tjpeQr6eRdYrPzJe+I8+EA9KmcIcuXEPBlz8tSxXd9dMCvzJGY2w2DusM/Ur QkaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=6utlKRwC/VslnlqowzBtfDi0LHfJt8wjuqQaIbH1QzE=; b=yg7nMyAvU2nyxTtYob0CaYAqGyjUI36Jtb2UVyCj6LNZj1qejBSLU5vNxRk/7e7xeA HboHxQxb1gwpPWl9w2v+kjPqmFtV5VD+BEQKEN4HE2XcZFb1bHlMXe4EByKJ14yJiszX XndgF7hmusTCN8tRVkYcPqgXFu5OGy/1OAoAx4lMQBLtLqoiKLWqryYFwpV6QdFsvYP7 hxZEZRR4SOVU5u+1ROHLnjXWAekQMYoPVw//QjWhlunuWenEWf4JpyL79Uzfi5SotBBF +8kci6lSHW6KV8gzu5DevY/pbmXdmmT5YXmWg0phg1Aw6Z2KZtlx38RiftzteiVaeEaA BE1Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v7si14914439edj.541.2021.06.28.05.10.42; Mon, 28 Jun 2021 05:11:06 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233009AbhF1MLd (ORCPT + 99 others); Mon, 28 Jun 2021 08:11:33 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:6161 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232938AbhF1MLZ (ORCPT ); Mon, 28 Jun 2021 08:11:25 -0400 Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 28 Jun 2021 05:08:59 -0700 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 28 Jun 2021 05:08:57 -0700 X-QCInternal: smtphost Received: from c-sanm-linux.qualcomm.com ([10.206.25.31]) by ironmsg02-blr.qualcomm.com with ESMTP; 28 Jun 2021 17:38:28 +0530 Received: by c-sanm-linux.qualcomm.com (Postfix, from userid 2343233) id 936793A50; Mon, 28 Jun 2021 17:38:27 +0530 (IST) From: Sandeep Maheswaram To: Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , Matthias Kaehlcke , Mathias Nyman Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Pratham Pratap , Sandeep Maheswaram Subject: [PATCH v8 3/6] usb: dwc3: core: Host wake up support from system suspend Date: Mon, 28 Jun 2021 17:38:14 +0530 Message-Id: <1624882097-23265-4-git-send-email-sanm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1624882097-23265-1-git-send-email-sanm@codeaurora.org> References: <1624882097-23265-1-git-send-email-sanm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoiding phy powerdown when wakeup capable devices are connected by checking phy_power_off flag. 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 Reviewed-by: Matthias Kaehlcke --- 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 ba74ad7..ef96a5f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1738,7 +1738,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) && dwc->phy_power_off) { dwc3_core_exit(dwc); break; } @@ -1799,13 +1799,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) && dwc->phy_power_off) { 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) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation