Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2804446pxb; Mon, 17 Jan 2022 06:10:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOtUtH9ntBZFcHLRd4aHz1i6orMPoXcPbR7flUE4xoO1YDWLsDjTsfcAhivFLGZ5OtJ8qq X-Received: by 2002:a63:8a41:: with SMTP id y62mr19418949pgd.552.1642428630581; Mon, 17 Jan 2022 06:10:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642428630; cv=none; d=google.com; s=arc-20160816; b=cTlTwXH1x6RWOnrHPx+++gr08n39AUm4uhPbawk4fD4QYjq3k4LqV/29SrxTQJPhbo V1dohjt3v38bzU0RdTimYYL2DzNAAIs9t7gzRCCEOTViREx5L1KCNwUH82nilDmgXhK+ ue/ki3DuduKTpGXA5i6R5187D12mUOSTpISKctWMNq9L7hWBLx5WfutwZTDu5zVzmGJ7 Sdmoy96yzHtTtP5JeIqkc4tZqrgmRyDVLP6S7MiWbiH6jXN9Fjat7LtrOUd791uSxHtz q2e4cyUQkoJLtVQ8PHy7Yvmb3A+j3J5Ff9wbZrbZHPKI9Lv3xfxtba/5c/aQhb9XA35i td3A== 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=tkvJg0bK1J5Qw2IRlwsLrL8etQk+wSQ0vBjKhalSILY=; b=rlZELBNURiggEcmIG/ZTkCMX6PE3/3N1g9xAdTiup6qnSYOZ7bAmKduuC5q0UEYuSn 4Rb7qskOi+ZbudvWyAqOW7P1hx5sXr0Zigo5SSltAEKwpF7TgWl9AV77+JYItjx6009d QNOWv4GdWu0pWHriA3GoYiE1oRSencVmMBKeiZNyklu9qdaYcvlAbeH3UnBbYXp4cpjM aefbLuqwkPk856cSUgWYtJc0QIap+UasDlPnUxXT+V2Iw1lpYK3rYnxuLo6eUdlLm5oo m7Nio0U8nrVs6cSjisc+EEopcBAUthLxj40s7krxaVgFBFEA1NIpVxxufkqmMSBPIIYN ZmzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=VDMbQIEa; 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 i185si13087694pge.791.2022.01.17.06.10.16; Mon, 17 Jan 2022 06:10:30 -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; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=VDMbQIEa; 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 S234347AbiAQFqa (ORCPT + 99 others); Mon, 17 Jan 2022 00:46:30 -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 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 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. -- 2.7.4