PD #99439: fix thermal action too early
authorKasin Lee <kasin.li@amlogic.com>
Thu, 11 Dec 2014 09:57:17 +0000 (17:57 +0800)
committerKasin Lee <kasin.li@amlogic.com>
Thu, 11 Dec 2014 09:57:17 +0000 (17:57 +0800)
Change-Id: I4ef1a38d6ce98db29e9fe1a24c799e0c5a202abf

mali/linux/mali_kernel_linux.c
mali/platform/meson_m400/platform_mx.c
mali/platform/meson_m450/platform_g9tv.c
mali/platform/meson_m450/platform_m6tvd.c
mali/platform/meson_m450/platform_m8.c
mali/platform/meson_m450/platform_m8b.c

index a4a396f19b0258b1f2b7cc198334776350e4326b..16094ba1ca7b3ccb0ed0d5525770740d2f91b3b8 100755 (executable)
@@ -53,6 +53,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(mali_sw_counters);
 
 /* from the __malidrv_build_info.c file that is generated during build */
 extern const char *__malidrv_build_info(void);
+extern void mali_post_init(void);
 extern int mali_pdev_dts_init(struct platform_device* mali_gpu_device);
 
 /* Module parameter to control log level */
@@ -451,6 +452,7 @@ static int mali_probe(struct platform_device *pdev)
                                /* Setup sysfs entries */
                                err = mali_sysfs_register(mali_dev_name);
                                if (0 == err) {
+                                       mali_post_init();
                                        MALI_DEBUG_PRINT(2, ("mali_probe(): Successfully initialized driver for platform device %s\n", pdev->name));
                                        return 0;
                                } else {
index 9eceb6e489d44f110b8f7b9d11fd675d2479a073..bc86bc00298ed8fa1effdef2d77f8400700f1c1c 100755 (executable)
@@ -226,5 +226,9 @@ int mali_deep_resume(struct device *device)
 void mali_core_scaling_term(void)
 {
 
+}
+
+void mali_post_init(void)
+{
 }
 #endif /* MESON_CPU_TYPE <= MESON_CPU_TYPE_MESON6 */
index 81e8a46d7de350081803fb2902914502603ba55f..6129d18283c88d6226e19a7b1b8b802f9c1e3f5f 100755 (executable)
@@ -226,49 +226,8 @@ int mali_meson_init_start(struct platform_device* ptr_plt_dev)
 
 int mali_meson_init_finish(struct platform_device* ptr_plt_dev)
 {
-#ifdef CONFIG_GPU_THERMAL
-       int err;
-       struct gpufreq_cooling_device *gcdev = NULL;
-       struct gpucore_cooling_device *gccdev = NULL;
-#endif
        if (mali_core_scaling_init(&mali_plat_data) < 0)
                return -1;
-
-#ifdef CONFIG_GPU_THERMAL
-       gcdev = gpufreq_cooling_alloc();
-       register_gpu_freq_info(get_current_frequency);
-       if(IS_ERR(gcdev))
-               printk("malloc gpu cooling buffer error!!\n");
-       else if(!gcdev)
-               printk("system does not enable thermal driver\n");
-       else {
-               gcdev->get_gpu_freq_level = get_mali_freq_level;
-               gcdev->get_gpu_max_level = get_mali_max_level;
-               gcdev->set_gpu_freq_idx = set_limit_mali_freq;
-               gcdev->get_gpu_current_max_level = get_limit_mali_freq;
-               err = gpufreq_cooling_register(gcdev);
-               if(err < 0)
-                       printk("register GPU  cooling error\n");
-               printk("gpu cooling register okay with err=%d\n",err);
-       }
-
-       gccdev=gpucore_cooling_alloc();
-       if(IS_ERR(gccdev))
-               printk("malloc gpu core cooling buffer error!!\n");
-       else if(!gccdev)
-               printk("system does not enable thermal driver\n");
-       else {
-               gccdev->max_gpu_core_num=mali_plat_data.cfg_pp;
-               gccdev->set_max_pp_num=set_limit_pp_num;
-               err = (int)gpucore_cooling_register(gccdev);
-               if(err < 0)
-                       printk("register GPU  cooling error\n");
-               printk("gpu core cooling register okay with err=%d\n",err);
-       }
-#endif
-#ifdef CONFIG_AM_VDEC_H264_4K2K
-       vh264_4k2k_register_module_callback(mali_4k2k_enter, mali_4k2k_exit);
-#endif /* CONFIG_AM_VDEC_H264_4K2K */
        return 0;
 }
 
@@ -418,3 +377,46 @@ int mali_deep_resume(struct device *device)
 
 }
 
