Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758035Ab2FZOaJ (ORCPT ); Tue, 26 Jun 2012 10:30:09 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:34169 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757553Ab2FZOaH (ORCPT ); Tue, 26 Jun 2012 10:30:07 -0400 Date: Tue, 26 Jun 2012 10:30:06 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: chao xie cc: linux-pm@vger.kernel.org, , , , Subject: Re: pm runtime and system suspend resume In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2670 Lines: 69 On Tue, 26 Jun 2012, chao xie wrote: > If we want to separate clocks off and phy off, what should we do? Why do you want to separate them? The Runtime PM framework doesn't have any notion of multiple low-power states. It recognizes only two possibilities: active and suspended. If turning the clocks on and off is very quick, you can simply have the driver turn them on before each I/O operation and turn them off when the operation is finished. > in fact, in the driver, at some time, it can shutdown clock, and at > some time, it can shut down phy too. So what i want to do it make > runtime_idle to shut down the clocks while in runtime_suspend to > shutdown the clocks and phy. The runtime_idle routine is not supposed to turn anything off. All it should do is decide whether or not to call pm_runtime_suspend. The actual work of turning things on and off belongs in the driver's (or subsystem's or PM domain's) runtime_resume and runtime_suspend routines. > So when the driver is in idle, and i can call pm_runtime_put which > will call runtime_idle to shutdown the clocks, while when the driver > want to turn off phy, it means it will enter deeper idle, so i need > call pm_runtime_put_sync_suspend. You can do that if you want, but it is not how the Runtime PM framework was intended to work. Instead of calling pm_runtime_put, why not just turn off the clocks? Or why not turn off the clocks at the same time as the phy? > The question is if when driver calls pm_runtime_put_sync_suspend, the > driver has already called pm_runtime_put, the usaga_count is 0 now, so > driver has to call pm_runtime_get and then call > pm_runtime_put_sync_suspend. If you know the usage count is 0 already, you can just call pm_runtime_suspend directly. > PM runtime provide runtime_idle and runtime_suspend, but the device > status has only two kinds of status, active or no-active. It confuses > me. Idle means "the device is active but the usage count is 0". The purpose of the runtime_idle callback is to let your driver know that it can start a suspend if it wants to. > It means that the pm runtime can not support multiple level of > power mode for device. That's right. > actually, i think it has provided two kinds of > callback runtime_idle and runtime_suspend, and it should maintain at > least 3 state, idle, suspend, active for the device. No, that's not how it was designed. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/