Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Copyright 2011 Calxeda, Inc.
0004  */
0005 
0006 #include <linux/cpu_pm.h>
0007 #include <linux/init.h>
0008 #include <linux/psci.h>
0009 #include <linux/suspend.h>
0010 
0011 #include <asm/suspend.h>
0012 
0013 #include <uapi/linux/psci.h>
0014 
0015 #define HIGHBANK_SUSPEND_PARAM \
0016     ((0 << PSCI_0_2_POWER_STATE_ID_SHIFT) | \
0017      (1 << PSCI_0_2_POWER_STATE_AFFL_SHIFT) | \
0018      (PSCI_POWER_STATE_TYPE_POWER_DOWN << PSCI_0_2_POWER_STATE_TYPE_SHIFT))
0019 
0020 static int highbank_suspend_finish(unsigned long val)
0021 {
0022     return psci_ops.cpu_suspend(HIGHBANK_SUSPEND_PARAM, __pa(cpu_resume));
0023 }
0024 
0025 static int highbank_pm_enter(suspend_state_t state)
0026 {
0027     cpu_pm_enter();
0028     cpu_cluster_pm_enter();
0029 
0030     cpu_suspend(0, highbank_suspend_finish);
0031 
0032     cpu_cluster_pm_exit();
0033     cpu_pm_exit();
0034 
0035     return 0;
0036 }
0037 
0038 static const struct platform_suspend_ops highbank_pm_ops = {
0039     .enter = highbank_pm_enter,
0040     .valid = suspend_valid_only_mem,
0041 };
0042 
0043 void __init highbank_pm_init(void)
0044 {
0045     if (!psci_ops.cpu_suspend)
0046         return;
0047 
0048     suspend_set_ops(&highbank_pm_ops);
0049 }