本文整理汇总了C++中cpu_suspend函数的典型用法代码示例。如果您正苦于以下问题:C++ cpu_suspend函数的具体用法?C++ cpu_suspend怎么用?C++ cpu_suspend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpu_suspend函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: arm_enter_idle_state
/*
* arm_enter_idle_state - Programs CPU to enter the specified state
*
* @dev: cpuidle device
* @drv: cpuidle driver
* @idx: state index
*
* Called from the CPUidle framework to program the device to the
* specified target state selected by the governor.
*/
static int arm_enter_idle_state(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int idx)
{
int ret = 0;
struct timeval start_time, end_time;
long usec_elapsed;
if (cpuidle_debug) {
do_gettimeofday(&start_time);
}
switch (idx) {
case STANDBY:
cpu_do_idle();
break;
case L_SLEEP:
light_sleep_en();
cpu_do_idle();
light_sleep_dis();
break;
case CORE_PD:
light_sleep_en();
cpu_pm_enter();
ret = cpu_suspend(idx);
cpu_pm_exit();
light_sleep_dis();
break;
case CLUSTER_PD:
light_sleep_en();
cpu_pm_enter();
cpu_cluster_pm_enter();
ret = cpu_suspend(idx);
cpu_cluster_pm_exit();
cpu_pm_exit();
light_sleep_dis();
break;
#ifdef CONFIG_ARCH_SCX35LT8
case TOP_PD:
light_sleep_en();
cpu_pm_enter();
cpu_cluster_pm_enter();
ret = cpu_suspend(idx);
cpu_cluster_pm_exit();
cpu_pm_exit();
light_sleep_dis();
break;
#endif
default:
cpu_do_idle();
WARN(1, "[CPUIDLE]: NO THIS IDLE LEVEL!!!");
}
if (cpuidle_debug) {
do_gettimeofday(&end_time);
usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
(end_time.tv_usec - start_time.tv_usec);
pr_info("[CPUIDLE] Enter idle state: %d ,usec_elapsed = %ld \n",
idx, usec_elapsed);
}
return ret ? -1 : idx;
}
示例2: swsusp_arch_suspend
/*
* Save the current CPU state before suspend / poweroff.
*/
int notrace swsusp_arch_suspend(void)
{
#ifdef CONFIG_MTK_HIBERNATION
int retval = 0;
retval = cpu_suspend(0, arch_save_image);
if (swsusp_saved)
retval = 0;
return retval;
#else
return cpu_suspend(0, arch_save_image);
#endif
}
示例3: bl_enter_powerdown
/*
* bl_enter_powerdown - Programs CPU to enter the specified state
* @dev: cpuidle device
* @drv: The target state to be programmed
* @idx: state index
*
* Called from the CPUidle framework to program the device to the
* specified target state selected by the governor.
*/
static int bl_enter_powerdown(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int idx)
{
struct timespec ts_preidle, ts_postidle, ts_idle;
int ret;
/* Used to keep track of the total time in idle */
getnstimeofday(&ts_preidle);
BUG_ON(!irqs_disabled());
cpu_pm_enter();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
ret = cpu_suspend((unsigned long) dev, bl_powerdown_finisher);
if (ret)
BUG();
mcpm_cpu_powered_up();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
cpu_pm_exit();
getnstimeofday(&ts_postidle);
local_irq_enable();
ts_idle = timespec_sub(ts_postidle, ts_preidle);
dev->last_residency = ts_idle.tv_nsec / NSEC_PER_USEC +
ts_idle.tv_sec * USEC_PER_SEC;
return idx;
}
示例4: mcpm_powerdown_finisher
/*
static int notrace mcpm_powerdown_finisher(unsigned long arg)
{
u32 mpidr = read_cpuid_mpidr();
u32 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
u32 this_cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
mcpm_set_entry_vector(cpu, this_cluster, cpu_resume);
mcpm_cpu_suspend(arg);
return 1;
}
*/
static int mmp_pm_enter(suspend_state_t state)
{
unsigned int real_idx = mmp_suspend->suspend_state;
#ifdef CONFIG_SEC_GPIO_DVS
/************************ Caution !!! ****************************
This function must be located in appropriate SLEEP position
in accordance with the specification of each BB vendor.
************************ Caution !!! ****************************/
gpio_dvs_check_sleepgpio();
#endif
if (mmp_suspend->ops->pre_suspend_check) {
if (mmp_suspend->ops->pre_suspend_check())
return -EAGAIN;
}
cpu_suspend((unsigned long)&real_idx);
if (mmp_suspend->ops->post_chk_wakeup)
detect_wakeup_status = mmp_suspend->ops->post_chk_wakeup();
if (mmp_suspend->ops->post_clr_wakeup)
mmp_suspend->ops->post_clr_wakeup(detect_wakeup_status);
if (real_idx != mmp_suspend->suspend_state)
pr_info("WARNING!!! Suspend Didn't enter the Expected Low power mode\n");
mcpm_cpu_powered_up();
return 0;
}
示例5: hi6xxx_pm_enter
static int hi6xxx_pm_enter(suspend_state_t state)
{
//volatile int wait_loop = 600000;
pr_info("%s ++\n", __func__);
//while(wait_loop >= 0)
// wait_loop--;
cpu_pm_enter();
/*
setup_mm_for_reboot();
gic_cpu_if_down();
hisi_cluster_exit_coherence(0);
*/
hisi_set_acpu_subsys_powerdown_flag();
cpu_suspend(3);
hisi_clear_acpu_subsys_powerdown_flag();
//coherent_init();
//coherent_slave_port_config();
cpu_pm_exit();
g_pwcAcpuWakeFlagIcc = 1;
g_pwcAcpuWakeFlagRfile = 1;
pr_info("%s --\n", __func__);
pwrctrl_mcu_debug_info_show();
pwrctrl_ccpu_debug_info_show();
return 0;
}
示例6: imx6sx_enter_wait
static int imx6sx_enter_wait(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{
imx6q_set_lpm(WAIT_UNCLOCKED);
switch (index) {
case 1:
cpu_do_idle();
break;
case 2:
imx6_enable_rbc(true);
imx_gpc_set_arm_power_in_lpm(true);
imx_set_cpu_jump(0, v7_cpu_resume);
/* Need to notify there is a cpu pm operation. */
cpu_pm_enter();
cpu_cluster_pm_enter();
cpu_suspend(0, imx6sx_idle_finish);
cpu_cluster_pm_exit();
cpu_pm_exit();
imx_gpc_set_arm_power_in_lpm(false);
imx6_enable_rbc(false);
break;
default:
break;
}
imx6q_set_lpm(WAIT_CLOCKED);
return index;
}
示例7: sunxi_cpu_power_down_c2state
static int sunxi_cpu_power_down_c2state(struct cpuidle_device *dev, \
struct cpuidle_driver *drv, \
int index)
{
unsigned int mpidr = read_cpuid_mpidr();
unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
cpu_pm_enter();
//cpu_cluster_pm_enter();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
smp_wmb();
cpu_suspend(CPUIDLE_FLAG_C2_STATE, sunxi_powerdown_c2_finisher);
/*
* Since this is called with IRQs enabled, and no arch_spin_lock_irq
* variant exists, we need to disable IRQs manually here.
*/
local_irq_disable();
arch_spin_lock(&sun8i_mcpm_lock);
sun8i_cpu_use_count[cluster][cpu]++;
sun8i_cluster_use_count[cluster]++;
arch_spin_unlock(&sun8i_mcpm_lock);
local_irq_enable();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
//cpu_cluster_pm_exit();
cpu_pm_exit();
return index;
}
示例8: sa11x0_pm_enter
static int sa11x0_pm_enter(suspend_state_t state)
{
unsigned long gpio, sleep_save[SLEEP_SAVE_COUNT];
gpio = GPLR;
/* save vital registers */
SAVE(GPDR);
SAVE(GAFR);
SAVE(PPDR);
SAVE(PPSR);
SAVE(PPAR);
SAVE(PSDR);
SAVE(Ser1SDCR0);
/* Clear previous reset status */
RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR;
/* set resume return address */
PSPR = virt_to_phys(cpu_resume);
/* go zzz */
cpu_suspend(0, sa1100_finish_suspend);
/*
* Ensure not to come back here if it wasn't intended
*/
PSPR = 0;
/*
* Ensure interrupt sources are disabled; we will re-init
* the interrupt subsystem via the device manager.
*/
ICLR = 0;
ICCR = 1;
ICMR = 0;
/* restore registers */
RESTORE(GPDR);
RESTORE(GAFR);
RESTORE(PPDR);
RESTORE(PPSR);
RESTORE(PPAR);
RESTORE(PSDR);
RESTORE(Ser1SDCR0);
GPSR = gpio;
GPCR = ~gpio;
/*
* Clear the peripheral sleep-hold bit.
*/
PSSR = PSSR_PH;
return 0;
}
示例9: tegra114_idle_power_down
static int tegra114_idle_power_down(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index)
{
local_fiq_disable();
tegra_set_cpu_in_lp2();
cpu_pm_enter();
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
call_firmware_op(prepare_idle);
/* Do suspend by ourselves if the firmware does not implement it */
if (call_firmware_op(do_idle) == -ENOSYS)
cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
cpu_pm_exit();
tegra_clear_cpu_in_lp2();
local_fiq_enable();
return index;
}
示例10: tango_pm_enter
static int tango_pm_enter(suspend_state_t state)
{
if (state == PM_SUSPEND_MEM)
return cpu_suspend(0, tango_pm_powerdown);
return -EINVAL;
}
示例11: calxeda_pwrdown_idle
static int calxeda_pwrdown_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index)
{
cpu_pm_enter();
cpu_suspend(0, calxeda_idle_finish);
cpu_pm_exit();
return index;
}
示例12: swsusp_arch_suspend
/*
* Save the current CPU state before suspend / poweroff.
*/
int notrace swsusp_arch_suspend(void)
{
int retval = 0;
retval = cpu_suspend(0, __swsusp_arch_save_image);
if (swsusp_saved)
retval = 0;
return retval;
}
示例13: pxa25x_cpu_pm_enter
static void pxa25x_cpu_pm_enter(suspend_state_t state)
{
/* Clear reset status */
RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
switch (state) {
case PM_SUSPEND_MEM:
cpu_suspend(PWRMODE_SLEEP, pxa25x_finish_suspend);
break;
}
}
示例14: exynos_suspend
static int exynos_suspend(void)
{
if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
exynos_save_cp15();
writel(EXYNOS_SLEEP_MAGIC, sysram_ns_base_addr + EXYNOS_BOOT_FLAG);
writel(virt_to_phys(exynos_cpu_resume_ns),
sysram_ns_base_addr + EXYNOS_BOOT_ADDR);
return cpu_suspend(0, exynos_cpu_suspend);
}
示例15: cpu_psci_cpu_suspend
static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index)
{
int ret;
u32 *state = __this_cpu_read(psci_power_state);
/*
* idle state index 0 corresponds to wfi, should never be called
* from the cpu_suspend operations
*/
if (WARN_ON_ONCE(!index))
return -EINVAL;
if (unlikely(index >= PSCI_UNUSED_INDEX))
return cpu_suspend(index, psci_suspend_customized_finisher);
if (!psci_power_state_loses_context(state[index - 1]))
ret = psci_ops.cpu_suspend(state[index - 1], 0);
else
ret = cpu_suspend(index, psci_suspend_finisher);
return ret;
}