コード例 #1
0
int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)
{

	struct pp_power_state *pcurrent;
	struct pp_power_state *requested;
	struct pp_hwmgr *hwmgr;
	bool equal;

	if (skip)
		return 0;

	hwmgr = eventmgr->hwmgr;
	pcurrent = hwmgr->current_ps;
	requested = hwmgr->request_ps;

	if (requested == NULL)
		return 0;

	phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);

	if (pcurrent == NULL || (0 != phm_check_states_equal(hwmgr, &pcurrent->hardware, &requested->hardware, &equal)))
		equal = false;

	if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) {
		phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);
		hwmgr->current_ps = requested;
	}
	return 0;
}
コード例 #2
0
ファイル: pp_psm.c プロジェクト: Lyude/linux
static void power_state_management(struct pp_hwmgr *hwmgr,
						struct pp_power_state *new_ps)
{
	struct pp_power_state *pcurrent;
	struct pp_power_state *requested;
	bool equal;

	if (new_ps != NULL)
		requested = new_ps;
	else
		requested = hwmgr->request_ps;

	pcurrent = hwmgr->current_ps;

	phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);
	if (pcurrent == NULL || (0 != phm_check_states_equal(hwmgr,
			&pcurrent->hardware, &requested->hardware, &equal)))
		equal = false;

	if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) {
		phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);
		memcpy(hwmgr->current_ps, hwmgr->request_ps, hwmgr->ps_size);
	}
}