return NULL;\r
}\r
\r
-int dvfs_clk_enable_limit(struct clk *clk, unsigned int min_rate, unsigned max_rate)\r
+int dvfs_clk_enable_limit(struct clk *clk, unsigned int min_rate, unsigned int max_rate)\r
{\r
struct clk_node* dvfs_clk;\r
+ if (!clk->dvfs_info) {\r
+ DVFS_ERR("%s bad dvfs clock\n", __func__);\r
+ return -1;\r
+ }\r
dvfs_clk = clk->dvfs_info;\r
\r
dvfs_clk->freq_limit_en = 1;\r
dvfs_clk->min_rate = min_rate;\r
dvfs_clk->max_rate = max_rate;\r
\r
+ if (!dvfs_clk->enable_dvfs) {\r
+ DVFS_ERR("%s dvfs not enable yet\n", __func__);\r
+ return -1;\r
+ }\r
+\r
+ if (dvfs_clk->req_freq != 0)\r
+ dvfs_set_rate(clk, dvfs_clk->req_freq);\r
+ else\r
+ dvfs_set_rate(clk, dvfs_clk->set_freq);\r
return 0;\r
}\r
\r
int dvfs_clk_disable_limit(struct clk *clk)\r
{\r
struct clk_node* dvfs_clk;\r
+ if (!clk->dvfs_info) {\r
+ DVFS_ERR("%s bad dvfs clock\n", __func__);\r
+ return -1;\r
+ }\r
dvfs_clk = clk->dvfs_info;\r
\r
dvfs_clk->freq_limit_en = 0;\r
\r
+ if (!dvfs_clk->enable_dvfs) {\r
+ DVFS_ERR("%s dvfs not enable yet\n", __func__);\r
+ return -1;\r
+ }\r
+ \r
+ if (dvfs_clk->req_freq != 0)\r
+ dvfs_set_rate(clk, dvfs_clk->req_freq);\r
+ else\r
+ dvfs_set_rate(clk, dvfs_clk->set_freq);\r
+ \r
return 0;\r
}\r
\r
return -1;\r
mutex_lock(&mutex);\r
dvfs_clk->enable_dvfs = 0;\r
+ dvfs_clk->req_freq = 0;\r
dvfs_clk->vd = dvfs_clk->pds[0].pd->vd;\r
for (i = 0; dvfs_clk->pds[i].pd != NULL; i++) {\r
child = &(dvfs_clk->pds[i].clk_list);\r
return -1;\r
}\r
\r
+ dvfs_clk->req_freq = rate_hz;\r
/* Check limit rate */\r
if (dvfs_clk->freq_limit_en) {\r
if (rate_hz < dvfs_clk->min_rate) {\r
return -1;\r
}\r
\r
+ dvfs_clk->req_freq = rate_hz;\r
/* Check limit rate */\r
if (dvfs_clk->freq_limit_en) {\r
if (rate_hz < dvfs_clk->min_rate) {\r
*/\r
struct clk_node {\r
char *name;\r
- int set_freq; //KHZ\r
+ int req_freq; //KHZ, frequency request\r
+ int set_freq; //KHZ, frequency be set\r
int set_volt; //MV\r
int enable_dvfs;\r
int freq_limit_en; //sign if use limit frequency\r
int dvfs_set_depend_table(struct clk *clk, char *vd_name, struct cpufreq_frequency_table *table);\r
int dvfs_set_arm_logic_volt(struct dvfs_arm_table *dvfs_cpu_logic_table, struct cpufreq_frequency_table *cpu_dvfs_table, struct cpufreq_frequency_table *dep_cpu2core_table);\r
struct regulator* dvfs_get_regulator(char *regulator_name);\r
-int dvfs_clk_enable_limit(struct clk *clk, unsigned int min_rate, unsigned max_rate);\r
+int dvfs_clk_enable_limit(struct clk *clk, unsigned int min_rate, unsigned int max_rate);\r
int dvfs_clk_disable_limit(struct clk *clk);\r
\r
void avs_init(void);\r
static inline int dvfs_set_depend_table(struct clk *clk, char *vd_name, struct cpufreq_frequency_table *table) {return 0;}\r
static inline int dvfs_set_arm_logic_volt(struct dvfs_arm_table *dvfs_cpu_logic_table, struct cpufreq_frequency_table *cpu_dvfs_table, struct cpufreq_frequency_table *dep_cpu2core_table){ return 0; }\r
static inline struct regulator* dvfs_get_regulator(char *regulator_name){ return NULL; }\r
-static inline int dvfs_clk_enable_limit(struct clk *clk, unsigned int min_rate, unsigned max_rate){ return 0; }\r
+static inline int dvfs_clk_enable_limit(struct clk *clk, unsigned int min_rate, unsigned int max_rate){ return 0; }\r
static inline int dvfs_clk_disable_limit(struct clk *clk){ return 0; };\r
\r
static inline void avs_init(void){};\r