From: Kasin Lee Date: Thu, 11 Dec 2014 09:57:17 +0000 (+0800) Subject: PD #99439: fix thermal action too early X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c68632c85c4bfd88be1540bbd729112964da36e8;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_mali-driver.git PD #99439: fix thermal action too early Change-Id: I4ef1a38d6ce98db29e9fe1a24c799e0c5a202abf --- diff --git a/mali/linux/mali_kernel_linux.c b/mali/linux/mali_kernel_linux.c index a4a396f..16094ba 100755 --- a/mali/linux/mali_kernel_linux.c +++ b/mali/linux/mali_kernel_linux.c @@ -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 { diff --git a/mali/platform/meson_m400/platform_mx.c b/mali/platform/meson_m400/platform_mx.c index 9eceb6e..bc86bc0 100755 --- a/mali/platform/meson_m400/platform_mx.c +++ b/mali/platform/meson_m400/platform_mx.c @@ -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 */ diff --git a/mali/platform/meson_m450/platform_g9tv.c b/mali/platform/meson_m450/platform_g9tv.c index 81e8a46..6129d18 100755 --- a/mali/platform/meson_m450/platform_g9tv.c +++ b/mali/platform/meson_m450/platform_g9tv.c @@ -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 */ +} + diff --git a/mali/platform/meson_m450/platform_m6tvd.c b/mali/platform/meson_m450/platform_m6tvd.c index bfd6791..58b3090 100755 --- a/mali/platform/meson_m450/platform_m6tvd.c +++ b/mali/platform/meson_m450/platform_m6tvd.c @@ -192,3 +192,6 @@ int mali_deep_resume(struct device *device) } +void mali_post_init(void) +{ +} diff --git a/mali/platform/meson_m450/platform_m8.c b/mali/platform/meson_m450/platform_m8.c index f1e52d9..cc7bc88 100755 --- a/mali/platform/meson_m450/platform_m8.c +++ b/mali/platform/meson_m450/platform_m8.c @@ -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 */ +} diff --git a/mali/platform/meson_m450/platform_m8b.c b/mali/platform/meson_m450/platform_m8b.c index 6a44962..23779db 100755 --- a/mali/platform/meson_m450/platform_m8b.c +++ b/mali/platform/meson_m450/platform_m8b.c @@ -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 +}