+void mali_post_init(void)
+{
+#ifdef CONFIG_GPU_THERMAL
+       int err;
+       struct gpufreq_cooling_device *gcdev = NULL;
+       struct gpucore_cooling_device *gccdev = NULL;
+
+       gcdev = gpufreq_cooling_alloc();
+       register_gpu_freq_info(get_current_frequency);
+       if(IS_ERR(gcdev))
+               printk("malloc gpu cooling buffer error!!\n");
+       else if(!gcdev)
+               printk("system does not enable thermal driver\n");
+       else {
+               gcdev->get_gpu_freq_level = get_mali_freq_level;
+               gcdev->get_gpu_max_level = get_mali_max_level;
+               gcdev->set_gpu_freq_idx = set_limit_mali_freq;
+               gcdev->get_gpu_current_max_level = get_limit_mali_freq;
+               err = gpufreq_cooling_register(gcdev);
+               if(err < 0)
+                       printk("register GPU  cooling error\n");
+               printk("gpu cooling register okay with err=%d\n",err);
+       }
+
+       gccdev=gpucore_cooling_alloc();
+       if(IS_ERR(gccdev))
+               printk("malloc gpu core cooling buffer error!!\n");
+       else if(!gccdev)
+               printk("system does not enable thermal driver\n");
+       else {
+               gccdev->max_gpu_core_num=mali_plat_data.cfg_pp;
+               gccdev->set_max_pp_num=set_limit_pp_num;
+               err = (int)gpucore_cooling_register(gccdev);
+               if(err < 0)
+                       printk("register GPU  cooling error\n");
+               printk("gpu core cooling register okay with err=%d\n",err);
+       }
+#endif
+#ifdef CONFIG_AM_VDEC_H264_4K2K
+       vh264_4k2k_register_module_callback(mali_4k2k_enter, mali_4k2k_exit);
+#endif /* CONFIG_AM_VDEC_H264_4K2K */
+}
+
index bfd67910a62e480bd07eb4368ff194020f7a5436..58b30900eaa092083b7e1d2c79f6b8f81c2bc9fe 100755 (executable)
@@ -192,3 +192,6 @@ int mali_deep_resume(struct device *device)
 
 }
 
+void mali_post_init(void)
+{
+}
index f1e52d9db14a605e9288c773e69a24fd78b28c3c..cc7bc88c95346dd64613d0e4481ecf2b48ea1a07 100755 (executable)
@@ -236,49 +236,8 @@ int mali_meson_init_start(struct platform_device* ptr_plt_dev)
 
 int mali_meson_init_finish(struct platform_device* ptr_plt_dev)
 {
-#ifdef CONFIG_GPU_THERMAL
-       int err;
-       struct gpufreq_cooling_device *gcdev = NULL;
-       struct gpucore_cooling_device *gccdev = NULL;
-#endif
        if (mali_core_scaling_init(&mali_plat_data) < 0)
                return -1;
-
-#ifdef CONFIG_GPU_THERMAL
-       gcdev = gpufreq_cooling_alloc();
-       register_gpu_freq_info(get_current_frequency);
-       if(IS_ERR(gcdev))
-               printk("malloc gpu cooling buffer error!!\n");
-       else if(!gcdev)
-               printk("system does not enable thermal driver\n");
-       else {
-               gcdev->get_gpu_freq_level = get_mali_freq_level;
-               gcdev->get_gpu_max_level = get_mali_max_level;
-               gcdev->set_gpu_freq_idx = set_limit_mali_freq;
-               gcdev->get_gpu_current_max_level = get_limit_mali_freq;
-               err = gpufreq_cooling_register(gcdev);
-               if(err < 0)
-                       printk("register GPU  cooling error\n");
-               printk("gpu cooling register okay with err=%d\n",err);
-       }
-
-       gccdev=gpucore_cooling_alloc();
-       if(IS_ERR(gccdev))
-               printk("malloc gpu core cooling buffer error!!\n");
-       else if(!gccdev)
-               printk("system does not enable thermal driver\n");
-       else {
-               gccdev->max_gpu_core_num=mali_plat_data.cfg_pp;
-               gccdev->set_max_pp_num=set_limit_pp_num;
-               err = (int)gpucore_cooling_register(gccdev);
-               if(err < 0)
-                       printk("register GPU  cooling error\n");
-               printk("gpu core cooling register okay with err=%d\n",err);
-       }
-#endif
-#ifdef CONFIG_AM_VDEC_H264_4K2K
-       vh264_4k2k_register_module_callback(mali_4k2k_enter, mali_4k2k_exit);
-#endif /* CONFIG_AM_VDEC_H264_4K2K */
        return 0;
 }
 
