void *rga_base;\r
int irq0;\r
\r
- struct clk *pd_display;\r
- struct clk *aclk_lcdc;\r
- struct clk *hclk_lcdc;\r
- struct clk *aclk_ddr_lcdc;\r
- struct clk *hclk_cpu_display;\r
- struct clk *aclk_disp_matrix;\r
- struct clk *hclk_disp_matrix;\r
- struct clk *axi_clk;\r
- struct clk *ahb_clk;\r
+ struct clk *aclk_rga;\r
+ struct clk *hclk_rga;\r
\r
struct mutex mutex; // mutex\r
\r
cancel_delayed_work_sync(&drvdata->power_off_work);\r
if (drvdata->enable)\r
return;\r
- \r
- clk_enable(drvdata->pd_display);\r
- clk_enable(drvdata->aclk_lcdc);\r
- clk_enable(drvdata->hclk_lcdc);\r
- clk_enable(drvdata->aclk_ddr_lcdc);\r
- clk_enable(drvdata->hclk_cpu_display);\r
- clk_enable(drvdata->aclk_disp_matrix);\r
- clk_enable(drvdata->hclk_disp_matrix);\r
- clk_enable(drvdata->axi_clk);\r
- clk_enable(drvdata->ahb_clk);\r
+ \r
+ clk_enable(drvdata->aclk_rga);\r
+ clk_enable(drvdata->hclk_rga);\r
\r
drvdata->enable = true;\r
}\r
rga_dump();\r
}\r
\r
- clk_disable(drvdata->pd_display);\r
- clk_disable(drvdata->aclk_lcdc);\r
- clk_disable(drvdata->hclk_lcdc);\r
- clk_disable(drvdata->aclk_ddr_lcdc);\r
- clk_disable(drvdata->hclk_cpu_display);\r
- clk_disable(drvdata->aclk_disp_matrix);\r
- clk_disable(drvdata->hclk_disp_matrix);\r
- clk_disable(drvdata->axi_clk);\r
- clk_disable(drvdata->ahb_clk);\r
+ clk_disable(drvdata->aclk_rga);\r
+ clk_disable(drvdata->hclk_rga);\r
\r
drvdata->enable = false;\r
}\r
struct rga_reg *reg = list_entry(rga_service.waiting.next, struct rga_reg, status_link);\r
if((rga_read(RGA_STATUS) & 0x1)) \r
{ \r
+ #if RGA_TEST\r
/* RGA is busy */\r
printk("no idel is here \n");\r
+ #endif\r
\r
if((atomic_read(&rga_service.cmd_num) <= 0xf) && (atomic_read(&rga_service.int_disable) == 0)) \r
{\r
static int rga_blit_async(rga_session *session, struct rga_req *req)\r
{\r
int ret = -1;\r
+ int num = 0; \r
struct rga_reg *reg;\r
struct rga_req *req2;\r
\r
reg = rga_reg_init_2(session, req, req2);\r
if(reg == NULL) {\r
break;\r
- }\r
- \r
- atomic_set(®->int_enable, 1);\r
-\r
- rga_try_set_reg(2);\r
- \r
+ } \r
+ num = 2;\r
}\r
- else {\r
+ else \r
+ {\r
/* check value if legal */\r
ret = rga_check_param(req);\r
if(ret == -EINVAL) {\r
reg = rga_reg_init(session, req);\r
if(reg == NULL) {\r
return -EFAULT;\r
- }\r
- \r
- rga_try_set_reg(1); \r
+ } \r
+ num = 1; \r
} \r
+\r
+ rga_power_on();\r
+ atomic_set(®->int_enable, 1); \r
+ rga_try_set_reg(num);\r
+\r
+ return 0; \r
}\r
while(0);\r
\r
{\r
kfree(req2);\r
}\r
- \r
- //printk("rga_blit_async done******************\n");\r
-\r
-#if 0 \r
-error_status:\r
-error_scale:\r
- ret = -EINVAL;\r
- rga_soft_reset();\r
- rga_power_off();\r
-#endif \r
- return ret; \r
\r
+ return ret;\r
}\r
\r
static int rga_blit_sync(rga_session *session, struct rga_req *req)\r
{\r
int ret = 0;\r
int ret_timeout = 0;\r
+ int num = 0;\r
struct rga_reg *reg;\r
struct rga_req *req2;\r
\r
daw = req->dst.act_w;\r
dah = req->dst.act_h;\r
\r
- printk("req->rotate_mode = %.8x, req->scale_mode = %.8x\n", req->rotate_mode, req->scale_mode);\r
-\r
- if((req->render_mode == bitblt_mode) && (((saw>>1) >= daw) || ((sah>>1) >= dah))) \r
+ do\r
{\r
- /* generate 2 cmd for pre scale */\r
- \r
- req2 = kmalloc(sizeof(struct rga_req), GFP_KERNEL);\r
- if (NULL == req2) \r
+ if((req->render_mode == bitblt_mode) && (((saw>>1) >= daw) || ((sah>>1) >= dah))) \r
{\r
- return -EINVAL; \r
- }\r
- memset(req2, 0, sizeof(struct rga_req));\r
- \r
- RGA_gen_two_pro(req, req2);\r
+ /* generate 2 cmd for pre scale */\r
+ \r
+ req2 = kmalloc(sizeof(struct rga_req), GFP_KERNEL);\r
+ if (NULL == req2) \r
+ {\r
+ return -EINVAL; \r
+ }\r
+ memset(req2, 0, sizeof(struct rga_req));\r
+ \r
+ RGA_gen_two_pro(req, req2);\r
\r
- reg = rga_reg_init_2(session, req, req2);\r
- if (NULL == reg) \r
- {\r
- return -EFAULT;\r
+ reg = rga_reg_init_2(session, req, req2);\r
+ if (NULL == reg) \r
+ {\r
+ break;\r
+ }\r
+ num = 2; \r
}\r
- \r
- atomic_set(®->int_enable, 1);\r
+ else \r
+ {\r
+ /* check value if legal */ \r
+ ret = rga_check_param(req);\r
+ if(ret == -EINVAL) \r
+ {\r
+ return -EFAULT;\r
+ }\r
+ \r
+ reg = rga_reg_init(session, req);\r
+ if(reg == NULL) \r
+ { \r
+ return -EFAULT;\r
+ }\r
+ num = 1; \r
+ } \r
\r
- rga_try_set_reg(2); \r
+ rga_power_on();\r
+ atomic_set(®->int_enable, 1); \r
+ rga_try_set_reg(num);\r
\r
- }\r
- else \r
- {\r
- /* check value if legal */ \r
- ret = rga_check_param(req);\r
- if(ret == -EINVAL) \r
+ ret_timeout = wait_event_interruptible_timeout(session->wait, atomic_read(&session->done), RGA_TIMEOUT_DELAY);\r
+ if (unlikely(ret_timeout< 0)) \r
{\r
- return -EFAULT;\r
+ pr_err("pid %d wait task ret %d\n", session->pid, ret_timeout);\r
+ } \r
+ else if (0 == ret_timeout)\r
+ {\r
+ pr_err("pid %d wait %d task done timeout\n", session->pid, atomic_read(&session->task_running));\r
+ ret = -ETIMEDOUT;\r
}\r
- \r
- reg = rga_reg_init(session, req);\r
- if(reg == NULL) \r
- { \r
- return -EFAULT;\r
- }\r
- \r
- atomic_set(®->int_enable, 1); \r
- rga_try_set_reg(1);\r
- } \r
+\r
+ #if RGA_TEST_TIME\r
+ rga_end = ktime_get();\r
+ rga_end = ktime_sub(rga_end, rga_start);\r
+ printk("one cmd end time %d\n", (int)ktime_to_us(rga_end));\r
+ #endif\r
+ }\r
+ while(0);\r
\r
- ret_timeout = wait_event_interruptible_timeout(session->wait, atomic_read(&session->done), RGA_TIMEOUT_DELAY);\r
- if (unlikely(ret_timeout< 0)) \r
- {\r
- pr_err("pid %d wait task ret %d\n", session->pid, ret_timeout);\r
- } \r
- else if (0 == ret_timeout)\r
+ if(NULL != req2)\r
{\r
- pr_err("pid %d wait %d task done timeout\n", session->pid, atomic_read(&session->task_running));\r
- ret = -ETIMEDOUT;\r
- }\r
-\r
- #if RGA_TEST_TIME\r
- rga_end = ktime_get();\r
- rga_end = ktime_sub(rga_end, rga_start);\r
- printk("one cmd end time %d\n", (int)ktime_to_us(rga_end));\r
- #endif\r
+ kfree(req2);\r
+ }\r
\r
return ret; \r
}\r
rga_session *session = (rga_session *)file->private_data;\r
\r
\r
-\r
if (NULL == session) \r
{\r
printk("%s [%d] rga thread session is null\n",__FUNCTION__,__LINE__);\r
\r
\r
\r
- data->axi_clk = clk_get(NULL, "aclk_rga");\r
+ data->aclk_rga = clk_get(NULL, "aclk_rga");\r
\r
if (IS_ERR(data->axi_clk))\r
{\r
goto err_clock;\r
}\r
\r
- data->ahb_clk = clk_get(&pdev->dev, "hclk_rga");\r
+ data->hclk_rga = clk_get(NULL, "hclk_rga");\r
if (IS_ERR(data->ahb_clk))\r
{\r
ERR("failed to find rga ahb clock source\n");\r