int pm_autosleep_set_state(suspend_state_t state)
{

#ifndef CONFIG_HIBERNATION
	if (state >= PM_SUSPEND_MAX)
		return -EINVAL;
#endif

	__pm_stay_awake(autosleep_ws);

	mutex_lock(&autosleep_lock);

	autosleep_state = state;

	__pm_relax(autosleep_ws);

	if (state > PM_SUSPEND_ON) {
		pm_wakep_autosleep_enabled(true);
		queue_up_suspend_work();
#ifdef CONFIG_POWERSUSPEND
		// Yank555.lu : add hook to handle powersuspend tasks (sleep)
		set_power_suspend_state_autosleep_hook(POWER_SUSPEND_ACTIVE);
#endif
	} else {
		pm_wakep_autosleep_enabled(false);
#ifdef CONFIG_POWERSUSPEND
		// Yank555.lu : add hook to handle powersuspend tasks (wakeup)
		set_power_suspend_state_autosleep_hook(POWER_SUSPEND_INACTIVE);
#endif
	}

	mutex_unlock(&autosleep_lock);
	return 0;
}
Beispiel #2
0
int __ref pm_autosleep_set_state(suspend_state_t state)
{

#ifndef CONFIG_HIBERNATION
	if (state >= PM_SUSPEND_MAX)
		return -EINVAL;
#endif

	__pm_stay_awake(autosleep_ws);

	mutex_lock(&autosleep_lock);

	autosleep_state = state;

	__pm_relax(autosleep_ws);

	if (state > PM_SUSPEND_ON) {
		pm_wakep_autosleep_enabled(true);
		queue_up_suspend_work();
	} else {
		pm_wakep_autosleep_enabled(false);
	}

	if (IS_ENABLED(CONFIG_PM_EARLYSUSPEND))
		pm_request_early_suspend_state(state);

	mutex_unlock(&autosleep_lock);
	return 0;
}
int pm_autosleep_set_state(suspend_state_t state)
{

#ifndef CONFIG_HIBERNATION
	if (state >= PM_SUSPEND_MAX)
		return -EINVAL;
#endif

	__pm_stay_awake(autosleep_ws);

	mutex_lock(&autosleep_lock);

	autosleep_state = state;

	__pm_relax(autosleep_ws);

	if (state > PM_SUSPEND_ON) {
		pm_wakep_autosleep_enabled(true);
		queue_up_suspend_work();
#ifndef CONFIG_PM_SYNC_BEFORE_SUSPEND
		printk(KERN_INFO "PM: Syncing filesystems ... ");
		sys_sync();
		printk("done.\n");
#endif
	} else {
		pm_wakep_autosleep_enabled(false);
	}

	mutex_unlock(&autosleep_lock);
	return 0;
}
int pm_autosleep_set_state(suspend_state_t state)
{

#ifndef CONFIG_HIBERNATION
	if (state >= PM_SUSPEND_MAX)
		return -EINVAL;
#endif

	__pm_stay_awake(autosleep_ws);

	mutex_lock(&autosleep_lock);

	autosleep_state = state;

	__pm_relax(autosleep_ws);

	if (state > PM_SUSPEND_ON) {
		pm_wakep_autosleep_enabled(true);
		zw_queue_up_suspend_work(state);
		queue_up_suspend_work();
	} else {
		pm_wakep_autosleep_enabled(false);
	}

	mutex_unlock(&autosleep_lock);
	return 0;
}
int pm_autosleep_set_state(suspend_state_t state)
{
#ifdef CONFIG_SEC_GPIO_DVS
	static bool gpio_init_done = false;
#endif

#ifndef CONFIG_HIBERNATION
	if (state >= PM_SUSPEND_MAX)
		return -EINVAL;
#endif

#ifdef CONFIG_SEC_GPIO_DVS
		/************************ Caution !!! ****************************/
		/* This function must be located in appropriate INIT position
		 * in accordance with the specification of each BB vendor.
		 */
		/************************ Caution !!! ****************************/
	if (unlikely(!gpio_init_done) && state==PM_SUSPEND_ON) {
		gpio_dvs_check_initgpio();
		gpio_init_done = true;
	}
#endif

	__pm_stay_awake(autosleep_ws);

	mutex_lock(&autosleep_lock);

	autosleep_state = state;

	__pm_relax(autosleep_ws);

#ifdef CONFIG_SEC_PM_DEBUG
	wakeup_sources_stats_active();
#endif

	if (state > PM_SUSPEND_ON) {
		pm_wakep_autosleep_enabled(true);
#ifdef CONFIG_ADAPTIVE_KSM
		AKSM_suspend();
#endif
		queue_up_suspend_work();
	} else {
#ifdef CONFIG_ADAPTIVE_KSM
		AKSM_resume();
#endif
		pm_wakep_autosleep_enabled(false);
	}

	mutex_unlock(&autosleep_lock);
	return 0;
}
int pm_autosleep_set_state(suspend_state_t state)
{

#ifndef CONFIG_HIBERNATION
	if (state >= PM_SUSPEND_MAX)
		return -EINVAL;
#endif

	__pm_stay_awake(autosleep_ws);

	mutex_lock(&autosleep_lock);

	autosleep_state = state;

	__pm_relax(autosleep_ws);

	if (state > PM_SUSPEND_ON) {
		pm_wakep_autosleep_enabled(true);
		//[+++]Debug for active wakelock before entering suspend
        g_resume_status = false;
		//Add a timer to trigger wakelock debug
        pr_info("[PM]unattended_timer: mod_timer (auto_sleep)\n");
        mod_timer(&unattended_timer, jiffies + msecs_to_jiffies(PM_UNATTENDED_TIMEOUT));
		//[---]Debug for active wakelock before entering suspend
		queue_up_suspend_work();
	} else {
		pm_wakep_autosleep_enabled(false);
		//[+++]Debug for active wakelock before entering suspend
		//Add a timer to trigger wakelock debug
        pr_info("[PM]unattended_timer: del_timer (late_resume)\n");
        del_timer(&unattended_timer);
		//[---]Debug for active wakelock before entering suspend
	}

	mutex_unlock(&autosleep_lock);
	return 0;
}