Beispiel #1
0
/**
 *	suspend_enter - enter the desired system sleep state.
 *	@state:		state to enter
 *
 *	This function should be called after devices have been suspended.
 */
static int suspend_enter(suspend_state_t state)
{
	int error;

	if (suspend_ops->prepare) {
		error = suspend_ops->prepare();
		if (error)
			return error;
	}

	error = dpm_suspend_noirq(PMSG_SUSPEND);
	if (error) {
		printk(KERN_ERR "PM: Some devices failed to power down\n");
		goto Platfrom_finish;
	}

	if (suspend_ops->prepare_late) {
		error = suspend_ops->prepare_late();
		if (error)
			goto Power_up_devices;
	}

	if (suspend_test(TEST_PLATFORM))
		goto Platform_wake;

	error = disable_nonboot_cpus();
	if (error || suspend_test(TEST_CPUS))
		goto Enable_cpus;

	error = _suspend_enter(state);
#ifdef CONFIG_QUICK_WAKEUP
		while (!error && !quickwakeup_execute()) {
			if (has_wake_lock(WAKE_LOCK_SUSPEND))
				break;
			error = _suspend_enter(state);
		}
#endif

 Enable_cpus:
	enable_nonboot_cpus();

 Platform_wake:
	if (suspend_ops->wake)
		suspend_ops->wake();

 Power_up_devices:
	dpm_resume_noirq(PMSG_RESUME);

 Platfrom_finish:
	if (suspend_ops->finish)
		suspend_ops->finish();

	return error;
}
Beispiel #2
0
/**
 *	suspend_enter - enter the desired system sleep state.
 *	@state:		state to enter
 *
 *	This function should be called after devices have been suspended.
 */
static int suspend_enter(suspend_state_t state)
{
	int error = 0;
	device_pm_lock();
	error = _suspend_enter(state);

#ifdef CONFIG_QUICK_WAKEUP
	while (!error && !quickwakeup_execute()) {
		if (has_wake_lock(WAKE_LOCK_SUSPEND))
			break;
		error = _suspend_enter(state);
	}
#endif
	device_pm_unlock();
	return error;
}