video/rockchip: rga2: enable rga power when read rga version
authorMark Yao <mark.yao@rock-chips.com>
Wed, 22 Mar 2017 02:10:32 +0000 (10:10 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 22 Mar 2017 11:36:51 +0000 (19:36 +0800)
Change-Id: Ib2a704b8f75f4b792dc5a70ed58c0b9306c2793c
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
drivers/video/rockchip/rga2/rga2_drv.c

index 7030a55c01532ef1e2ce3a32a88f8e36e3b62f04..05c927518f171a8196bab70a63708ced351c69df 100644 (file)
@@ -159,8 +159,22 @@ static inline int rga2_init_version(void)
                pr_err("rga2_drvdata is null\n");
                return -EINVAL;
        }
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
+       pm_runtime_get_sync(rga2_drvdata->dev);
+#endif
+
+       clk_prepare_enable(rga2_drvdata->aclk_rga2);
+       clk_prepare_enable(rga2_drvdata->hclk_rga2);
 
        reg_version = rga2_read(0x028);
+
+       clk_disable_unprepare(rga2_drvdata->aclk_rga2);
+       clk_disable_unprepare(rga2_drvdata->hclk_rga2);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
+       pm_runtime_put(rga2_drvdata->dev);
+#endif
+
        major_version = (reg_version & RGA2_MAJOR_VERSION_MASK) >> 24;
        minor_version = (reg_version & RGA2_MINOR_VERSION_MASK) >> 20;