{.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},
};
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
}\r
\r
/* Check limit rate */\r
- if (dvfs_clk->freq_limit_en) {\r
+ //if (dvfs_clk->freq_limit_en) {\r
if (rate_hz < dvfs_clk->min_rate) {\r
rate_hz = dvfs_clk->min_rate;\r
} else if (rate_hz > dvfs_clk->max_rate) {\r
rate_hz = dvfs_clk->max_rate;\r
}\r
- }\r
+ //}\r
\r
/* need round rate */\r
rate_old = clk_get_rate(clk);\r
}\r
\r
/* Check limit rate */\r
- if (dvfs_clk->freq_limit_en) {\r
+ //if (dvfs_clk->freq_limit_en) {\r
if (rate_hz < dvfs_clk->min_rate) {\r
rate_hz = dvfs_clk->min_rate;\r
} else if (rate_hz > dvfs_clk->max_rate) {\r
rate_hz = dvfs_clk->max_rate;\r
}\r
- }\r
+ //}\r
\r
/* need round rate */\r
rate_old = clk_get_rate(clk);\r
return table;\r
}\r
\r
+\r
int dvfs_set_freq_volt_table(struct clk *clk, struct cpufreq_frequency_table *table)\r
{\r
struct clk_node *info = clk_get_dvfs_info(clk);\r
- if (!table || !info)\r
+ int i=0;\r
+\r
+ if (!info)\r
+ return -1; \r
+ if (!table)\r
+ { \r
+ info->min_rate=0; \r
+ info->max_rate=0; \r
return -1;\r
+ }\r
\r
mutex_lock(&mutex);\r
info->dvfs_table = table;\r
+ if(table[0].frequency!= CPUFREQ_TABLE_END)\r
+ {\r
+\r
+ info->min_rate=(table[0].frequency/1000)*1000*1000;//to hz\r
+ }\r
+ else\r
+ {\r
+ info->min_rate=0; \r
+ info->max_rate=0; \r
+ return -1;\r
+ }\r
+\r
+ for(i=0;table[i].frequency!= CPUFREQ_TABLE_END;i++)\r
+ {\r
+ \r
+ } \r
+ info->max_rate=(table[i-1].frequency/1000)*1000*1000;\r
+\r
+ DVFS_DBG("%s,clk %s,limit max=%lu,min=%lu\n",__FUNCTION__,info->name,info->max_rate,info->min_rate);\r
+\r
mutex_unlock(&mutex);\r
return 0;\r
}\r