RK3368 GPU version: L0.11
authorzxl <zhuangxl@rock-chips.com>
Sat, 28 Mar 2015 03:57:28 +0000 (11:57 +0800)
committerzxl <zhuangxl@rock-chips.com>
Sat, 28 Mar 2015 03:57:28 +0000 (11:57 +0800)
Fix 'Watchdog detected hard LOCKUP on cpu 0' bug casued by illegal visit register after disable clk.

drivers/gpu/rogue/include/pvrversion.h
drivers/gpu/rogue/services/server/common/power.c
drivers/gpu/rogue/system/rk3368/rk_init.c
drivers/gpu/rogue/system/rk3368/rk_init.h

index 8310322605ee23abe9bbaa2358f01a34cb06c7d2..2690ecd705373ae1aea30b521d343fbb055e40d8 100755 (executable)
@@ -70,5 +70,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define PVRVERSION_UNPACK_MIN(VERSION) (((VERSION) >> 0) & 0xFFFF)
 
 //chenli:define rockchip version
-#define RKVERSION                   "L 0.10"
+#define RKVERSION                   "L 0.11"
 #endif /* _PVRVERSION_H_ */
index 8b0d7f4d3dbb42520b373c2fbcbf45a33a614e9d..4300905b963fcc04e19d5d73c6d229bd0b323785 100755 (executable)
@@ -692,9 +692,10 @@ PVRSRV_ERROR PVRSRVRegisterPowerDevice(IMG_UINT32                                  ui32DeviceIndex,
        /* insert into power device list */
        List_PVRSRV_POWER_DEV_Insert(&(psPVRSRVData->psPowerDeviceList), psPowerDevice);
 
+#if RK33_DVFS_SUPPORT && RK33_USE_RGX_GET_GPU_UTIL
     //zxl:set device node to get pfnGetGpuUtilStats in rk_init.c
     rk33_set_device_node(hDevCookie);
-
+#endif
        return (PVRSRV_OK);
 }
 
@@ -731,8 +732,10 @@ PVRSRV_ERROR PVRSRVRemovePowerDevice (IMG_UINT32 ui32DeviceIndex)
                /*not nulling pointer, copy on stack*/
        }
 
+#if RK33_DVFS_SUPPORT && RK33_USE_RGX_GET_GPU_UTIL
     //zxl:clear device node
     rk33_clear_device_node();
+#endif
 
        return (PVRSRV_OK);
 }
index 8c456b47d8a4fd80ca31b079a3f6585026baf5d4..64d88710b03d2c4192d02ec2139fd3384bbafc24 100755 (executable)
@@ -73,7 +73,7 @@ static int rk33_clk_set_normal_node(struct clk* node, unsigned long rate)
     return ret;
 }
 
-#if RK33_DVFS_SUPPORT
+
 static int rk33_clk_set_dvfs_node(struct dvfs_node *node, unsigned long rate)
 {
     int ret = 0;
@@ -89,7 +89,7 @@ static int rk33_clk_set_dvfs_node(struct dvfs_node *node, unsigned long rate)
     }
     return ret;
 }
-
+#if RK33_DVFS_SUPPORT
 #define dividend 7
 #define fix_float(a) ((((a)*dividend)%10)?((((a)*dividend)/10)+1):(((a)*dividend)/10))
 static IMG_BOOL calculate_dvfs_max_min_threshold(IMG_UINT32 level)
