Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756835Ab2BMPB5 (ORCPT ); Mon, 13 Feb 2012 10:01:57 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:41603 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752279Ab2BMPBz (ORCPT ); Mon, 13 Feb 2012 10:01:55 -0500 Date: Mon, 13 Feb 2012 10:01:54 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Lin Ming cc: Zhang Rui , Jeff Garzik , Tejun Heo , "Rafael J. Wysocki" , Len Brown , , , , Subject: Re: [RFC PATCH 4/6] PM / Runtime: Introduce flag can_power_off In-Reply-To: <1329124271-29464-5-git-send-email-ming.m.lin@intel.com> 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: 2077 Lines: 52 On Mon, 13 Feb 2012, Lin Ming wrote: > From: Zhang Rui > > Introduce flag can_power_off in device structure to support runtime > power off/on. > > Note that, for a specific device driver, > "support runtime power off/on" means that the driver .runtime_suspend > callback needs to > 1) save all the context so that it can restore the device back to the previous > working state after powered on. > 2) set can_power_off flag to tell the driver model that it's ready for power off. > > The following example shows how this works. > > device A > |---------| > v v > device B device C > > A is the parent of device B and device C, and device A/B/C shares the > same power logic > (Only device A knows how to turn on/off the power). > > In order to power off A, B, C at runtime, > 1) device B and device C should support runtime power off > (runtime suspended with can_power_off flag set) > 2) pm idle request for device A is fired by runtime PM core. > 3) in device A .runtime_suspend callback, it tries to set can_power_off flag. > 4) if succeed, it means all its children have been ready for power off > and it can turn off the power at any time. > 5) if failed, it means at least one of its children does not support runtime > power off, thus the power can not be turned off. I'm not sure if this is really the right approach. What you're trying to do is implement two different low-power states, basically D3hot and D3cold. Currently the runtime PM core doesn't support such things; all it knows about is low power and full power. Before doing an ad-hoc implementation, it would be best to step back and think about other subsystems. Other sorts of devices may well have multiple low-power states. What's the best way for this to be supported by the PM core? 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/