From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754618AbcILTnx (ORCPT ); Mon, 12 Sep 2016 15:43:53 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:47547 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751441AbcILTnv (ORCPT ); Mon, 12 Sep 2016 15:43:51 -0400 Date: Mon, 12 Sep 2016 12:43:49 -0700 From: Guenter Roeck To: Felipe Balbi Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Question about suspend/resume clock handling in dwc3-of-simple.c Message-ID: <20160912194349.GA14284@roeck-us.net> References: <20160912185629.GA25929@roeck-us.net> <87wpihaqhv.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wpihaqhv.fsf@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Felipe, On Mon, Sep 12, 2016 at 10:05:00PM +0300, Felipe Balbi wrote: > > Hi Guenter, > > Guenter Roeck writes: > > Hi folks, > > > > In dwc3-of-simple.c:dwc3_of_simple_remove(), I see the following code. > > > > for (i = 0; i < simple->num_clocks; i++) { > > clk_unprepare(simple->clks[i]); > > clk_put(simple->clks[i]); > > } > > > > What I don't understand is why clk_unprepare() is called instead > > of clk_disable_unprepare(). Someone told me that it was due to > > dwc3_of_simple_runtime_suspend(), which would call clk_disable(). > > good eyes :-) That was fixed though: > > https://marc.info/?l=linux-usb&m=147343692631868&w=2 > Great, thanks! > > Should it be clk_disable_unprepare(), or maybe something like the > > following > > > > if (!pm_runtime_status_suspended(dev)) > > clk_disable_unprepare(); > > else > > clk_unprepare(); > > I'm not sure how balanced those calls are, yeah. I don't have HW to test > PM with. But note that as it is, there is no actual runtime PM support, > so clk_disable_unprepare() will always be necessary. > > Perhaps we will find further issues when someone tries to use runtime PM > with dwc3-of-simple. ;-) > We are working on code derived from it, so unless I can convince the author that he can not just use clk_unprepare() I suspect we'll hit the problem. If so, I'll let you know. Thanks! Guenter