Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3fcacf5 authored by Abhilash Kesavan's avatar Abhilash Kesavan Committed by Kukjin Kim
Browse files

ARM: SAMSUNG: Gracefully exit on suspend failure



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: default avatarAbhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent 8baaa265
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -91,8 +91,8 @@ static int exynos_cpu_suspend(unsigned long arg)
	/* issue the standby signal into the pm unit. */
	/* issue the standby signal into the pm unit. */
	cpu_do_idle();
	cpu_do_idle();


	/* we should never get past here */
	pr_info("Failed to suspend the system\n");
	panic("sleep resumed to originator?");
	return 1; /* Aborting suspend */
}
}


static void exynos_pm_prepare(void)
static void exynos_pm_prepare(void)
@@ -282,6 +282,8 @@ static void exynos_pm_resume(void)
	if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
	if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
		tmp |= S5P_CENTRAL_LOWPWR_CFG;
		tmp |= S5P_CENTRAL_LOWPWR_CFG;
		__raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
		__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 */
		/* No need to perform below restore code */
		goto early_wakeup;
		goto early_wakeup;
	}
	}
+2 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,8 @@ static int s3c2412_cpu_suspend(unsigned long arg)


	s3c2412_sleep_enter();
	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)
static void s3c2412_pm_prepare(void)
+2 −1
Original line number Original line Diff line number Diff line
@@ -34,7 +34,8 @@ static int s3c2416_cpu_suspend(unsigned long arg)


	s3c2412_sleep_enter();
	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)
static void s3c2416_pm_prepare(void)
+2 −1
Original line number Original line Diff line number Diff line
@@ -296,7 +296,8 @@ static int s3c64xx_cpu_suspend(unsigned long arg)


	/* we should never get past here */
	/* 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 */
/* mapping of interrupts to parts of the wakeup mask */
+2 −2
Original line number Original line Diff line number Diff line
@@ -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, c10, 4\n\t"
	    "mcr p15, 0, %0, c7, c0, 4" : : "r" (tmp));
	    "mcr p15, 0, %0, c7, c0, 4" : : "r" (tmp));


	/* we should never get past here */
	pr_info("Failed to suspend the system\n");
	panic("sleep resumed to originator?");
	return 1; /* Aborting suspend */
}
}


/* mapping of interrupts to parts of the wakeup mask */
/* mapping of interrupts to parts of the wakeup mask */
Loading