fix rga suspend disable clock error bug
authorzsq <zsq@rock-chips.com>
Tue, 10 Apr 2012 03:23:35 +0000 (19:23 -0800)
committerzsq <zsq@rock-chips.com>
Tue, 10 Apr 2012 03:23:35 +0000 (19:23 -0800)
drivers/video/rockchip/rga/rga_drv.c
drivers/video/rockchip/rga/rga_mmu_info.c

index 85ff2bcfb135ba9f82c89889ba09a88912843154..c439f784187a2d7b55060e0cd56c11f83be3814a 100755 (executable)
@@ -225,10 +225,14 @@ static void rga_power_off(void)
 {\r
     int total_running;\r
     \r
-    printk("rga_power_off\n");\r
+    \r
        if(!rga_service.enable)\r
                return;\r
 \r
+    rga_service.enable = false;\r
+\r
+    printk("rga_power_off\n");\r
+\r
     total_running = atomic_read(&rga_service.total_running);\r
        if (total_running) {\r
                pr_alert("power off when %d task running!!\n", total_running);               \r
@@ -239,8 +243,7 @@ static void rga_power_off(void)
     \r
        clk_disable(aclk_rga);\r
        clk_disable(hclk_rga);\r
-\r
-       rga_service.enable = false;\r
+       \r
 }\r
 \r
 static int rga_flush(rga_session *session, unsigned long arg)\r
@@ -301,11 +304,15 @@ static int rga_check_param(const struct rga_req *req)
 {\r
        /*RGA can support up to 8192*8192 resolution in RGB format,but we limit the image size to 8191*8191 here*/\r
        //check src width and height\r
-       if (unlikely((req->src.act_w <= 0) || (req->src.act_w > 8191) || (req->src.act_h <= 0) || (req->src.act_h > 8191))) \r
+\r
+    if(!((req->render_mode == color_fill_mode) || (req->render_mode == line_point_drawing_mode)))\r
     {\r
-               ERR("invalid source resolution act_w = %d, act_h = %d\n", req->src.act_w, req->src.act_h);\r
-               return  -EINVAL;\r
-       }\r
+       if (unlikely((req->src.act_w <= 0) || (req->src.act_w > 8191) || (req->src.act_h <= 0) || (req->src.act_h > 8191))) \r
+        {\r
+               ERR("invalid source resolution act_w = %d, act_h = %d\n", req->src.act_w, req->src.act_h);\r
+               return  -EINVAL;\r
+       }\r
+    }\r
 \r
        //check dst width and height\r
        if (unlikely((req->dst.act_w <= 0) || (req->dst.act_w > 2048) || (req->dst.act_h <= 0) || (req->dst.act_h > 2048))) \r
@@ -582,7 +589,7 @@ static void rga_try_set_reg(uint32_t num)
 }\r
 \r
 \r
-#if 1//RGA_TEST  \r
+#if RGA_TEST  \r
 static void print_info(struct rga_req *req)\r
 {      \r
     printk("src.yrgb_addr = %.8x, src.uv_addr = %.8x, src.v_addr = %.8x\n", \r
@@ -796,6 +803,7 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg)
                        ret = -EFAULT;\r
                 break;\r
                }\r
+            rga_power_on();\r
             ret = rga_blit_sync(session, req);\r
             break;\r
                case RGA_BLIT_ASYNC:\r
@@ -805,6 +813,7 @@ static long rga_ioctl(struct file *file, uint32_t cmd, unsigned long arg)
                        ret = -EFAULT;\r
                 break;\r
                }\r
+            rga_power_on();\r
                        ret = rga_blit_async(session, req);              \r
                        break;\r
                case RGA_FLUSH:\r
@@ -931,7 +940,7 @@ static int rga_suspend(struct platform_device *pdev, pm_message_t state)
        uint32_t enable;\r
     \r
     enable = rga_service.enable;    \r
-       rga_power_off();    \r
+       rga_power_off();\r
     rga_service.enable = enable;\r
 \r
        return 0;\r
@@ -939,7 +948,13 @@ static int rga_suspend(struct platform_device *pdev, pm_message_t state)
 \r
 static int rga_resume(struct platform_device *pdev)\r
 {    \r
-    rga_power_on();    \r
+    if(rga_service.enable)\r
+    {\r
+        rga_service.enable = false;\r
+        rga_power_on();\r
+        rga_try_set_reg(1);\r
+    }\r
+    \r
        return 0;\r
 }\r
 \r
@@ -1186,8 +1201,8 @@ EXPORT_SYMBOL(rk_get_fb);
 extern void rk_direct_fb_show(struct fb_info * fbi);\r
 EXPORT_SYMBOL(rk_direct_fb_show);\r
 \r
