From aa24277fc14853224d4a4e7a4473276dec813425 Mon Sep 17 00:00:00 2001 From: Jiyu Yang Date: Tue, 18 Jul 2017 19:12:30 +0800 Subject: [PATCH] gpu: fixed min_state of thermal PD#143724 fixed error in m8b m8m2 driver Change-Id: I6666ec1da1711225701e323d29fc2fc8c71df3d1 --- utgard/platform/meson_m450/platform_m8.c | 14 ++++++++------ utgard/platform/meson_m450/platform_m8b.c | 15 +++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) 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; -- 2.20.1