gpu: pvr: fix locking on the DVFS path
authorImre Deak <imre.deak@nokia.com>
Mon, 5 Apr 2010 20:18:24 +0000 (23:18 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:40 +0000 (21:09 +0300)
The HW state is protected by pvr_lock(), so acquire it for the
duration of clock rate changes. We can also remove PVRSRVDvfsLock()
that thus becomes unneded.

Signed-off-by: Imre Deak <imre.deak@nokia.com>
CC: Mark Underwood <mark.underwood@imgtec.com>
CC: Mark Riding <mark.riding@imgtec.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@nokia.com>
pvr/power.c
pvr/power.h
pvr/sysutils.c

index 35adf6a..17afd51 100644 (file)
@@ -34,8 +34,6 @@ static IMG_BOOL gbInitServerRunning;
 static IMG_BOOL gbInitServerRan;
 static IMG_BOOL gbInitSuccessful;
 static DEFINE_MUTEX(hPowerAndFreqLock);
-static DECLARE_WAIT_QUEUE_HEAD(hDvfsWq);
-static IMG_BOOL gbDvfsActive;
 
 enum PVRSRV_ERROR PVRSRVSetInitServerState(enum PVRSRV_INIT_SERVER_STATE
                                          eInitServerState, IMG_BOOL bState)
@@ -91,42 +89,15 @@ static IMG_BOOL _IsSystemStatePowered(enum PVR_POWER_STATE eSystemPowerState)
        return (IMG_BOOL)(eSystemPowerState < PVRSRV_POWER_STATE_D2);
 }
 
-void PVRSRVDvfsLock(void)
-{
-       mutex_lock(&hPowerAndFreqLock);
-       gbDvfsActive = 1;
-       mutex_unlock(&hPowerAndFreqLock);
-}
-
-void PVRSRVDvfsUnlock(void)
-{
-       mutex_lock(&hPowerAndFreqLock);
-       gbDvfsActive = 0;
-       wake_up(&hDvfsWq);
-       mutex_unlock(&hPowerAndFreqLock);
-}
-
 enum PVRSRV_ERROR PVRSRVPowerLock(u32 ui32CallerID, IMG_BOOL bSystemPowerEvent)
 {
        if (ui32CallerID == TIMER_ID) {
                if (!mutex_trylock(&hPowerAndFreqLock))
                        return PVRSRV_ERROR_RETRY;
-
-               if (gbDvfsActive) {
-                       mutex_unlock(&hPowerAndFreqLock);
-                       return PVRSRV_ERROR_RETRY;
-               }
-       } else
+       } else {
                mutex_lock(&hPowerAndFreqLock);
-
-       while (gbDvfsActive) {
-               DEFINE_WAIT(__wait);
-               prepare_to_wait(&hDvfsWq, &__wait, TASK_UNINTERRUPTIBLE);
-               mutex_unlock(&hPowerAndFreqLock);
-               schedule();
-               mutex_lock(&hPowerAndFreqLock);
-               finish_wait(&hDvfsWq, &__wait);
        }
+
        return PVRSRV_OK;
 }
 
index 807f167..3ea861e 100644 (file)
@@ -63,8 +63,6 @@ enum PVRSRV_ERROR PVRSRVSetInitServerState(enum PVRSRV_INIT_SERVER_STATE
 enum PVRSRV_ERROR PVRSRVPowerLock(u32 ui32CallerID,
                IMG_BOOL bSystemPowerEvent);
 void PVRSRVPowerUnlock(u32 ui32CallerID);
-void PVRSRVDvfsLock(void);
-void PVRSRVDvfsUnlock(void);
 
 enum PVRSRV_ERROR PVRSRVSetDevicePowerStateKM(u32 ui32DeviceIndex,
                enum PVR_POWER_STATE eNewPowerState, u32 ui32CallerID,
index 6aa8ac1..874692d 100644 (file)
@@ -144,16 +144,16 @@ static int vdd2_pre_post_func(struct notifier_block *n, unsigned long event,
                  cnd->rate);
 
        if (CLK_PRE_RATE_CHANGE == event) {
-               PVRSRVDvfsLock();
+               pvr_lock();
                PVR_TRACE("vdd2_pre_post_func: CLK_PRE_RATE_CHANGE event");
                vdd2_pre_func(n, event, ptr);
        } else if (CLK_POST_RATE_CHANGE == event) {
                PVR_TRACE("vdd2_pre_post_func: CLK_POST_RATE_CHANGE event");
                vdd2_post_func(n, event, ptr);
-               PVRSRVDvfsUnlock();
+               pvr_unlock();
        } else if (CLK_ABORT_RATE_CHANGE == event) {
                PVR_TRACE("vdd2_pre_post_func: CLK_ABORT_RATE_CHANGE event");
-               PVRSRVDvfsUnlock();
+               pvr_unlock();
        } else {
                printk(KERN_ERR "vdd2_pre_post_func: unexpected event (%lu)\n",
                        event);