Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6655pxb; Wed, 20 Jan 2021 23:09:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwku9ThoZWOzCvJIakruTPelrJmkRZFzXhBcR8IJTqzVukHzd2Dnls3ZbcGH2ZzNyc+eNAK X-Received: by 2002:a05:6402:4252:: with SMTP id g18mr10301703edb.231.1611212959568; Wed, 20 Jan 2021 23:09:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611212959; cv=none; d=google.com; s=arc-20160816; b=hc3W2satehTc0AmHxI8hnWekIUdJiJg24dqXxO65AfHi1boHAub4TvQ/BvaufVlSkJ Dn2MtvaFQWauYAKFFrG23586jf08el9K6vfWPNe9uwhevrg24yE9l+anZ1X5kGGMx2Qm 9BNRBX0A/jcXmdrgVVtobrVUh2JSvQWHDjE0T2VOXYYllni5lTNwLbfahuQNJ3q2KB55 5ck04XfLOSwMtxBrc0gsj/WkjQus/0FLuVtG8f57re1v2BGtA6E0/OQAbpwEwdiv2t3a AxMyWiAckx+yEQ1Pydb9xvJ/MQAUXSihe1KUGS1+vyq3euM3n5C5HKhSLAD8tCrx3JkE 30ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:user-agent :in-reply-to:mime-version:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=ZyIfm2xerJ7n5eZHUm+VKML0WJUVbU46w1Su9fus1ig=; b=VoNk87gouOt6AVMQJee1SHYB1SydCqGNs/Z6+a30Va7eDDrH0/MgQ10KVtArFfKW6t 4eiErwxTjeSoNA9+DRre39NasjXwjwVRcELjgYD6VOeZ+IZByYMcEMb0/cOHZ8C01D1d zICFb3O/NwuNuO9FEy7P/ZhDsd3+oY5mGuq2ha5ue1FJuo5qMtK9NFccfeli3w/7Qf9J /nh1CM7Zo5P3hMD/KsYyJO8tniB/BUpT9nPvIQcnn+YkaiomvBEZRiMGYMwaF8tEan19 ZLaXQvmnM6AUqD+q3eEa6xymfC5FZQamgqTVtPaxPwXuASkxhoNzfvolE68JAOOsO0h4 a63A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=o1qfHrx4; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si1784230edd.393.2021.01.20.23.08.55; Wed, 20 Jan 2021 23:09:19 -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=@samsung.com header.s=mail20170921 header.b=o1qfHrx4; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbhAUHFW (ORCPT + 99 others); Thu, 21 Jan 2021 02:05:22 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:43619 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727134AbhAUHCQ (ORCPT ); Thu, 21 Jan 2021 02:02:16 -0500 Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210121070132epoutp04e67c477c5a13336938c03646f1adf700~cLTmamYCW0264602646epoutp041 for ; Thu, 21 Jan 2021 07:01:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210121070132epoutp04e67c477c5a13336938c03646f1adf700~cLTmamYCW0264602646epoutp041 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1611212492; bh=ZyIfm2xerJ7n5eZHUm+VKML0WJUVbU46w1Su9fus1ig=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=o1qfHrx4UXH2syiLC2MKQAraI3AdEc5FGV7DPWKh1EUjanbg3YbccYqqYU4Rszi/u 5ZQ8WwdbTZPx16/2v3XD98kJT7exMxOrxJArsnqVeUCP6vdS6UlvcY7DxB4qS8Jiio 8zNUaJiTHs1GcgrrfovS/jdYD3roGy8zkRR7Mv/k= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20210121070128epcas2p3476ad921377c37a9fcadc8b70c541d7b~cLTi-oVDJ1164711647epcas2p31; Thu, 21 Jan 2021 07:01:28 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.183]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4DLtbW1rfZz4x9Pw; Thu, 21 Jan 2021 07:01:27 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 31.6A.10621.5C629006; Thu, 21 Jan 2021 16:01:25 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20210121070117epcas2p2f79aee8554d1c6d94e71efd0a4b248b4~cLTZArSEb1177811778epcas2p2K; Thu, 21 Jan 2021 07:01:17 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210121070117epsmtrp1dab25ef01fafa4412899263a1a181fdb~cLTY-5e6V3022230222epsmtrp1S; Thu, 21 Jan 2021 07:01:17 +0000 (GMT) X-AuditID: b6c32a45-34dff7000001297d-bd-600926c5080c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 43.7E.13470.DB629006; Thu, 21 Jan 2021 16:01:17 +0900 (KST) Received: from ubuntu (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210121070117epsmtip1c8b35273b41ac8cd85b5ab0b52754318~cLTY2yNTs0633906339epsmtip1Q; Thu, 21 Jan 2021 07:01:17 +0000 (GMT) Date: Thu, 21 Jan 2021 15:49:56 +0900 From: Jung Daehwan To: Thinh Nguyen Cc: Felipe Balbi , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: usb: dwc3: gadget: skip pullup and set_speed after suspend Message-ID: <20210121064956.GA69382@ubuntu> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgk+LIzCtJLcpLzFFi42LZdljTTPeoGmeCwZvdphbH2p6wWzQvXs9m cXnXHDaLRctamS1WLTjA7sDqsWlVJ5vH/rlr2D227P/M6PF5k1wAS1SOTUZqYkpqkUJqXnJ+ SmZeuq2Sd3C8c7ypmYGhrqGlhbmSQl5ibqqtkotPgK5bZg7QXiWFssScUqBQQGJxsZK+nU1R fmlJqkJGfnGJrVJqQUpOgaFhgV5xYm5xaV66XnJ+rpWhgYGRKVBlQk7G828sBZsFK9q+zGRr YPzP28XIySEhYCKx9fFGpi5GLg4hgR2MEv0rt7FCOJ8YJaZvXMwG4XxjlFjavYkVpuXti5PM EIm9jBL7761jhHCeALXc3cwCUsUioCrx8+FsJhCbTUBL4t6PE8wgtoiAjsSBE+fBFjILXGKU mNzZxgaSEBZwl5h4+y5YM6+AtsSZOf9ZIWxBiZMzn4DFOQUcJCbOegU0iINDVEBF4tXBepA5 EgKP2CVOrdrDDnGei8SUm8vZIGxhiVfHt0DFpSRe9rexg/RKCJRLLJpvB9HbwSix5tNZRoga Y4lZz9rBbGaBDIlH725C1StLHLnFAhHmk+g4/BcqzCvR0SYE0aksMf3yB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5qXrJefnbmIEh7mW5g7G7as+6B1iZOJgPMQowcGsJML7yJIjQYg3JbGyKrUoP76oNCe1 +BCjNAeLkjjvha6T8UIC6YklqdmpqQWpRTBZJg5OqQam6MpJD3Pmex/SCtzu/0VW5ut1v4sP 5KV51CarsPXO6Wlf9WvNxYN/HlgL2O7iP/qBX8vW8uAmgaufRGZ5bHh2xnUB263T64sVDjt4 Wlv0Wz3NuHvhcYd7vF6msLiRqP7m2dOWTBFUe7B+SZCqYOIpR9tF80PMNbZPbM1I6T9db/w5 ms944csoCetAj++1s9rfm7L/We4rEH9rv3fhW48VgQ/XrOty2zzZYMa7Z7buGmZ8LeyK+pHP zJxPPtgk5sMcsNJeacKznnMbeZcpcDvsfW/v9Efu+nrHnWJtnRoLG94L1p5imWzfsy6q/AKH ZvydhXPcr01UaeS7YNXDoMw84VcJs7qM1Tf5P5ryLxKUWIozEg21mIuKEwHB/zkU4gIAAA== X-CMS-MailID: 20210121070117epcas2p2f79aee8554d1c6d94e71efd0a4b248b4 X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----WZLI4USkVYiVjVtGawWGutc5pNztY3GR2qy8kqsclN4GFAmP=_1566b_" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20210120035123epcas2p2048f6d9896bd21f19d939a56fe0b6610 References: <1611113968-102424-1-git-send-email-dh10.jung@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ------WZLI4USkVYiVjVtGawWGutc5pNztY3GR2qy8kqsclN4GFAmP=_1566b_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline Hi, On Thu, Jan 21, 2021 at 01:00:32AM +0000, Thinh Nguyen wrote: > Hi, > > Daehwan Jung wrote: > > Sometimes dwc3_gadget_pullup and dwc3_gadget_set_speed are called after > > entering suspend. That's why it needs to check whether suspend > > > > 1. dwc3 sends disconnect uevent and turn off. (suspend) > > 2. Platform side causes pullup or set_speed(e.g., adbd closes ffs node) > > 3. It causes unexpected behavior like ITMON error. > > > > Signed-off-by: Daehwan Jung > > --- > > drivers/usb/dwc3/gadget.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > > index ee44321..d7d4202 100644 > > --- a/drivers/usb/dwc3/gadget.c > > +++ b/drivers/usb/dwc3/gadget.c > > @@ -2093,6 +2093,9 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) > > unsigned long flags; > > int ret; > > > > + if (pm_runtime_suspended(dwc->dev)) > > + return 0; > > + > > is_on = !!is_on; > > > > /* > > @@ -2403,6 +2406,9 @@ static void dwc3_gadget_set_speed(struct usb_gadget *g, > > unsigned long flags; > > u32 reg; > > > > + if (pm_runtime_suspended(dwc->dev)) > > + return; > > + > > spin_lock_irqsave(&dwc->lock, flags); > > reg = dwc3_readl(dwc->regs, DWC3_DCFG); > > reg &= ~(DWC3_DCFG_SPEED_MASK); > > This is already addressed in Wesley Cheng's patches. Can you try the > latest changes of DWC3 in Greg's usb-next branch? > > Thanks, > Thinh I checked Wesly Cheng's pathces but it's not same. What I want to do for this patch is to avoid pullup from platform side. (android in my case) It's possible that platform side tries to pullup by UDC_Store after usb is already disconnected. It can finally run controller and enable irq. I think we have to avoid it and other possible things related to platform side. ------WZLI4USkVYiVjVtGawWGutc5pNztY3GR2qy8kqsclN4GFAmP=_1566b_ Content-Type: text/plain; charset="utf-8" ------WZLI4USkVYiVjVtGawWGutc5pNztY3GR2qy8kqsclN4GFAmP=_1566b_--