From: Grygorii Strashko <redacted>
Add handling of missed events in omap_dss_pm_notif which are
needed to support hibernation (suspend to disk).
Signed-off-by: Grygorii Strashko <redacted>
---
drivers/video/fbdev/omap2/dss/core.c | 4 ++++
1 file changed, 4 insertions(+)
From: Tomi Valkeinen <hidden> Date: 2015-03-20 12:20:30
On 25/02/15 19:03, grygorii.strashko@linaro.org wrote:
quoted hunk
From: Grygorii Strashko <redacted>
Add handling of missed events in omap_dss_pm_notif which are
needed to support hibernation (suspend to disk).
Signed-off-by: Grygorii Strashko <redacted>
---
drivers/video/fbdev/omap2/dss/core.c | 4 ++++
1 file changed, 4 insertions(+)
Hi Tomi,
On 03/20/2015 02:20 PM, Tomi Valkeinen wrote:
On 25/02/15 19:03, grygorii.strashko@linaro.org wrote:
quoted
From: Grygorii Strashko <redacted>
Add handling of missed events in omap_dss_pm_notif which are
needed to support hibernation (suspend to disk).
Signed-off-by: Grygorii Strashko <redacted>
---
drivers/video/fbdev/omap2/dss/core.c | 4 ++++
1 file changed, 4 insertions(+)
From: Tomi Valkeinen <hidden> Date: 2015-03-20 15:21:15
On 20/03/15 16:57, Grygorii.Strashko@linaro.org wrote:
Hi Tomi,
On 03/20/2015 02:20 PM, Tomi Valkeinen wrote:
quoted
On 25/02/15 19:03, grygorii.strashko@linaro.org wrote:
quoted
From: Grygorii Strashko <redacted>
Add handling of missed events in omap_dss_pm_notif which are
needed to support hibernation (suspend to disk).
Signed-off-by: Grygorii Strashko <redacted>
---
drivers/video/fbdev/omap2/dss/core.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -178,11 +178,15 @@ static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void *d)DSSDBG("pm notif %lu\n",v);switch(v){+casePM_HIBERNATION_PREPARE:casePM_SUSPEND_PREPARE:+casePM_RESTORE_PREPARE:DSSDBG("suspending displays\n");returndss_suspend_all_devices();casePM_POST_SUSPEND:+casePM_POST_HIBERNATION:+casePM_POST_RESTORE:DSSDBG("resuming displays\n");returndss_resume_all_devices();
Why suspend displays when PM_RESTORE_PREPARE happens? Why resume when
PM_POST_RESTORE happens?
We have following sequence when system is restored from hibernation:
- original kernel booted;
- late_initcall_sync(software_resume);
- pm_notifier_call_chain(PM_RESTORE_PREPARE);
- freeze_processes
- check & read hibernation image
- suspend all devices (.freeze())
- jump to stored kernel
- restore devices
...
So, all devices should be in frozen/suspended state when we will jump to stored kernel
(device's state should be the same as before creating hib image).
Without this patch I can see a lot of log messages like below:
Yes, I am sure a fix is needed for hibernation. But I still don't quite
understand PM_RESTORE_PREPARE and PM_POST_RESTORE.
When we enter hibernation, there's only PM_HIBERNATION_PREPARE?
When waking from hibernation, there's first PM_RESTORE_PREPARE, where we
need to disable displays that were enabled during boot. Then either
PM_POST_HIBERNATION if all went well, or PM_POST_RESTORE if there was an
error, and in both cases we want to enable the displays?
Tomi
On 20/03/15 16:57, Grygorii.Strashko@linaro.org wrote:
quoted
On 03/20/2015 02:20 PM, Tomi Valkeinen wrote:
quoted
On 25/02/15 19:03, grygorii.strashko@linaro.org wrote:
quoted
From: Grygorii Strashko <redacted>
Add handling of missed events in omap_dss_pm_notif which are
needed to support hibernation (suspend to disk).
Signed-off-by: Grygorii Strashko <redacted>
---
drivers/video/fbdev/omap2/dss/core.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -178,11 +178,15 @@ static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void *d)DSSDBG("pm notif %lu\n",v);switch(v){+casePM_HIBERNATION_PREPARE:casePM_SUSPEND_PREPARE:+casePM_RESTORE_PREPARE:DSSDBG("suspending displays\n");returndss_suspend_all_devices();casePM_POST_SUSPEND:+casePM_POST_HIBERNATION:+casePM_POST_RESTORE:DSSDBG("resuming displays\n");returndss_resume_all_devices();
Why suspend displays when PM_RESTORE_PREPARE happens? Why resume when
PM_POST_RESTORE happens?
We have following sequence when system is restored from hibernation:
- original kernel booted;
- late_initcall_sync(software_resume);
- pm_notifier_call_chain(PM_RESTORE_PREPARE);
- freeze_processes
- check & read hibernation image
- suspend all devices (.freeze())
- jump to stored kernel
- restore devices
...
So, all devices should be in frozen/suspended state when we will jump to stored kernel
(device's state should be the same as before creating hib image).
Without this patch I can see a lot of log messages like below:
Yes, I am sure a fix is needed for hibernation. But I still don't quite
understand PM_RESTORE_PREPARE and PM_POST_RESTORE.
When we enter hibernation, there's only PM_HIBERNATION_PREPARE?
No. There is always PM_POST_HIBERNATION:
- original Kernel in case of failure
- restored Kernel on success
When waking from hibernation, there's first PM_RESTORE_PREPARE, where we
need to disable displays that were enabled during boot. Then either
PM_POST_HIBERNATION if all went well, or PM_POST_RESTORE if there was an
error, and in both cases we want to enable the displays?
Yes.
==
int hibernate(void)
error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
...
error = hibernation_snapshot(hibernation_mode = HIBERNATION_PLATFORM);
^^^ restored kernel will start from here
if (error || freezer_test_done)
goto Free_bitmaps;
if (in_suspend) {
...
pr_debug("PM: writing image.\n");
error = swsusp_write(flags);
swsusp_free();
if (!error)
power_down();
in_suspend = 0;
pm_restore_gfp_mask();
^^ this part will be executed by Kernel requested Hibernation
} else {
pr_debug("PM: Image restored successfully.\n");
^^ this part will be executed by Kernel restored from Hibernation
}
...
pm_notifier_call_chain(PM_POST_HIBERNATION);
^^^ Both Kernels will be notified here:
- original Kernel in case of failure
- restored Kernel on success
==
static int software_resume(void)
error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
error = swsusp_read(&flags);
swsusp_close(FMODE_READ);
if (!error)
hibernation_restore(flags & SF_PLATFORM_MODE);
^^^ if ok we will never return from this function
printk(KERN_ERR "PM: Failed to load hibernation image, recovering.\n");
pm_notifier_call_chain(PM_POST_RESTORE);
^^^
if fail - just continue work as usual
--
regards,
-grygorii