clk: G12A/G12B: fix gpu clk enable count error [1/1]
authorShunzhou Jiang <shunzhou.jiang@amlogic.com>
Wed, 16 May 2018 06:24:34 +0000 (14:24 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Sun, 30 Sep 2018 14:44:25 +0000 (07:44 -0700)
PD#173995: fix gpu clk enable count error

Change-Id: I31f7908507ea2cdb76284977cb17fbe3fc68ce5c
Signed-off-by: Shunzhou Jiang <shunzhou.jiang@amlogic.com>
drivers/amlogic/clk/clk-mux.c
drivers/amlogic/clk/g12a/g12a_clk_gpu.c

index ee9a06b..66a2c1c 100644 (file)
@@ -139,7 +139,7 @@ int meson_clk_mux_determine_rate(struct clk_hw *hw,
 
        if ((num_parents == 2) && (mux->flags == CLK_PARENT_ALTERNATE)) {
                i = meson_clk_mux_get_parent(hw);
-               i = (i+1)%2;
+               i = (i + 1) % 2;
 
                best_parent = clk_hw_get_parent_by_index(hw, i);
                best = clk_hw_get_rate(best_parent);
@@ -149,11 +149,14 @@ int meson_clk_mux_determine_rate(struct clk_hw *hw,
                                pr_err("Fail! Can not set to %lu, cur rate: %lu\n",
                                   parent_req.rate, best);
                        else {
-                       pr_debug("success set parent %s rate to %lu\n",
-                               clk_hw_get_name(best_parent),
-                               clk_hw_get_rate(best_parent));
-                       clk_prepare(best_parent->clk);
-                       clk_enable(best_parent->clk);
+                               best = clk_hw_get_rate(best_parent);
+                               pr_debug("success set parent %s rate to %lu\n",
+                                       clk_hw_get_name(best_parent), best);
+                               if (!(clk_hw_get_flags(hw) &
+                                               CLK_SET_RATE_UNGATE)) {
+                                       clk_prepare(best_parent->clk);
+                                       clk_enable(best_parent->clk);
+                               }
                        }
                }
        } else {
index 90eaa76..1705eb0 100644 (file)
@@ -123,7 +123,7 @@ static struct clk_mux gpu_mux = {
                .parent_names = (const char *[]){ "gpu_p0_composite",
                        "gpu_p1_composite"},
                .num_parents = 2,
-               .flags = CLK_GET_RATE_NOCACHE,
+               .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_UNGATE,
        },
 };