Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2758896pxb; Mon, 1 Nov 2021 00:56:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8108crYaeixP2sYGxznCNoXlVOohUbm3PmefZgy5vfR8RcFX3iLDpCF3ZcMYTtv1MLJSj X-Received: by 2002:a05:6402:11ca:: with SMTP id j10mr39516753edw.223.1635753374282; Mon, 01 Nov 2021 00:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635753374; cv=none; d=google.com; s=arc-20160816; b=csFWkHaQdaEOR9aPa71QD/EOncuU/SQ3bONKw53f5wTZkClPrsubwBoXpMZdJ+nlP4 KPr+LyKUMjTwPMYswZSdRsvR+UC4kNBfTeefbB2XOQv+6yWbwX8H5yA+29cDSDjirFJa TJZ+XhLu+MHqRU90l/nT9CggL+uTHxNYrbnMWX99ZEvDaP0qNLKOItqqGRJhUOaZqJtE U3aDPxqWjXhYmClY6UACgfGYjFBLtKUnWl7H09p25pimZLmrzW2ekBiMFAqfyN7OrEXZ suqOTllR0TOrH0xxRyXcyAkslcnYYQsCjZAmfNqPA8tLyPEqqGDv8nXMQ+GVIO2hc5d+ ZEsg== 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=X+wdQRBLa1HC/CfK9EAfVpdM/vS8LjVQFtsSsB/pc90=; b=gnzREJueNMmdk9STYB7TNJI/Cwer2k3Lw5LA/HzApAmMjT8I68V3z+wh0StJkGLthX SGTgZteHvxrXWnDLHg2Yjbo5TiHysGkg4hd/bi1a1oQvL4bdvfAx2ICuD62tHNs04dZu ZLiqTlXMnouEUctaQXRzSyPCQMo83f7D4ZcQ6DaDtM0l8LzVANJuqOWlJwX7qNIhwwq8 CPVYSbxUj+dd8Ie919fDVZsnYWZNqKCAtEhplJwPXIO0vmOloUvdL5+L4c3gDqXGqy/9 vkFUbVGIG0FlRSJZF4FhWOMBw1ZkvQWASLYKZi3c9fG1x0QjmCnSthEma5B0crqGx14C jYTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=KundQqpW; 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 kq12si17255685ejb.69.2021.11.01.00.55.50; Mon, 01 Nov 2021 00:56:14 -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=KundQqpW; 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 S229882AbhKAH4i (ORCPT + 99 others); Mon, 1 Nov 2021 03:56:38 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:3117 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbhKAH4h (ORCPT ); Mon, 1 Nov 2021 03:56:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1635753244; x=1667289244; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=X+wdQRBLa1HC/CfK9EAfVpdM/vS8LjVQFtsSsB/pc90=; b=KundQqpW3rH/c8iwFTbWfvSURk1vcAs0v4L4vFrvvQIbt/uvSwXu9xIa hElGiiFNIlQ4Hh9YeRlpRSp8ohw1ELpBuor7rQKiVwswgn3gltWYw9p8f sxIrzFdFQa8N0E1DVbqMTSlKwmw5xmryE5ZuDMlKM51hwFh0DGIFtpUzQ g=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 01 Nov 2021 00:54:03 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 00:54:03 -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:02 -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:53:58 -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 1/5] usb: host: xhci: plat: Add suspend quirk for dwc3 controller Date: Mon, 1 Nov 2021 13:23:40 +0530 Message-ID: <1635753224-23975-2-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 During suspend check if any wakeup capable devices are connected to the controller (directly or through hubs), and set the wakeup capable property for xhci plat device. Signed-off-by: Sandeep Maheswaram --- 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..7ab272b 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_capable(dev, true); + else + device_set_wakeup_capable(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