From: Jiyu Yang Date: Tue, 18 Jul 2017 11:12:30 +0000 (+0800) Subject: gpu: fixed min_state of thermal X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aa24277fc14853224d4a4e7a4473276dec813425;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_mali-driver.git gpu: fixed min_state of thermal PD#143724 fixed error in m8b m8m2 driver Change-Id: I6666ec1da1711225701e323d29fc2fc8c71df3d1 --- diff --git a/utgard/platform/meson_m450/platform_m8.c b/utgard/platform/meson_m450/platform_m8.c index d92fda2..66a4e25 100644 --- a/utgard/platform/meson_m450/platform_m8.c +++ b/utgard/platform/meson_m450/platform_m8.c @@ -153,13 +153,15 @@ int get_mali_freq_level(int freq) mali_freq_num = mali_plat_data.dvfs_table_size - 1; if (freq < mali_plat_data.clk_sample[0]) level = mali_freq_num-1; - if (freq >= mali_plat_data.clk_sample[mali_freq_num - 1]) + else if (freq >= mali_plat_data.clk_sample[mali_freq_num - 1]) level = 0; - for (i=0; i= mali_plat_data.clk_sample[i] && freq < mali_plat_data.clk_sample[i + 1]) { - level = i; - level = mali_freq_num-level - 1; - break; + else { + for (i=0; i= mali_plat_data.clk_sample[i] && freq < mali_plat_data.clk_sample[i + 1]) { + level = i; + level = mali_freq_num-level - 1; + break; + } } } return level; diff --git a/utgard/platform/meson_m450/platform_m8b.c b/utgard/platform/meson_m450/platform_m8b.c index 803498d..692aafe 100644 --- a/utgard/platform/meson_m450/platform_m8b.c +++ b/utgard/platform/meson_m450/platform_m8b.c @@ -147,16 +147,19 @@ int get_mali_freq_level(int freq) if (freq < 0) return level; + mali_freq_num = mali_plat_data.dvfs_table_size - 1; if (freq < mali_plat_data.clk_sample[0]) level = mali_freq_num-1; - if (freq >= mali_plat_data.clk_sample[mali_freq_num - 1]) + else if (freq >= mali_plat_data.clk_sample[mali_freq_num - 1]) level = 0; - for (i=0; i= mali_plat_data.clk_sample[i] && freq < mali_plat_data.clk_sample[i + 1]) { - level = i; - level = mali_freq_num-level - 1; - break; + else { + for (i=0; i= mali_plat_data.clk_sample[i] && freq < mali_plat_data.clk_sample[i + 1]) { + level = i; + level = mali_freq_num-level - 1; + break; + } } } return level;