From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754828AbcEQIDZ (ORCPT ); Tue, 17 May 2016 04:03:25 -0400 Received: from mga11.intel.com ([192.55.52.93]:27807 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752176AbcEQIDR (ORCPT ); Tue, 17 May 2016 04:03:17 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,324,1459839600"; d="asc'?scan'208";a="982656968" From: Felipe Balbi To: Baolin Wang Cc: Greg KH , Mark Brown , USB , LKML Subject: Re: [PATCH] dwc3: gadget: Defer starting the gadget device until gadget is power on In-Reply-To: References: <4d6528e4b742cacf34f384b766a7c3296dfe9dbf.1463134786.git.baolin.wang@linaro.org> <87oa8aqlzh.fsf@linux.intel.com> <87d1oqqhvs.fsf@linux.intel.com> <871t56qg67.fsf@linux.intel.com> User-Agent: Notmuch/0.22+11~g124a67e (http://notmuchmail.org) Emacs/25.0.93.2 (x86_64-pc-linux-gnu) Date: Tue, 17 May 2016 11:00:40 +0300 Message-ID: <87a8jp15cn.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Baolin Wang writes: > Hi Felipe, > > On 13 May 2016 at 20:46, Felipe Balbi wrote: >> >> Hi, >> >> Baolin Wang writes: >>>>>> why does it need restart? Why is dwc3 powered off? Who powers it off? >>>>> >>>>> Because when the dwc3 Vbus is off (no cable pluging in now), >>>>> especially for some mobile device, the system need to power off the >>>>> dwc3 to save power in this situation. >>>> >>>> but dwc3 doesn't do this by itself, so who's doing it? >>> >>> Yes, the dwc3 clock is controlled by the Soc system, so the Soc system >>> can disable the dwc3 clock when there is no cable plugging in. >> >> understood. >> >>>>>> This looks like a *really* bad power management implementation. Do y= ou >>>>>> have hibernation enabled? Do you have Clock gating enabled? Which dw= c3 >>>>>> version are you using? How was it configured? >>>>> >>>>> This is not hibernation, we want to power off the dwc3 to save power >>>>> when no cable plugging in. Yes, we have clock gating, at this >>>>> situation we will disable the clock and shutdown the phy to save >>>>> power. For mobile device, most time no cable plugging in, so we need >>>>> to think about the power consuming. How do you think this requirement? >>>> >>>> Well, seems like you're missing *proper* runtime PM. I've been meaning >>>> to work on it for weeks, but I still have a few other things to do >>>> before I get to that. In any case, we don't need to do what you did >>>> here. There are better ways. >>> >>> Make sense. >> >> cool, if you wanna work on it, let me know and I can give some details >> of what I have in mind. > > Could you explain details to me, and I wanna continue to optimize the > power management things. Thanks. I have it half-way done. Have a look at my dwc3-fix-suspend branch on k.org. I haven't sent because I'm not getting a PME event. Can you test on your end and let me know what happens? Note that if cable is disconnected, we will drop RUN/STOP bit. On runtime_resume, we will restart the controller from scratch (skipping memory allocations, of course) =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXOs+oAAoJEIaOsuA1yqREv1QP/3IhlkKwgdJd8+PWq36K4X3l i6U/KPcyLTnwPyCdJJXT/hdUrORw8GPIwpLH9zQlZfpQAuYPz4dPuOypyOYcjDIb DS0juJdqY25P4RXgbhSfqeZ9HonUTkLeBXF4pruWTSTAyY+jzZ9r6WdVWT5WwjJN d1ji2mhm7ICdWgPtqBijxk1mABiSMZdNqQ413OgTXaDVXDG2K1tWvE70GzVSKnOp 9atV0ZW+uy6KJa0eVPUwWns8CKlwxNDBWk0M7/YHGuiUgLc31n57HkHHPGvM5KNB xiN/f2kewSmiqNFEldCthU9ALzreUwgMSyn9El2b/oAEdmZSluvC/9znD630Uu5x FkWk2Z6EYlnDUkYnM4G3j8wXqxrIL4f4PjTwulo12WuACKlVd6b4AhKEtVleETnA fJ7nh/Kc3pjNfYjiaSXJfnnT6NBkwxcmmEK3nTK00w/x+bs71b3MjyMr6rmvT16L vMkhumQwK+pC9tSSOl0COTXNE7liKFFxxAqDjpZ3GsWDZdgBG8UK1XkqgmCkIqxf nQz08P/W3vRYCAr20SjNJP9OHq3C0ReY6xuT5NqkaIKEJ4Pyp6AavEB8fE8uMFQZ Tm/lLyJjHMXtvOSPO0VUI5Qzz93y+BmmVg25NiujaRnitWIjP1HN+Cx0wzQdsS0m rlxotDd0JDnmFoywoI19 =a+tW -----END PGP SIGNATURE----- --=-=-=--