Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp21071pxb; Wed, 20 Jan 2021 23:39:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX9/AMJ/I04/03f3xzb2YFvwq2gOPQxx42fc2pfMKyCuapLSMJuXqqnmZpxawesWtDHOjF X-Received: by 2002:a05:6402:2288:: with SMTP id cw8mr9868123edb.161.1611214785054; Wed, 20 Jan 2021 23:39:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611214785; cv=none; d=google.com; s=arc-20160816; b=d2BcLYWS4kLNe52jMcePeVkvD4TgAc/kRVgc41rsGzFn/viK1l0BWov/w2TVGBx4D5 GeGEVyRNlxjwwz9FoiQkayF9Q2AnS9Zz5/DYgy22w6UHv09xOfmESIboNIu5cm0qCs7K QT9s1yK7qA11Q9bH8wyTTCN1lIRAuwE8KPU3P5ZahEnWbAEIojHZBeGICzfV2VpwBAZ9 qpSdabkY6iHJ1udYyssiQWiz1aF9xK7dzQFcRz8zghpHXSnwpKxUYjV5rp3ptGkrNmRM YYz5NvZVgUlEhg8bxSrqECFTHPuQBDlAhLuGqkKjGsz88IJflMjgBEAZV0/MUHL7jZN3 S4Sw== 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:reply-to:message-id:subject:cc:to:from :date:dkim-signature:dkim-filter; bh=s+VACPfSnf1IN7l9c0PuSue2sZjrDh2l/uhILldXiAI=; b=HQoBfzjyY7EaFqYPvORQZGLEO1dtiKGNXrKbLXnlKYpex2m+8riYm4O9/JBQHSo+Za MP5+6X3BIS3ReDIoJPxmB1IBpmUh8Go9zSF8U7yKJ1CdQRLHDc5sYQvE/glrePOC5qJ6 JywM3sKtGMxeIlpqx+5Eky1FtQdzzhPvYwC0zEX06bFFM1G1SLK7Nhp5nwzfvDdLYRU1 WXkBSiqhKt272moYQ5qMpDbyAgr1g3KuYRpVtxTDjFcIH/wp76HrKZX6sMOdCNuDY8OG r53jh0q7UaXWyiX0cSDQeN/N8d1txLXzpP/Gb9FkGJ8s2cIE+hs10FawskGq13UmHLar nKLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=VSxLaP8l; 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 ho11si1630182ejc.260.2021.01.20.23.39.21; Wed, 20 Jan 2021 23:39:45 -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=VSxLaP8l; 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 S1727335AbhAUHia (ORCPT + 99 others); Thu, 21 Jan 2021 02:38:30 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:17277 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727472AbhAUHXm (ORCPT ); Thu, 21 Jan 2021 02:23:42 -0500 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20210121072256epoutp020492f2d9beab3d2f2ea07b6f2d889a0b~cLmSxOqvY0551405514epoutp02z for ; Thu, 21 Jan 2021 07:22:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20210121072256epoutp020492f2d9beab3d2f2ea07b6f2d889a0b~cLmSxOqvY0551405514epoutp02z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1611213776; bh=s+VACPfSnf1IN7l9c0PuSue2sZjrDh2l/uhILldXiAI=; h=Date:From:To:Cc:Subject:Reply-To:In-Reply-To:References:From; b=VSxLaP8lPgIc+41c6O/38fro5i8h6a/VRZ8O4ZeVco8gbiB+5gk6BBsMUycRaplZT fOLrhfi7ZoEYX67rkdhvoDj5ceB4XLm+l7i+UHa7HXSssWydb4alrgyWXgeHd7PrHs U2H7f2F1IbyHrt6cV3zksIf5RPQ8iVlNw8UTWDpg= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20210121072256epcas2p29cb6ddeab37509a768f1207f7c869c14~cLmSYf_Ed0334203342epcas2p23; Thu, 21 Jan 2021 07:22:56 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.191]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4DLv4H0LnBz4x9Q8; Thu, 21 Jan 2021 07:22:55 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id F4.28.52511.CCB29006; Thu, 21 Jan 2021 16:22:52 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20210121072252epcas2p3d632d03e00263cdd9bf7b65690ea4cb5~cLmO9lpqo1161011610epcas2p3M; Thu, 21 Jan 2021 07:22:52 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210121072252epsmtrp2aa930ac61bb7b7e1e27668c89933fa81~cLmO8-rHs2747627476epsmtrp2J; Thu, 21 Jan 2021 07:22:52 +0000 (GMT) X-AuditID: b6c32a48-4f9ff7000000cd1f-4d-60092bcce0b1 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 12.71.13470.CCB29006; Thu, 21 Jan 2021 16:22:52 +0900 (KST) Received: from ubuntu (unknown [12.36.155.120]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210121072252epsmtip1e83a60619cc684d071a7c2a12baabaed~cLmO0luUr1645316453epsmtip1W; Thu, 21 Jan 2021 07:22:52 +0000 (GMT) Date: Thu, 21 Jan 2021 16:11:31 +0900 From: Jung Daehwan To: Felipe Balbi Cc: Greg Kroah-Hartman , "open list:DESIGNWARE USB3 DRD IP DRIVER" , open list Subject: Re: usb: dwc3: gadget: skip pullup and set_speed after suspend Message-ID: <20210121071131.GA84462@ubuntu> Reply-To: eg Kroah-Hartman MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgk+LIzCtJLcpLzFFi42LZdljTTPeMNmeCQc9+G4tjbU/YLZoXr2ez uLxrDpvFomWtzA4sHptWdbJ57J+7ht3j8ya5AOaoHJuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4 UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wcoG1KCmWJOaVAoYDE4mIlfTubovzSklSFjPziElul 1IKUnAJDwwK94sTc4tK8dL3k/FwrQwMDI1OgyoScjH3nljMXHBOsePDiMEsDYy9fFyMnh4SA icStT20sXYxcHEICOxgl7v64AeV8YpTYuWYlG4TzDciZu4IZpuXEl/2MEIm9jBJL3qwDSwgJ PGGU6N7GAWKzCKhKbPuxHyzOJqAlce/HCTBbREBZYsqPNiaQZmaBFYwSXQtPgiWEBdwlJt6+ ywJi8wpoS7Tc2csOMdRc4t+y+VBxQYmTM5+A2ZwCDhITZ70C6uXgEBVQkXh1sB5kpoTAI3aJ c/83s0Bc6iLxZN5TJghbWOLV8S3sELaUxOd3e9lAeiUEyiUWzbeD6O1glFjz6SwjRI2xxKxn 7YwgNcwCGR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0jwLSfMshOYFjMyrGCVTC4pz03OLDQsM81LL9YoT c4tL89L1kvNzNzGCQ11Lcwfj9lUf9A4xMnEwHmKU4GBWEuF9ZMmRIMSbklhZlVqUH19UmpNa fIhRmoNFSZz3QtfJeCGB9MSS1OzU1ILUIpgsEwenVAOT51X1pPu9sy9IXt/8TkPeuGHNgg/X hNL51FVb610/zLKqvjJf65pgqdTJMkfRi3N6Z1rUZPCs0xT/wfRk2umtbGUcDx7kH97btE29 QrK83Fn5x+KO5lOJLq82+M1IsVPIulSdELIn8tIJ8eJ/PV8eilxs3bhHnqlI4ML2iYmyqs1+ Ic4qGS/Peu2JnKIyU9x34ttdzWkssp58ykvNG2sf355h023vrf0vseRU/N/nH+4Zn61o0dRy 3evzP+XT9FunNwVc6U/5Jf7xPv+7UNfOv9Wx/d/PpEVXuX/pvPmHcWdyUfJ+ywMTe8pvnPQ0 WhLALOKixvfgW8CFVVmZSdGC1nWPLet+Tg9Y+fjJGxklluKMREMt5qLiRACx/hnZ5AIAAA== X-CMS-MailID: 20210121072252epcas2p3d632d03e00263cdd9bf7b65690ea4cb5 X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----mNH5knzzkG0Mgn_4LE2W.vyl1feJgd8C-RJhbgQvYSfbcfg-=_15cf8_" 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 ------mNH5knzzkG0Mgn_4LE2W.vyl1feJgd8C-RJhbgQvYSfbcfg-=_15cf8_ 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. BR, Jung Daehwan ------mNH5knzzkG0Mgn_4LE2W.vyl1feJgd8C-RJhbgQvYSfbcfg-=_15cf8_ Content-Type: text/plain; charset="utf-8" ------mNH5knzzkG0Mgn_4LE2W.vyl1feJgd8C-RJhbgQvYSfbcfg-=_15cf8_--