]> Pileus Git - ~andy/linux/commitdiff
ARM: SAMSUNG: Gracefully exit on suspend failure
authorAbhilash Kesavan <a.kesavan@samsung.com>
Fri, 25 Jan 2013 18:40:19 +0000 (10:40 -0800)
committerKukjin Kim <kgene.kim@samsung.com>
Thu, 31 Jan 2013 06:28:05 +0000 (22:28 -0800)
As per the Exynos5250 User Manual:
When there are pending interrupt events, WFI/WFE instruction are
ignored. To cancel the power-down sequence follow these steps:
1) Disable system power-down using CENTRAL_SEQ_CONFIGURATION register
2) Clear WAKEUP_STAT register
3) Enable interrupt service routine for CPU

Code for early wakeup for exynos already exists. Remove the panic
on suspend failure, clear the wakeup state register and return 1
from cpu_suspend to indicate a failed suspend (to a user daemon).

Older Samsung SoCs have similar panics and I have removed them all.
Haven't touched the S3C2410 sleep code.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
arch/arm/mach-exynos/pm.c
arch/arm/mach-s3c24xx/pm-s3c2412.c
arch/arm/mach-s3c24xx/pm-s3c2416.c
arch/arm/mach-s3c64xx/pm.c
arch/arm/mach-s5p64x0/pm.c
arch/arm/mach-s5pv210/pm.c
arch/arm/plat-samsung/pm.c

index b9b539cac81e12869523ceb6c8e5e0817f6092a0..5106ab83e593f8c3902d77a19b5efff00b46d4db 100644 (file)
@@ -91,8 +91,8 @@ static int exynos_cpu_suspend(unsigned long arg)
        /* issue the standby signal into the pm unit. */
        cpu_do_idle();
 
-       /* we should never get past here */
-       panic("sleep resumed to originator?");
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
 }
 
 static void exynos_pm_prepare(void)
@@ -282,6 +282,8 @@ static void exynos_pm_resume(void)
        if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
                tmp |= S5P_CENTRAL_LOWPWR_CFG;
                __raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
+               /* clear the wakeup state register */
+               __raw_writel(0x0, S5P_WAKEUP_STAT);
                /* No need to perform below restore code */
                goto early_wakeup;
        }
index c60f67a75afff8ba291d712091a744696e64893c..f5dc2b254a5a0b1a072aac5687c1cc3c86c708f9 100644 (file)
@@ -48,7 +48,8 @@ static int s3c2412_cpu_suspend(unsigned long arg)
 
        s3c2412_sleep_enter();
 
-       panic("sleep resumed to originator?");
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
 }
 
 static void s3c2412_pm_prepare(void)
index 1bd4817b8eb8bef37a762e9fa870a1b8900522d5..1a9e8dd194ff87b09025990d89a3774ad12156b8 100644 (file)
@@ -34,7 +34,8 @@ static int s3c2416_cpu_suspend(unsigned long arg)
 
        s3c2412_sleep_enter();
 
-       panic("sleep resumed to originator?");
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
 }
 
 static void s3c2416_pm_prepare(void)
index 7feb426fc202d10be8f74a8992b5de212b6e4ba0..54d48b857f70718e130dacfea7cc6fd7e0f0c30f 100644 (file)
@@ -296,7 +296,8 @@ static int s3c64xx_cpu_suspend(unsigned long arg)
 
        /* we should never get past here */
 
-       panic("sleep resumed to originator?");
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
 }
 
 /* mapping of interrupts to parts of the wakeup mask */
index 9cba18bfe47bbd56bc197518fdd48496f5980664..97c2a08ad4903a6e23839bc96b12e454f8c1135a 100644 (file)
@@ -103,8 +103,8 @@ static int s5p64x0_cpu_suspend(unsigned long arg)
            "mcr p15, 0, %0, c7, c10, 4\n\t"
            "mcr p15, 0, %0, c7, c0, 4" : : "r" (tmp));
 
-       /* we should never get past here */
-       panic("sleep resumed to originator?");
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
 }
 
 /* mapping of interrupts to parts of the wakeup mask */
index 736bfb103cbc4acc3e38f057bd018cc841e2b420..2b68a67b6e953fe992494f9bcca2744c6abb1e8a 100644 (file)
@@ -104,8 +104,8 @@ static int s5pv210_cpu_suspend(unsigned long arg)
            "mcr p15, 0, %0, c7, c10, 4\n\t"
            "wfi" : : "r" (tmp));
 
-       /* we should never get past here */
-       panic("sleep resumed to originator?");
+       pr_info("Failed to suspend the system\n");
+       return 1; /* Aborting suspend */
 }
 
 static void s5pv210_pm_prepare(void)
index d896add68ad3503d4ede95b9f132a4799036fdbf..002b1472293b4e34459e7563dd3edd8af0ecf93b 100644 (file)
@@ -243,6 +243,7 @@ int (*pm_cpu_sleep)(unsigned long);
 
 static int s3c_pm_enter(suspend_state_t state)
 {
+       int ret;
        /* ensure the debug is initialised (if enabled) */
 
        s3c_pm_debug_init();
@@ -300,7 +301,9 @@ static int s3c_pm_enter(suspend_state_t state)
         * we resume as it saves its own register state and restores it
         * during the resume.  */
 
-       cpu_suspend(0, pm_cpu_sleep);
+       ret = cpu_suspend(0, pm_cpu_sleep);
+       if (ret)
+               return ret;
 
        /* restore the system state */