MGS-4735 [#imx-1439] fix gpu suspend/resume stuck
authorXianzhong <xianzhong.li@nxp.com>
Thu, 9 May 2019 14:36:14 +0000 (22:36 +0800)
committerXianzhong <xianzhong.li@nxp.com>
Thu, 9 May 2019 19:14:09 +0000 (03:14 +0800)
L4.19 SCFW introduced LP mode, clk_set requires power-on,
fixed GPU govern to conform with the latest SCFW change.
remove redundant clk_set_rate in probe to fix LP clock.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
drivers/mxc/gpu-viv/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx.c

index a2f9322..9d8cf06 100644 (file)
@@ -521,8 +521,15 @@ static ssize_t gpu_govern_store(struct device_driver *dev, const char *buf, size
         if (clk_core != NULL && clk_shader != NULL &&
             core_freq != 0 && shader_freq != 0)
         {
+#ifdef CONFIG_PM
+            pm_runtime_get_sync(priv->pmdev[core]);
+#endif
             clk_set_rate(clk_core, core_freq);
             clk_set_rate(clk_shader, shader_freq);
+
+#ifdef CONFIG_PM
+            pm_runtime_put_sync(priv->pmdev[core]);
+#endif
         }
     }
 
@@ -542,14 +549,8 @@ int init_gpu_opp_table(struct device *dev)
     int nr;
     int ret = 0;
     int i, p;
-    int core = gcvCORE_MAJOR;
     struct imx_priv *priv = &imxPriv;
 
-    struct clk *clk_core;
-    struct clk *clk_shader;
-
-    unsigned long core_freq, shader_freq;
-
     priv->imx_gpu_govern.num_modes = 0;
 
     prop = of_find_property(dev->of_node, "operating-points", NULL);
@@ -631,30 +632,6 @@ int init_gpu_opp_table(struct device *dev)
             dev_err(dev, "create gpu_govern attr failed (%d)\n", ret);
            return ret;
        }
-
-       /*
-        * This could be redundant, but it is useful for testing DTS with
-        * different OPPs that have assigned-clock rates different than the
-        * ones specified in OPP tuple array. Otherwise we will display
-        * different clock values when the driver is loaded. Further
-        * modifications of the governor will display correctly but not when
-        * the driver has been loaded.
-        */
-       core_freq = priv->imx_gpu_govern.core_clk_freq[priv->imx_gpu_govern.current_mode];
-       shader_freq = priv->imx_gpu_govern.shader_clk_freq[priv->imx_gpu_govern.current_mode];
-
-       if (core_freq && shader_freq) {
-               for (; core <= gcvCORE_3D_MAX; core++) {
-                       clk_core = priv->imx_gpu_clks[core].clk_core;
-                       clk_shader = priv->imx_gpu_clks[core].clk_shader;
-
-                       if (clk_core != NULL && clk_shader != NULL) {
-                               clk_set_rate(clk_core, core_freq);
-                               clk_set_rate(clk_shader, shader_freq);
-                       }
-               }
-       }
-
     }
 
     return ret;