-unsigned int src_buf[1024*1024];\r
-unsigned int dst_buf[1024*1024];\r
+unsigned int src_buf[1920*1080];\r
+unsigned int dst_buf[1280*800];\r
 \r
 void rga_test_0(void)\r
 {\r
@@ -1214,9 +1229,9 @@ void rga_test_0(void)
     src = src_buf;\r
     dst = dst_buf;\r
 \r
-    memset(src_buf, 0x80, 1024*1024*4);\r
+    memset(src_buf, 0x80, 1920*1080*4);\r
 \r
-    dmac_flush_range(&src_buf[0], &src_buf[1024*1024]);\r
+    dmac_flush_range(&src_buf[0], &src_buf[1920*1080]);\r
     outer_flush_range(virt_to_phys(&src_buf[0]),virt_to_phys(&src_buf[1024*1024]));\r
         \r
     #if 0\r
@@ -1227,31 +1242,31 @@ void rga_test_0(void)
     outer_flush_range(virt_to_phys(&dst_buf[0]),virt_to_phys(&dst_buf[800*480]));\r
     #endif\r
    \r
-    req.src.act_w = 1024;\r
-    req.src.act_h = 1024;\r
+    req.src.act_w = 1920;\r
+    req.src.act_h = 1080;\r
 \r
-    req.src.vir_w = 1024;\r
-    req.src.vir_h = 1024;\r
-    req.src.yrgb_addr = (uint32_t)virt_to_phys(src_buf);\r
+    req.src.vir_w = 1920;\r
+    req.src.vir_h = 1080;\r
+    req.src.yrgb_addr = (uint32_t)src_buf;\r
     req.src.uv_addr = req.src.yrgb_addr + 1920;\r
     //req.src.v_addr = (uint32_t)V4200_320_240_swap0;\r
-    req.src.format = RK_FORMAT_RGBA_8888;\r
+    req.src.format = RK_FORMAT_YCbCr_420_SP;\r
 \r
-    req.dst.act_w = 1024;\r
-    req.dst.act_h = 1024;\r
+    req.dst.act_w = 1280;\r
+    req.dst.act_h = 736;\r
 \r
-    req.dst.vir_w = 1024;\r
-    req.dst.vir_h = 1024;\r
-    req.dst.x_offset = 1023;\r
+    req.dst.vir_w = 1280;\r
+    req.dst.vir_h = 736;\r
+    req.dst.x_offset = 0;\r
     req.dst.y_offset = 0;\r
-    req.dst.yrgb_addr = (uint32_t)virt_to_phys(dst);\r
+    req.dst.yrgb_addr = (uint32_t)dst;\r
 \r
     //req.dst.format = RK_FORMAT_RGB_565;\r
 \r
     req.clip.xmin = 0;\r
-    req.clip.xmax = 1023;\r
+    req.clip.xmax = 1279;\r
     req.clip.ymin = 0;\r
-    req.clip.ymax = 1023;\r
+    req.clip.ymax = 799;\r
 \r
     //req.render_mode = color_fill_mode;\r
     //req.fg_color = 0x80ffffff;\r
@@ -1259,14 +1274,14 @@ void rga_test_0(void)
     req.rotate_mode = 1;\r
     req.scale_mode = 0;\r
 \r
-    req.alpha_rop_flag = 1;\r
+    req.alpha_rop_flag = 0;\r
     req.alpha_rop_mode = 0x1;\r
 \r
-    req.sina = 65536;\r
-    req.cosa = 0;\r
+    req.sina = 0;\r
+    req.cosa = 65536;\r
 \r
-    req.mmu_info.mmu_flag = 0x0;\r
-    req.mmu_info.mmu_en = 0;\r
+    req.mmu_info.mmu_flag = 0x21;\r
+    req.mmu_info.mmu_en = 1;\r
 \r
     rga_blit_sync(&session, &req);\r
 \r
index 43d97e9f1d1087479a89532d86abf88ab31e2e1e..eb28209bf953b81057b312b7efebb281d43b9ef2 100755 (executable)
@@ -280,31 +280,11 @@ static int rga_MapUserMemory(struct page **pages,
 \r
                         pfn = pte_pfn(*pte);\r
                         Address = ((pfn << PAGE_SHIFT) | (((unsigned long)t_mem) & ~PAGE_MASK));                        \r
-                        pte_unmap_unlock(pte, ptl);\r
-                        \r
-                        #if 0\r
-                        /* Free the page table. */\r
-                        if (pages != NULL)\r
-                        {\r
-                            /* Release the pages if any. */\r
-                            if (result > 0)\r
-                            {\r
-                                for (i = 0; i < result; i++)\r
-                                {\r
-                                    if (pages[i] == NULL)\r
-                                    {\r
-                                        break;\r
-                                    }\r
-\r
-                                    page_cache_release(pages[i]);\r
-                                }\r
-                            }\r
-                        }\r
-                        #endif\r
-                        \r
-                        pageTable[i] = Address;\r
+                        pte_unmap_unlock(pte, ptl);                                                                        \r
                     }\r
                     while (0);\r
+\r
+                    pageTable[i] = Address;\r
                 }\r
                 else\r
                 {\r