@@ -430,3 +389,45 @@ int mali_deep_resume(struct device *device)
 
 }
 
+void mali_post_init(void)
+{
+#ifdef CONFIG_GPU_THERMAL
+       int err;
+       struct gpufreq_cooling_device *gcdev = NULL;
+       struct gpucore_cooling_device *gccdev = NULL;
+
+       gcdev = gpufreq_cooling_alloc();
+       register_gpu_freq_info(get_current_frequency);
+       if(IS_ERR(gcdev))
+               printk("malloc gpu cooling buffer error!!\n");
+       else if(!gcdev)
+               printk("system does not enable thermal driver\n");
+       else {
+               gcdev->get_gpu_freq_level = get_mali_freq_level;
+               gcdev->get_gpu_max_level = get_mali_max_level;
+               gcdev->set_gpu_freq_idx = set_limit_mali_freq;
+               gcdev->get_gpu_current_max_level = get_limit_mali_freq;
+               err = gpufreq_cooling_register(gcdev);
+               if(err < 0)
+                       printk("register GPU  cooling error\n");
+               printk("gpu cooling register okay with err=%d\n",err);
+       }
+
+       gccdev=gpucore_cooling_alloc();
+       if(IS_ERR(gccdev))
+               printk("malloc gpu core cooling buffer error!!\n");
+       else if(!gccdev)
+               printk("system does not enable thermal driver\n");
+       else {
+               gccdev->max_gpu_core_num=mali_plat_data.cfg_pp;
+               gccdev->set_max_pp_num=set_limit_pp_num;
+               err = (int)gpucore_cooling_register(gccdev);
+               if(err < 0)
+                       printk("register GPU  cooling error\n");
+               printk("gpu core cooling register okay with err=%d\n",err);
+       }
+#endif
+#ifdef CONFIG_AM_VDEC_H264_4K2K
+       vh264_4k2k_register_module_callback(mali_4k2k_enter, mali_4k2k_exit);
+#endif /* CONFIG_AM_VDEC_H264_4K2K */
+}
index 6a44962e1846f210d70fbfee6fab5f07898a1bb9..23779db8489382fc5f9fea7876e0a17f9d477a43 100755 (executable)
@@ -203,31 +203,8 @@ int mali_meson_init_start(struct platform_device* ptr_plt_dev)
 
 int mali_meson_init_finish(struct platform_device* ptr_plt_dev)
 {
-#ifdef CONFIG_GPU_THERMAL
-       int err;
-       struct gpufreq_cooling_device *gcdev = NULL;
-#endif
        if (mali_core_scaling_init(&mali_plat_data) < 0)
                return -1;
-
-#ifdef CONFIG_GPU_THERMAL
-       gcdev = gpufreq_cooling_alloc();
-       if(IS_ERR(gcdev))
-               printk("malloc gpu cooling buffer error!!\n");
-       else if(!gcdev)
-               printk("system does not enable thermal driver\n");
-       else {
-               gcdev->get_gpu_freq_level = get_mali_freq_level;
-               gcdev->get_gpu_max_level = get_mali_max_level;
-               gcdev->set_gpu_freq_idx = set_limit_mali_freq;
-               gcdev->get_gpu_current_max_level = get_limit_mali_freq;
-               err = gpufreq_cooling_register(gcdev);
-               if(err < 0)
-                       printk("register GPU  cooling error\n");
-               printk("gpu cooling register okay with err=%d\n",err);
-       }
-
-#endif
        return 0;
 }
 
@@ -380,3 +357,27 @@ int mali_deep_resume(struct device *device)
        return ret;
 }
 
+void mali_post_init(void)
+{
+#ifdef CONFIG_GPU_THERMAL
+       int err;
+       struct gpufreq_cooling_device *gcdev = NULL;
+
+       gcdev = gpufreq_cooling_alloc();
+       if(IS_ERR(gcdev))
+               printk("malloc gpu cooling buffer error!!\n");
+       else if(!gcdev)
+               printk("system does not enable thermal driver\n");
+       else {
+               gcdev->get_gpu_freq_level = get_mali_freq_level;
+               gcdev->get_gpu_max_level = get_mali_max_level;
+               gcdev->set_gpu_freq_idx = set_limit_mali_freq;
+               gcdev->get_gpu_current_max_level = get_limit_mali_freq;
+               err = gpufreq_cooling_register(gcdev);
+               if(err < 0)
+                       printk("register GPU  cooling error\n");
+               printk("gpu cooling register okay with err=%d\n",err);
+       }
+
+#endif
+}