return (IMG_BOOL)(eSystemPowerState < PVRSRV_POWER_STATE_D2);
}
-enum PVRSRV_ERROR PVRSRVPowerLock(u32 ui32CallerID, IMG_BOOL bSystemPowerEvent)
-{
- if (ui32CallerID == TIMER_ID) {
- if (!mutex_trylock(&hPowerAndFreqLock))
- return PVRSRV_ERROR_RETRY;
- } else {
- mutex_lock(&hPowerAndFreqLock);
- }
-
- return PVRSRV_OK;
-}
-
-void PVRSRVPowerUnlock(u32 ui32CallerID)
-{
- mutex_unlock(&hPowerAndFreqLock);
-}
-
static enum PVRSRV_ERROR PVRSRVDevicePrePowerStateKM(IMG_BOOL bAllDevices,
u32 ui32DeviceIndex,
enum PVR_POWER_STATE eNewPowerState)
if (eError != PVRSRV_OK)
return eError;
- eError = PVRSRVPowerLock(ui32CallerID, IMG_FALSE);
- if (eError != PVRSRV_OK)
- return eError;
#if defined(PDUMP)
if (eNewPowerState == PVRSRV_POWER_Unspecified) {
eError =
eNewPowerState, eError);
}
- if (!bRetainMutex || (eError != PVRSRV_OK))
- PVRSRVPowerUnlock(ui32CallerID);
-
return eError;
}
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))
psSysData->eFailedPowerState = eNewPowerState;
- PVRSRVPowerUnlock(KERNEL_ID);
-
return eError;
}
Exit:
- PVRSRVPowerUnlock(KERNEL_ID);
-
if (_IsSystemStatePowered(eNewPowerState) &&
PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_SUCCESSFUL))
PVRSRVCommandCompleteCallbacks();
psPowerDevice = psPowerDevice->psNext;
}
- if (bIdleDevice && eError != PVRSRV_OK)
- PVRSRVPowerUnlock(KERNEL_ID);
-
return eError;
}
BUG_ON(!pvr_is_locked());
- /* SGXOSTimer already has the lock as it needs to read SGX registers */
- if (ui32CallerID != TIMER_ID) {
- eError = PVRSRVPowerLock(ui32CallerID, IMG_FALSE);
- if (eError != PVRSRV_OK) {
- PVR_DPF(PVR_DBG_WARNING, "HWRecoveryResetSGX: "
- "Power transition in progress");
- return;
- }
- }
-
l = readl(&psSGXHostCtl->ui32InterruptClearFlags);
l |= PVRSRV_USSE_EDM_INTERRUPT_HWR;
writel(l, &psSGXHostCtl->ui32InterruptClearFlags);
PDUMPRESUME();
- PVRSRVPowerUnlock(ui32CallerID);
-
SGXScheduleProcessQueuesKM(psDeviceNode);
PVRSRVProcessQueues(ui32CallerID, IMG_TRUE);
u32 ui32CurrentEDMTasks;
IMG_BOOL bLockup = IMG_FALSE;
IMG_BOOL bPoweredDown;
- enum PVRSRV_ERROR eError;
pvr_lock();
if (!data->armed) {
psDevInfo->ui32TimeStamp++;
- eError = PVRSRVPowerLock(TIMER_ID, IMG_FALSE);
- if (eError != PVRSRV_OK) {
- /*
- * If a power transition is in progress then we're not really
- * sure what the state of world is going to be after, so we
- * just "pause" HW recovery and hopefully next time around we
- * get the lock and can decide what to do
- */
- goto rearm;
- }
-
#if defined(NO_HARDWARE)
bPoweredDown = IMG_TRUE;
#else
/* Note: This will release the lock when done */
HWRecoveryResetSGX(psDeviceNode, 0, TIMER_ID);
- } else
- PVRSRVPowerUnlock(TIMER_ID);
+ }
- rearm:
queue_delayed_work(data->work_queue, &data->work,
msecs_to_jiffies(data->interval));
u32 *pui32Time, IMG_BOOL *pbActive,
struct PVRSRV_SGXDEV_DIFF_INFO *psDiffs)
{
- enum PVRSRV_ERROR eError;
struct SYS_DATA *psSysData;
struct PVRSRV_POWER_DEV *psPowerDevice;
IMG_BOOL bPowered = IMG_FALSE;
psDevInfo->ui32HWGroupRequested = ui32New;
psDevInfo->ui32HWReset |= ui32NewReset;
- eError = PVRSRVPowerLock(KERNEL_ID, IMG_FALSE);
- if (eError != PVRSRV_OK)
- return eError;
-
SysAcquireData(&psSysData);
psPowerDevice = psSysData->psPowerDeviceList;
}
}
- PVRSRVPowerUnlock(KERNEL_ID);
-
SGXTestActivePowerEvent(psDeviceNode, KERNEL_ID);
- return eError;
+ return PVRSRV_OK;
}
enum PVRSRV_ERROR SGXReadHWPerfCBKM(void *hDevHandle, u32 ui32ArraySize,