Hi, On Friday, 4 May 2007 00:48, Pavel Machek wrote: > Hi! > > Crazy idea... could we kill hibernate_ops-like struct, and just create > a device for ACPI, using its suspend()/resume()/whatever callbacks to > do the ACPI magic? Hmm, I didn't think about that. It seems to be viable at first sight. Still, I think we can first separate hibernation_ops from pm_ops, figure out what they should be and then try to replace them with a cleaner solution. > > Okay. Since we're trying to separate the hibernation code from the > > suspend code anyway, we can use the opportunity to introduce some new > > callbacks for the hibernation and/or redefine the existing ones. > > > > The spec suggests that we need the following callbacks: In fact, I should have added (0) start() - called before device_suspend(), execute _TTS(S4) and I'm not sure if the GPEs should be disabled here or in prepare() In principle this could be done as a device's .resume() call, but that would have to be the very first device registered (can we do that?). > > (1) prepare() - called after device_suspend(), execute _PTS and > > disable GPEs > > sysdev .suspend() method would do the trick. Yes. > > (2) cancel() - called at any time after prepare() if there's an error, execute > > _WAK and enable run-time GPEs > > sysdev .resume() should do the trick. But .resume() would be called unconditionally, so there should be a way of figuring out what to do - looks complicated. > > (3) enter() - called after the image has been saved, execute _GTS and do what's > > currently done in pm_enter() > > This one is tricky. It is essentially > powerdown_but_enter_S4_instead. I guess we can live with if()... as we > need to special-case reboot in the same place. Yes. > > (4) finish() - called after the image has been restored, do what's currently > > done in pm_finish() > > platform (?) device .resume() method should work. Hmm, perhaps. And we need one more (in fact this one should be called finish() and the previous one wake() or something like that): (5) finish() - called after device_resume(), but only after the image has been restored or in case of a hibernation error, execute _TTS(S0). It looks like this also should enable the GPEs (or the previous one; that's the information I'm looking for). Greetings, Rafael - To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html