From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: Question about hibernation Date: Thu, 14 Oct 2010 20:59:26 +0200 Message-ID: <201010142059.26869.rjw@sisk.pl> References: <201010141151.05297.rjw@sisk.pl> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org To: Raj Kumar Cc: linux-pm@lists.linux-foundation.org List-Id: linux-pm@vger.kernel.org On Thursday, October 14, 2010, Raj Kumar wrote: > > Hi Rafael, Hi, > Thanks for your quick reply. > > 1) I already implemented this with dev_pm_ops. I used suspend and resume callbacks > whose prototype is like > > struct dev_pm_ops power_mgmt_ops > { > .suspend = powermanagement_suspend, > .resume = powermanagement_resume > > } > > int powermanagement_suspend(device *dev) > { > > } > > In normal suspend to ram mode it will work. But will it work in case of hibernation also? It may be sufficient to point hibernate-specific callback pointers to your suspend/resume routines: struct dev_pm_ops power_mgmt_ops { .suspend = powermanagement_suspend, .resume = powermanagement_resume, .freeze = powermanagement_suspend, .thaw = powermanagement_resume, .poweroff = powermanagement_suspend, .restore = powermanagement_resume, } depending on the particular needs of your driver. > if yes, since in suspend and resume call backs, only the device structure is provided, so how can > then person can identify it is suspend to ram or hibernation? See above. > or for hibernation, poweroff and restore function should be implemented which is similar > to suspend and resume call backs in case of suspend to ram? Yes. Thanks, Rafael