From patchwork Mon Jan 17 05:44:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandeep Maheswaram X-Patchwork-Id: 12714792 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6771FC433EF for ; Mon, 17 Jan 2022 05:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233058AbiAQFq3 (ORCPT ); Mon, 17 Jan 2022 00:46:29 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:35343 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233482AbiAQFo3 (ORCPT ); Mon, 17 Jan 2022 00:44:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1642398269; x=1673934269; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=tkvJg0bK1J5Qw2IRlwsLrL8etQk+wSQ0vBjKhalSILY=; b=VDMbQIEauGAQhFYl5XXGXHnLHp5lJ8Oq5zMZe8Wth2EDr6AaDy/Jq+Xr f9ZJqmp2ZTeBStaS3HLB9ISVXcGlB4MCmcHv/P8K0gzXKss8rhZLuyTEz 2NrtD6GDYDcy0Xo6YEYUY+OoHgpLwt4b/tYbZZFiDS9klcRMqcYMO19uU g=; Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 16 Jan 2022 21:44:29 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2022 21:44:29 -0800 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.19; Sun, 16 Jan 2022 21:44:28 -0800 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.19; Sun, 16 Jan 2022 21:44:24 -0800 From: Sandeep Maheswaram To: Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , Matthias Kaehlcke , Mathias Nyman CC: , , , , , Sandeep Maheswaram Subject: [PATCH v10 1/6] usb: host: xhci: plat: Add suspend quirk for dwc3 controller Date: Mon, 17 Jan 2022 11:14:03 +0530 Message-ID: <1642398248-21753-2-git-send-email-quic_c_sanm@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1642398248-21753-1-git-send-email-quic_c_sanm@quicinc.com> References: <1642398248-21753-1-git-send-email-quic_c_sanm@quicinc.com> MIME-Version: 1.0 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-arm-msm@vger.kernel.org During suspend check if any wakeup capable devices are connected to the controller (directly or through hubs), and set the wakeup enable property for xhci plat device. Signed-off-by: Sandeep Maheswaram Signed-off-by: Matthias Kaehlcke Reviewed-by: Bjorn Andersson --- Change device_set_wakeup_capable to device_set_wakeup_enable as wakeup capable false was deleting the sysfs property. drivers/usb/host/xhci-plat.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index c1edcc9..1c8fadb 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -431,6 +431,14 @@ static int xhci_plat_remove(struct platform_device *dev) return 0; } +static void xhci_dwc3_suspend_quirk(struct usb_hcd *hcd, struct device *dev) +{ + if (usb_wakeup_enabled_descendants(hcd->self.root_hub)) + device_set_wakeup_enable(dev, true); + else + device_set_wakeup_enable(dev, false); +} + static int __maybe_unused xhci_plat_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -440,6 +448,10 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) ret = xhci_priv_suspend_quirk(hcd); if (ret) return ret; + + if (of_device_is_compatible(dev->parent->of_node, "snps,dwc3")) + xhci_dwc3_suspend_quirk(hcd, dev); + /* * xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend.