From 6b70176a64f4b048029ef19bbbe51459ee6aa399 Mon Sep 17 00:00:00 2001 From: zsq Date: Tue, 15 Apr 2014 10:13:16 +0800 Subject: [PATCH] fix rga2 mmu addr bug | add pd_rga2 clk --- drivers/video/rockchip/rga2/rga2_drv.c | 3 +++ drivers/video/rockchip/rga2/rga2_mmu_info.c | 17 ++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/video/rockchip/rga2/rga2_drv.c b/drivers/video/rockchip/rga2/rga2_drv.c index 98bb3bd3adf2..b21d5976bb4b 100755 --- a/drivers/video/rockchip/rga2/rga2_drv.c +++ b/drivers/video/rockchip/rga2/rga2_drv.c @@ -264,6 +264,7 @@ static void rga2_power_on(void) return; clk_prepare_enable(rga2_drvdata->rga2); + clk_prepare_enable(rga2_drvdata->pd_rga2); clk_prepare_enable(rga2_drvdata->aclk_rga2); clk_prepare_enable(rga2_drvdata->hclk_rga2); //clk_enable(rga2_drvdata->pd_rga2); @@ -290,6 +291,7 @@ static void rga2_power_off(void) //clk_disable(rga2_drvdata->pd_rga2); clk_disable_unprepare(rga2_drvdata->rga2); + clk_disable_unprepare(rga2_drvdata->pd_rga2); clk_disable_unprepare(rga2_drvdata->aclk_rga2); clk_disable_unprepare(rga2_drvdata->hclk_rga2); wake_unlock(&rga2_drvdata->wake_lock); @@ -1083,6 +1085,7 @@ static int rga2_drv_probe(struct platform_device *pdev) //data->pd_rga2 = clk_get(NULL, "pd_rga"); data->rga2 = devm_clk_get(&pdev->dev, "clk_rga"); + data->pd_rga2 = devm_clk_get(&pdev->dev, "pd_rga"); data->aclk_rga2 = devm_clk_get(&pdev->dev, "aclk_rga"); data->hclk_rga2 = devm_clk_get(&pdev->dev, "hclk_rga"); diff --git a/drivers/video/rockchip/rga2/rga2_mmu_info.c b/drivers/video/rockchip/rga2/rga2_mmu_info.c index 35529aeac046..03eecaa64699 100644 --- a/drivers/video/rockchip/rga2/rga2_mmu_info.c +++ b/drivers/video/rockchip/rga2/rga2_mmu_info.c @@ -448,7 +448,10 @@ static int rga2_mmu_info_BitBlt_mode(struct rga2_reg *reg, struct rga2_req *req) } /* Cal out the needed mem size */ - AllSize = ((Src0MemSize+3)&(~3)) + ((Src1MemSize+3)&(~3)) + ((DstMemSize+3)&(~3)); + Src0MemSize = (Src0MemSize+15)&(~15); + Src1MemSize = (Src1MemSize+15)&(~15); + DstMemSize = (DstMemSize+15)&(~15); + AllSize = Src0MemSize + Src1MemSize + DstMemSize; pages = kzalloc((AllSize)* sizeof(struct page *), GFP_KERNEL); if(pages == NULL) { @@ -486,8 +489,6 @@ static int rga2_mmu_info_BitBlt_mode(struct rga2_reg *reg, struct rga2_req *req) req->src.v_addr = (req->src.v_addr & (~PAGE_MASK)) | (v_size << PAGE_SHIFT); } - Src0MemSize = (Src0MemSize + 3) & (~3); - if(Src1MemSize) { ret = rga2_MapUserMemory(&pages[0], MMU_Base + Src0MemSize, Src1Start, Src1MemSize); if (ret < 0) { @@ -498,11 +499,9 @@ static int rga2_mmu_info_BitBlt_mode(struct rga2_reg *reg, struct rga2_req *req) /* change the buf address in req struct */ req->mmu_info.src1_base_addr = ((uint32_t)(MMU_Base_phys + Src0MemSize)); - req->src1.yrgb_addr = (req->src.yrgb_addr & (~PAGE_MASK)) | (Src1MemSize << PAGE_SHIFT); + req->src1.yrgb_addr = (req->src.yrgb_addr & (~PAGE_MASK)); } - Src1MemSize = (Src1MemSize + 3) & (~3); - if(DstMemSize) { ret = rga2_MapUserMemory(&pages[0], MMU_Base + Src0MemSize + Src1MemSize, DstStart, DstMemSize); if (ret < 0) { @@ -513,11 +512,11 @@ static int rga2_mmu_info_BitBlt_mode(struct rga2_reg *reg, struct rga2_req *req) /* change the buf address in req struct */ req->mmu_info.dst_base_addr = ((uint32_t)(MMU_Base_phys + Src0MemSize + Src1MemSize)); - req->dst.yrgb_addr = (req->dst.yrgb_addr & (~PAGE_MASK)) | ((Src0MemSize + Src1MemSize) << PAGE_SHIFT); + req->dst.yrgb_addr = (req->dst.yrgb_addr & (~PAGE_MASK)); uv_size = (req->dst.uv_addr - (DstStart << PAGE_SHIFT)) >> PAGE_SHIFT; v_size = (req->dst.v_addr - (DstStart << PAGE_SHIFT)) >> PAGE_SHIFT; - req->dst.uv_addr = (req->dst.uv_addr & (~PAGE_MASK)) | ((Src0MemSize + Src1MemSize + uv_size) << PAGE_SHIFT); - req->dst.v_addr = (req->dst.v_addr & (~PAGE_MASK)) | ((Src0MemSize + Src1MemSize + v_size) << PAGE_SHIFT); + req->dst.uv_addr = (req->dst.uv_addr & (~PAGE_MASK)) | ((uv_size) << PAGE_SHIFT); + req->dst.v_addr = (req->dst.v_addr & (~PAGE_MASK)) | ((v_size) << PAGE_SHIFT); } /* flush data to DDR */ -- 2.34.1