From: Imre Deak Date: Mon, 5 Apr 2010 20:56:34 +0000 (+0300) Subject: gpu: pvr: remove PVRSRVPowerLock() X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03f81c53010398abcab9b93ded9c1892e54e09ed;p=sgx.git gpu: pvr: remove PVRSRVPowerLock() For the relevant paths we already hold pvr_lock(), so we this lock is unnecessary. Signed-off-by: Imre Deak CC: Mark Underwood CC: Mark Riding Reviewed-by: Topi Pohjolainen Reviewed-by: Ville Syrjälä --- diff --git a/pvr/power.c b/pvr/power.c index 17afd51..1cfeb41 100644 --- a/pvr/power.c +++ b/pvr/power.c @@ -89,23 +89,6 @@ static IMG_BOOL _IsSystemStatePowered(enum PVR_POWER_STATE eSystemPowerState) 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) @@ -235,9 +218,6 @@ enum PVRSRV_ERROR PVRSRVSetDevicePowerStateKM(u32 ui32DeviceIndex, 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 = @@ -277,9 +257,6 @@ Exit: eNewPowerState, eError); } - if (!bRetainMutex || (eError != PVRSRV_OK)) - PVRSRVPowerUnlock(ui32CallerID); - return eError; } @@ -294,10 +271,6 @@ enum PVRSRV_ERROR PVRSRVSystemPrePowerStateKM( 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)) @@ -327,8 +300,6 @@ ErrorExit: psSysData->eFailedPowerState = eNewPowerState; - PVRSRVPowerUnlock(KERNEL_ID); - return eError; } @@ -371,8 +342,6 @@ enum PVRSRV_ERROR PVRSRVSystemPostPowerStateKM( Exit: - PVRSRVPowerUnlock(KERNEL_ID); - if (_IsSystemStatePowered(eNewPowerState) && PVRSRVGetInitServerState(PVRSRV_INIT_SERVER_SUCCESSFUL)) PVRSRVCommandCompleteCallbacks(); @@ -554,9 +523,6 @@ enum PVRSRV_ERROR PVRSRVDevicePreClockSpeedChange(u32 ui32DeviceIndex, psPowerDevice = psPowerDevice->psNext; } - if (bIdleDevice && eError != PVRSRV_OK) - PVRSRVPowerUnlock(KERNEL_ID); - return eError; } diff --git a/pvr/power.h b/pvr/power.h index 3ea861e..53dd6a3 100644 --- a/pvr/power.h +++ b/pvr/power.h @@ -60,10 +60,6 @@ enum PVRSRV_ERROR PVRSRVSetInitServerState(enum PVRSRV_INIT_SERVER_STATE eInitServerState, IMG_BOOL bState); -enum PVRSRV_ERROR PVRSRVPowerLock(u32 ui32CallerID, - IMG_BOOL bSystemPowerEvent); -void PVRSRVPowerUnlock(u32 ui32CallerID); - enum PVRSRV_ERROR PVRSRVSetDevicePowerStateKM(u32 ui32DeviceIndex, enum PVR_POWER_STATE eNewPowerState, u32 ui32CallerID, IMG_BOOL bRetainMutex); diff --git a/pvr/sgxinit.c b/pvr/sgxinit.c index 439e8c0..a84c7ee 100644 --- a/pvr/sgxinit.c +++ b/pvr/sgxinit.c @@ -679,16 +679,6 @@ void HWRecoveryResetSGX(struct PVRSRV_DEVICE_NODE *psDeviceNode, 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); @@ -711,8 +701,6 @@ void HWRecoveryResetSGX(struct PVRSRV_DEVICE_NODE *psDeviceNode, PDUMPRESUME(); - PVRSRVPowerUnlock(ui32CallerID); - SGXScheduleProcessQueuesKM(psDeviceNode); PVRSRVProcessQueues(ui32CallerID, IMG_TRUE); @@ -733,7 +721,6 @@ static void SGXOSTimer(struct work_struct *work) u32 ui32CurrentEDMTasks; IMG_BOOL bLockup = IMG_FALSE; IMG_BOOL bPoweredDown; - enum PVRSRV_ERROR eError; pvr_lock(); if (!data->armed) { @@ -743,17 +730,6 @@ static void SGXOSTimer(struct work_struct *work) 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 @@ -800,10 +776,8 @@ static void SGXOSTimer(struct work_struct *work) /* 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)); @@ -1534,7 +1508,6 @@ enum PVRSRV_ERROR SGXReadDiffCountersKM(void *hDevHandle, u32 ui32Reg, 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; @@ -1545,10 +1518,6 @@ enum PVRSRV_ERROR SGXReadDiffCountersKM(void *hDevHandle, u32 ui32Reg, psDevInfo->ui32HWGroupRequested = ui32New; psDevInfo->ui32HWReset |= ui32NewReset; - eError = PVRSRVPowerLock(KERNEL_ID, IMG_FALSE); - if (eError != PVRSRV_OK) - return eError; - SysAcquireData(&psSysData); psPowerDevice = psSysData->psPowerDeviceList; @@ -1632,11 +1601,9 @@ enum PVRSRV_ERROR SGXReadDiffCountersKM(void *hDevHandle, u32 ui32Reg, } } - PVRSRVPowerUnlock(KERNEL_ID); - SGXTestActivePowerEvent(psDeviceNode, KERNEL_ID); - return eError; + return PVRSRV_OK; } enum PVRSRV_ERROR SGXReadHWPerfCBKM(void *hDevHandle, u32 ui32ArraySize, diff --git a/pvr/sgxutils.c b/pvr/sgxutils.c index 5b04f04..aac6d51 100644 --- a/pvr/sgxutils.c +++ b/pvr/sgxutils.c @@ -296,8 +296,6 @@ enum PVRSRV_ERROR SGXScheduleCCBCommandKM( eError = SGXScheduleCCBCommand(psDevInfo, eCommandType, psCommandData, ui32CallerID, ui32PDumpFlags); - PVRSRVPowerUnlock(ui32CallerID); - if (ui32CallerID != ISR_ID) SGXTestActivePowerEvent(psDeviceNode, ui32CallerID);