From 3d9b8ec97e2a874d9d6bd623c7ff843a42500f1a Mon Sep 17 00:00:00 2001 From: xxx Date: Tue, 22 Jan 2013 12:31:39 +0800 Subject: [PATCH] arm gpu ddr rate is limited by cpufreq_frequency_table in board-xxx.c --- arch/arm/mach-rk30/board-rk3168-tb.c | 19 ++++++++++------- arch/arm/mach-rk30/cpufreq.c | 4 +--- arch/arm/mach-rk30/dvfs.c | 8 +++---- arch/arm/plat-rk/dvfs.c | 31 +++++++++++++++++++++++++++- 4 files changed, 47 insertions(+), 15 deletions(-) mode change 100644 => 100755 arch/arm/mach-rk30/cpufreq.c mode change 100644 => 100755 arch/arm/mach-rk30/dvfs.c diff --git a/arch/arm/mach-rk30/board-rk3168-tb.c b/arch/arm/mach-rk30/board-rk3168-tb.c index 063ac07979d5..0ed26c3b35db 100755 --- a/arch/arm/mach-rk30/board-rk3168-tb.c +++ b/arch/arm/mach-rk30/board-rk3168-tb.c @@ -1978,13 +1978,18 @@ static struct cpufreq_frequency_table dvfs_arm_table[] = { {.frequency = CPUFREQ_TABLE_END}, }; -static struct cpufreq_frequency_table dvfs_gpu_table[] = { - {.frequency = 100 * 1000, .index = 900 * 1000}, - {.frequency = 200 * 1000, .index = 950 * 1000}, - {.frequency = 266 * 1000, .index = 950 * 1000}, - {.frequency = 300 * 1000, .index = 950 * 1000}, - {.frequency = 400 * 1000, .index = 1000 * 1000}, - {.frequency = 600 * 1000, .index = 1100 * 1000}, +static struct cpufreq_frequency_table dvfs_gpu_table[] = { +#if defined(CONFIG_ARCH_RK3188) + {.frequency = 133 * 1000, .index = 900 * 1000},//the mininum rate is limited 133M for rk3188 +#elif defined(CONFIG_ARCH_RK3066B) + {.frequency = 100 * 1000, .index = 900 * 1000},//the minimum rate is no limit for rk3168 rk3066B +#endif + + {.frequency = 200 * 1000, .index = 950 * 1000}, + {.frequency = 266 * 1000, .index = 950 * 1000}, + {.frequency = 300 * 1000, .index = 950 * 1000}, + {.frequency = 400 * 1000, .index = 1000 * 1000}, + {.frequency = 600 * 1000, .index = 1100 * 1000}, {.frequency = CPUFREQ_TABLE_END}, }; diff --git a/arch/arm/mach-rk30/cpufreq.c b/arch/arm/mach-rk30/cpufreq.c old mode 100644 new mode 100755 index 047d61f2df05..e421a64a1338 --- a/arch/arm/mach-rk30/cpufreq.c +++ b/arch/arm/mach-rk30/cpufreq.c @@ -284,9 +284,7 @@ static int rk30_cpu_init(struct cpufreq_policy *policy) clk_enable_dvfs(cpu_clk); #if !defined(CONFIG_ARCH_RK3066B) -#if defined(CONFIG_ARCH_RK3188) - dvfs_clk_enable_limit(gpu_clk, 133000000, 600000000); -#else +#if defined(CONFIG_ARCH_RK30) /* Limit gpu frequency between 133M to 400M */ dvfs_clk_enable_limit(gpu_clk, 133000000, 400000000); #endif diff --git a/arch/arm/mach-rk30/dvfs.c b/arch/arm/mach-rk30/dvfs.c old mode 100644 new mode 100755 index e614f3fe0caa..10ba749267a8 --- a/arch/arm/mach-rk30/dvfs.c +++ b/arch/arm/mach-rk30/dvfs.c @@ -170,13 +170,13 @@ int dvfs_target_cpu(struct clk *clk, unsigned long rate_hz) } /* Check limit rate */ - if (dvfs_clk->freq_limit_en) { + //if (dvfs_clk->freq_limit_en) { if (rate_hz < dvfs_clk->min_rate) { rate_hz = dvfs_clk->min_rate; } else if (rate_hz > dvfs_clk->max_rate) { rate_hz = dvfs_clk->max_rate; } - } + //} /* need round rate */ rate_old = clk_get_rate(clk); @@ -303,13 +303,13 @@ int dvfs_target_core(struct clk *clk, unsigned long rate_hz) } /* Check limit rate */ - if (dvfs_clk->freq_limit_en) { + //if (dvfs_clk->freq_limit_en) { if (rate_hz < dvfs_clk->min_rate) { rate_hz = dvfs_clk->min_rate; } else if (rate_hz > dvfs_clk->max_rate) { rate_hz = dvfs_clk->max_rate; } - } + //} /* need round rate */ rate_old = clk_get_rate(clk); diff --git a/arch/arm/plat-rk/dvfs.c b/arch/arm/plat-rk/dvfs.c index 36e8332352e6..48de782dd988 100755 --- a/arch/arm/plat-rk/dvfs.c +++ b/arch/arm/plat-rk/dvfs.c @@ -254,14 +254,43 @@ struct cpufreq_frequency_table *dvfs_get_freq_volt_table(struct clk *clk) return table; } + int dvfs_set_freq_volt_table(struct clk *clk, struct cpufreq_frequency_table *table) { struct clk_node *info = clk_get_dvfs_info(clk); - if (!table || !info) + int i=0; + + if (!info) + return -1; + if (!table) + { + info->min_rate=0; + info->max_rate=0; return -1; + } mutex_lock(&mutex); info->dvfs_table = table; + if(table[0].frequency!= CPUFREQ_TABLE_END) + { + + info->min_rate=(table[0].frequency/1000)*1000*1000;//to hz + } + else + { + info->min_rate=0; + info->max_rate=0; + return -1; + } + + for(i=0;table[i].frequency!= CPUFREQ_TABLE_END;i++) + { + + } + info->max_rate=(table[i-1].frequency/1000)*1000*1000; + + DVFS_DBG("%s,clk %s,limit max=%lu,min=%lu\n",__FUNCTION__,info->name,info->max_rate,info->min_rate); + mutex_unlock(&mutex); return 0; } -- 2.34.1