X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=arch%2Farm%2Fmach-rockchip%2Frockchip_pm.c;h=2ac0c61c44b294a100ecbad7f01b7b105c323cad;hb=9ad64eb2bfeb69b70bfb71c65ab7339fbfd8e091;hp=9a9ce3c6419729f7d6d3f040e13e02a6e0f88a67;hpb=bf3c956402dcbea85d4551dbe9bd2ee1451a3a8d;p=firefly-linux-kernel-4.4.55.git diff --git a/arch/arm/mach-rockchip/rockchip_pm.c b/arch/arm/mach-rockchip/rockchip_pm.c index 9a9ce3c64197..2ac0c61c44b2 100755 --- a/arch/arm/mach-rockchip/rockchip_pm.c +++ b/arch/arm/mach-rockchip/rockchip_pm.c @@ -7,7 +7,7 @@ #include #include #include - +#include #include #include "pm.h" @@ -26,7 +26,7 @@ void rkpm_ddr_regs_dump(void __iomem * base_addr,u32 start_offset,u32 end_offse //u32 line=0; rkpm_ddr_printascii("start from:"); - rkpm_ddr_printhex((u32)(base_addr +start_offset)); + rkpm_ddr_printhex((unsigned long)base_addr + start_offset); rkpm_ddr_printch('\n'); @@ -403,6 +403,18 @@ void rkpm_ddr_printhex(unsigned int hex) } } +#ifdef CONFIG_ARM_PSCI +static bool psci_suspend_available(void) +{ + return (psci_ops.cpu_suspend != NULL); +} +#else +static inline bool psci_suspend_available(void) +{ + return false; +} +#endif + #ifdef CONFIG_ARM void rk_sram_suspend(void) { @@ -411,9 +423,17 @@ void rk_sram_suspend(void) call_with_stack(p_suspend_pie_cb , &rkpm_jdg_sram_ctrbits, rockchip_sram_stack); } + static int rk_lpmode_enter(unsigned long arg) { +#ifdef CONFIG_ARM_PSCI + const struct psci_power_state ps = { + .type = PSCI_POWER_STATE_TYPE_POWER_DOWN, + }; + if (psci_suspend_available()) + return psci_ops.cpu_suspend(ps, virt_to_phys(cpu_resume)); +#endif //RKPM_DDR_PFUN(slp_setting(rkpm_jdg_sram_ctrbits),slp_setting); RKPM_DDR_FUN(slp_setting); @@ -447,7 +467,13 @@ static int rkpm_enter(suspend_state_t state) // printk(KERN_DEBUG"pm: "); printk("%s:\n",__FUNCTION__); //printk("pm test times=%d\n",++test_count); - + +#ifdef CONFIG_ARM_PSCI + if (psci_suspend_available()) { + cpu_suspend(0, rk_lpmode_enter); + return 0; + } +#endif RKPM_DDR_FUN(prepare); rkpm_ctrbits_prepare();