Example #1
0
enum PVRSRV_ERROR PVRSRVSystemPrePowerStateKM(
		enum PVR_POWER_STATE eNewPowerState)
{
	enum PVRSRV_ERROR eError;
	struct SYS_DATA *psSysData;
	enum PVR_POWER_STATE eNewDevicePowerState;

	eError = SysAcquireData(&psSysData);
	if (eError != PVRSRV_OK)
		return eError;

	eError = PVRSRVPowerLock(KERNEL_ID, IMG_TRUE);
	if (eError != PVRSRV_OK)
		return eError;

	if (_IsSystemStatePowered(eNewPowerState) !=
	    _IsSystemStatePowered(psSysData->eCurrentPowerState)) {
		if (_IsSystemStatePowered(eNewPowerState))
			eNewDevicePowerState = PVRSRV_POWER_Unspecified;
		else
			eNewDevicePowerState = PVRSRV_POWER_STATE_D3;

		eError = PVRSRVDevicePrePowerStateKM(IMG_TRUE, 0,
						eNewDevicePowerState);
		if (eError != PVRSRV_OK)
			goto ErrorExit;
	}

	if (eNewPowerState != psSysData->eCurrentPowerState) {
		eError = SysSystemPrePowerState(eNewPowerState);
		if (eError != PVRSRV_OK)
			goto ErrorExit;
	}

	return eError;

ErrorExit:

	PVR_DPF(PVR_DBG_ERROR, "PVRSRVSystemPrePowerStateKM: "
				"Transition from %d to %d FAILED 0x%x",
		 psSysData->eCurrentPowerState, eNewPowerState, eError);

	psSysData->eFailedPowerState = eNewPowerState;

	PVRSRVPowerUnlock(KERNEL_ID);

	return eError;
}
Example #2
0
IMG_EXPORT
PVRSRV_ERROR PVRSRVSystemPrePowerStateKM(PVRSRV_SYS_POWER_STATE eNewSysPowerState)
{
	PVRSRV_ERROR			eError;
	SYS_DATA				*psSysData;
	PVRSRV_DEV_POWER_STATE	eNewDevicePowerState;

	SysAcquireData(&psSysData);


	eError = PVRSRVPowerLock(KERNEL_ID, IMG_TRUE);
	if(eError != PVRSRV_OK)
	{
		return eError;
	}

	if (_IsSystemStatePowered(eNewSysPowerState) !=
		_IsSystemStatePowered(psSysData->eCurrentPowerState))
	{
		if (_IsSystemStatePowered(eNewSysPowerState))
		{

			eNewDevicePowerState = PVRSRV_DEV_POWER_STATE_DEFAULT;
		}
		else
		{
			eNewDevicePowerState = PVRSRV_DEV_POWER_STATE_OFF;
		}


		eError = PVRSRVDevicePrePowerStateKM(IMG_TRUE, 0, eNewDevicePowerState);
		if (eError != PVRSRV_OK)
		{
			goto ErrorExit;
		}
	}

	if (eNewSysPowerState != psSysData->eCurrentPowerState)
	{

		eError = SysSystemPrePowerState(eNewSysPowerState);
		if (eError != PVRSRV_OK)
		{
			goto ErrorExit;
		}
	}

	return eError;

ErrorExit:

	PVR_DPF((PVR_DBG_ERROR,
			"PVRSRVSystemPrePowerStateKM: Transition from %d to %d FAILED 0x%x",
			psSysData->eCurrentPowerState, eNewSysPowerState, eError));


	psSysData->eFailedPowerState = eNewSysPowerState;

	PVRSRVPowerUnlock(KERNEL_ID);

	return eError;
}