@@ -691,7 +691,7 @@ static enum hrtimer_restart dvfs_callback(struct hrtimer *timer)
     {
         psDevInfo = platform->psDeviceNode->pvDevice;
 
-        if(psDevInfo && psDevInfo->pfnGetGpuUtilStats)
+        if(psDevInfo && psDevInfo->pfnGetGpuUtilStats && platform->bEnableClk)
         {
             //Measuring GPU Utilisation
             platform->sUtilStats = ((psDevInfo->pfnGetGpuUtilStats)(platform->psDeviceNode));
@@ -699,10 +699,8 @@ static enum hrtimer_restart dvfs_callback(struct hrtimer *timer)
         }
         else
         {
-            if(!psDevInfo)
-                PVR_DPF((PVR_DBG_ERROR,"%s:line=%d,psDevInfo=%p\n",__func__,__LINE__,psDevInfo));
-            else
-                PVR_DPF((PVR_DBG_ERROR,"%s:line=%d,pfnGetGpuUtilStats=%p\n",__func__,__LINE__,psDevInfo->pfnGetGpuUtilStats));
+            if(!psDevInfo || !psDevInfo->pfnGetGpuUtilStats)
+                PVR_DPF((PVR_DBG_ERROR,"%s:line=%d,devinfo is null\n",__func__,__LINE__));
         }
 
         spin_lock_irqsave(&platform->timer_lock, flags);
@@ -1535,8 +1533,7 @@ static IMG_VOID rk_remove_sysfs_file(struct device *dev)
 
 #endif //end of RK33_SYSFS_FILE_SUPPORT
 
-#endif //end of RK33_DVFS_SUPPORT
-
+#if RK33_USE_RGX_GET_GPU_UTIL
 IMG_BOOL rk33_set_device_node(IMG_HANDLE hDevCookie)
 {
     struct rk_context *platform;
@@ -1580,8 +1577,9 @@ IMG_BOOL rk33_clear_device_node(IMG_VOID)
 
     return IMG_TRUE;
 }
+#endif //RK33_USE_RGX_GET_GPU_UTIL
 
-
+#endif //end of RK33_DVFS_SUPPORT
 
 static IMG_VOID RgxEnableClock(IMG_VOID)
 {
@@ -1590,19 +1588,17 @@ static IMG_VOID RgxEnableClock(IMG_VOID)
     platform = dev_get_drvdata(&gpsPVRLDMDev->dev);
 
     if (
-#if RK33_DVFS_SUPPORT
         platform->gpu_clk_node &&
-#endif
         platform->aclk_gpu_mem && platform->aclk_gpu_cfg && !platform->bEnableClk)
     {
-#if RK33_DVFS_SUPPORT
         dvfs_clk_prepare_enable(platform->gpu_clk_node);
-#endif
         clk_prepare_enable(platform->aclk_gpu_mem);
         clk_prepare_enable(platform->aclk_gpu_cfg);
         platform->bEnableClk = IMG_TRUE;
 
 #if RK33_DVFS_SUPPORT
+        if(platform->psDeviceNode)
+            hrtimer_start(&platform->timer, HR_TIMER_DELAY_MSEC(RK33_DVFS_FREQ), HRTIMER_MODE_REL);
         rk33_dvfs_record_gpu_active(platform);
 #endif
     }
@@ -1619,16 +1615,17 @@ static IMG_VOID RgxDisableClock(IMG_VOID)
     platform = dev_get_drvdata(&gpsPVRLDMDev->dev);
 
     if (
-#if RK33_DVFS_SUPPORT
         platform->gpu_clk_node &&
-#endif
         platform->aclk_gpu_mem && platform->aclk_gpu_cfg && platform->bEnableClk)
     {
+#if RK33_DVFS_SUPPORT
+        //Force to drop freq to the lowest.
+        rk33_dvfs_set_level(0);
+        hrtimer_cancel(&platform->timer);
+#endif
         clk_disable_unprepare(platform->aclk_gpu_cfg);
         clk_disable_unprepare(platform->aclk_gpu_mem);
-#if RK33_DVFS_SUPPORT
         dvfs_clk_disable_unprepare(platform->gpu_clk_node);
-#endif
         platform->bEnableClk = IMG_FALSE;
 #if RK33_DVFS_SUPPORT
         rk33_dvfs_record_gpu_idle(platform);
@@ -1802,19 +1799,17 @@ IMG_VOID RgxRkInit(IMG_VOID)
         goto fail3;
     }
 
-#if RK33_DVFS_SUPPORT
     platform->gpu_clk_node  = clk_get_dvfs_node("clk_gpu");
     if (IS_ERR(platform->gpu_clk_node))
     {
         PVR_DPF((PVR_DBG_ERROR, "RgxRkInit: Failed to find gpu_clk_node clock source"));
         goto fail4;
     }
-#endif
 
     rk33_clk_set_normal_node(platform->aclk_gpu_mem, RK33_DEFAULT_CLOCK);
     rk33_clk_set_normal_node(platform->aclk_gpu_cfg, RK33_DEFAULT_CLOCK);
-#if RK33_DVFS_SUPPORT
     rk33_clk_set_dvfs_node(platform->gpu_clk_node, RK33_DEFAULT_CLOCK);
+#if RK33_DVFS_SUPPORT
     rk33_dvfs_init();
 #if RK33_SYSFS_FILE_SUPPORT
     //create sysfs file node
@@ -1827,7 +1822,6 @@ IMG_VOID RgxRkInit(IMG_VOID)
 
     return;
 
-
 fail4:
     devm_clk_put(&gpsPVRLDMDev->dev, platform->aclk_gpu_cfg);
     platform->aclk_gpu_cfg = NULL;
index 21f8d72938df191f2ce44b3a68dab85095f03f41..dcd8767eceac914aa501ffa18ccf046433b0a08c 100755 (executable)
@@ -149,9 +149,10 @@ IMG_VOID RgxSuspend(IMG_VOID);
 IMG_BOOL rk33_dvfs_init(IMG_VOID);
 IMG_VOID rk33_dvfs_term(IMG_VOID);
 
+#if RK33_DVFS_SUPPORT && RK33_USE_RGX_GET_GPU_UTIL
 IMG_BOOL rk33_set_device_node(IMG_HANDLE hDevCookie);
 IMG_BOOL rk33_clear_device_node(IMG_VOID);
-
+#endif
 
 PVRSRV_ERROR IonInit(void *pvPrivateData);
 IMG_VOID IonDeinit(IMG_VOID);