rk3368: support cpu suspend to wfi
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rockchip / rockchip_pm.c
index 74ac848c2c649bf4e8eccb3cec5ca73aa5931df4..9a9ce3c6419729f7d6d3f040e13e02a6e0f88a67 100755 (executable)
@@ -402,6 +402,8 @@ void  rkpm_ddr_printhex(unsigned int hex)
                hex <<= 4;
        }
 }
+
+#ifdef CONFIG_ARM
 void rk_sram_suspend(void)
 {
        RKPM_DDR_FUN(regs_pread);
@@ -437,6 +439,8 @@ static int rk_lpmode_enter(unsigned long arg)
 }
 
 int cpu_suspend(unsigned long arg, int (*fn)(unsigned long));
+#endif /* CONFIG_ARM */
+
 static int rkpm_enter(suspend_state_t state)
 {
        //static u32 test_count=0;
@@ -477,6 +481,7 @@ static int rkpm_enter(suspend_state_t state)
 
         rkpm_ddr_printch('5');
 
+#ifdef CONFIG_ARM
         if(rkpm_chk_jdg_ctrbits(RKPM_CTRBITS_SOC_DLPMD))
         {   
             if(cpu_suspend(0,rk_lpmode_enter)==0)
@@ -496,6 +501,10 @@ static int rkpm_enter(suspend_state_t state)
             dsb();
             wfi();
         }
+#else
+       flush_cache_all();
+       cpu_suspend(1);
+#endif
 
         rkpm_ddr_printch('5');
 
@@ -568,6 +577,15 @@ void __init rockchip_suspend_init(void)
     return;
 }
 
+#ifndef CONFIG_ARM
+static int __init rockchip_init_suspend(void)
+{
+       suspend_set_ops(&rockchip_suspend_ops);
+       return 0;
+}
+late_initcall_sync(rockchip_init_suspend);
+#endif /* CONFIG_ARM */
+
 static enum rockchip_pm_policy pm_policy;
 static BLOCKING_NOTIFIER_HEAD(policy_notifier_list);