Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / firmware / psci.c
index 11bfee8b79a9f65418bcbe53dfc708edb220e69d..6da0c018afd9fd57c6df386a6c6d2dfc289fa406 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/suspend.h>
+#include <linux/regulator/machine.h>
 
 #include <uapi/linux/psci.h>
 
 #include <asm/smp_plat.h>
 #include <asm/suspend.h>
 
+#ifdef CONFIG_FIQ_DEBUGGER_EL3_TO_EL1
+#include <linux/rockchip/rockchip_sip.h>
+#endif
+
 /*
  * While a 64-bit OS can make calls with SMC32 calling conventions, for some
  * calls it is necessary to use SMC64 to pass or return 64-bit values.
@@ -350,6 +355,9 @@ int psci_cpu_suspend_enter(unsigned long index)
        else
                ret = cpu_suspend(index, psci_suspend_finisher);
 
+#ifdef CONFIG_FIQ_DEBUGGER_EL3_TO_EL1
+       psci_enable_fiq();
+#endif
        return ret;
 }
 
@@ -375,9 +383,25 @@ static int psci_system_suspend_enter(suspend_state_t state)
        return cpu_suspend(0, psci_system_suspend);
 }
 
+static int psci_system_suspend_prepare(void)
+{
+       return regulator_suspend_prepare(PM_SUSPEND_MEM);
+}
+
+static void psci_system_suspend_finish(void)
+{
+       int ret;
+
+       ret = regulator_suspend_finish();
+       if (ret < 0)
+               pr_warn("regulator_suspend_finish failed (%d)\n", ret);
+}
+
 static const struct platform_suspend_ops psci_suspend_ops = {
        .valid          = suspend_valid_only_mem,
        .enter          = psci_system_suspend_enter,
+       .prepare        = psci_system_suspend_prepare,
+       .finish         = psci_system_suspend_finish,
 };
 
 static void __init psci_init_system_suspend(void)