From 902adbb7488609afa53d125ed2a264cd723560c7 Mon Sep 17 00:00:00 2001 From: "wenbiao.zhang" Date: Wed, 3 May 2017 15:43:31 +0800 Subject: [PATCH] PD#143724: fixed min_state of thermal for stark dvfs tbl is 125, 285, 400, 500, 666, 744. so get_mali_freq_level should report min_state for STARK below 744 -> 0 666 -> 1 500 -> 2 400 -> 3 285 -> 4 125 -> 5 Change-Id: Iad17b56e8f22a29064a432f5c1810b1cb26cc79b --- mali/platform/meson_bu/platform_gx.c | 15 +++++++++------ .../arm/midgard/platform/devicetree/platform_gx.c | 15 +++++++++------ .../arm/midgard/platform/devicetree/platform_gx.c | 15 +++++++++------ .../arm/midgard/platform/devicetree/platform_gx.c | 15 +++++++++------ .../arm/midgard/platform/devicetree/platform_gx.c | 15 +++++++++------ .../arm/midgard/platform/devicetree/platform_gx.c | 15 +++++++++------ .../arm/midgard/platform/devicetree/platform_gx.c | 12 +++++++----- utgard/r5p1/platform/meson_bu/platform_gx.c | 15 +++++++++------ utgard/r6p1/platform/meson_bu/platform_gx.c | 15 +++++++++------ utgard/r6p2/platform/meson_bu/platform_gx.c | 15 +++++++++------ 10 files changed, 88 insertions(+), 59 deletions(-) diff --git a/mali/platform/meson_bu/platform_gx.c b/mali/platform/meson_bu/platform_gx.c index e1b256e..79f513c 100644 --- a/mali/platform/meson_bu/platform_gx.c +++ b/mali/platform/meson_bu/platform_gx.c @@ -83,14 +83,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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/midgard/r11p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c b/midgard/r11p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c index 4fa23bf..9bde155 100644 --- a/midgard/r11p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c +++ b/midgard/r11p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c @@ -75,14 +75,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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/midgard/r12p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c b/midgard/r12p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c index 4fa23bf..9bde155 100644 --- a/midgard/r12p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c +++ b/midgard/r12p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c @@ -75,14 +75,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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/midgard/r13p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c b/midgard/r13p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c index 4fa23bf..9bde155 100644 --- a/midgard/r13p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c +++ b/midgard/r13p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c @@ -75,14 +75,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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/midgard/r14p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c b/midgard/r14p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c index 4fa23bf..9bde155 100644 --- a/midgard/r14p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c +++ b/midgard/r14p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c @@ -75,14 +75,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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/midgard/r15p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c b/midgard/r15p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c index 4fa23bf..9bde155 100644 --- a/midgard/r15p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c +++ b/midgard/r15p0/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c @@ -75,14 +75,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c b/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c index 4fa23bf..4f65858 100644 --- a/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c +++ b/t83x/kernel/drivers/gpu/arm/midgard/platform/devicetree/platform_gx.c @@ -77,12 +77,14 @@ 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; + 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; + } } } return level; diff --git a/utgard/r5p1/platform/meson_bu/platform_gx.c b/utgard/r5p1/platform/meson_bu/platform_gx.c index 2dfefad..422988e 100644 --- a/utgard/r5p1/platform/meson_bu/platform_gx.c +++ b/utgard/r5p1/platform/meson_bu/platform_gx.c @@ -81,14 +81,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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/r6p1/platform/meson_bu/platform_gx.c b/utgard/r6p1/platform/meson_bu/platform_gx.c index e1b256e..79f513c 100644 --- a/utgard/r6p1/platform/meson_bu/platform_gx.c +++ b/utgard/r6p1/platform/meson_bu/platform_gx.c @@ -83,14 +83,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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/r6p2/platform/meson_bu/platform_gx.c b/utgard/r6p2/platform/meson_bu/platform_gx.c index e1b256e..79f513c 100644 --- a/utgard/r6p2/platform/meson_bu/platform_gx.c +++ b/utgard/r6p2/platform/meson_bu/platform_gx.c @@ -83,14 +83,17 @@ int get_mali_freq_level(int freq) return level; mali_freq_num = mali_plat_data.dvfs_table_size - 1; - if (freq <= mali_plat_data.clk_sample[0]) + 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; + 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