[RFC] [PATCH 1/2] ARM: Exynos4: CPUIDLE: Add generic function for exynos4 cpuidle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Moved out the code from exynos4_enter_core0_aftr to a separate
function "exynos4_do_idle" in order to make it usable for other
idle states.

Also update the wakeup mask without touching reserved bits.

Signed-off-by: Inderpal Singh <inderpal.singh@xxxxxxxxxx>
Signed-off-by: Chander Kashyap <chander.kashyap@xxxxxxxxxx>
---
 arch/arm/mach-exynos/cpuidle.c |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index cff0595..5e489a7 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -60,9 +60,11 @@ static struct cpuidle_driver exynos4_idle_driver = {
 };
 
 /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
-static void exynos4_set_wakeupmask(void)
+static void exynos4_set_wakeupmask(int index)
 {
-	__raw_writel(0x0000ff3e, S5P_WAKEUP_MASK);
+	unsigned long mask = __raw_readl(S5P_WAKEUP_MASK) & 0xFFF00000;
+	if (index == 1)
+		__raw_writel(mask | 0x0000ff3e, S5P_WAKEUP_MASK);
 }
 
 static unsigned int g_pwr_ctrl, g_diag_reg;
@@ -91,19 +93,17 @@ static int idle_finisher(unsigned long flags)
 	return 1;
 }
 
-static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
-				struct cpuidle_driver *drv,
-				int index)
+static void exynos4_do_idle(int index, int pd_conf, int lp_mode_magic)
 {
 	unsigned long tmp;
 
-	exynos4_set_wakeupmask();
+	exynos4_set_wakeupmask(index);
 
-	/* Set value of power down register for aftr mode */
-	exynos_sys_powerdown_conf(SYS_AFTR);
+	/* Set value of power down register for requested LP mode */
+	exynos_sys_powerdown_conf(pd_conf);
 
 	__raw_writel(virt_to_phys(s3c_cpu_resume), REG_DIRECTGO_ADDR);
-	__raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG);
+	__raw_writel(lp_mode_magic, REG_DIRECTGO_FLAG);
 
 	save_cpu_arch_register();
 
@@ -136,7 +136,13 @@ static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
 
 	/* Clear wakeup state register */
 	__raw_writel(0x0, S5P_WAKEUP_STAT);
+}
 
+static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
+				struct cpuidle_driver *drv,
+				int index)
+{
+	exynos4_do_idle(index, SYS_AFTR, S5P_CHECK_AFTR);
 	return index;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux