edit dvfs regulator error reset setting
authorxxx <xxx@rock-chips.com>
Wed, 23 Jan 2013 17:15:19 +0000 (01:15 +0800)
committerxxx <xxx@rock-chips.com>
Wed, 23 Jan 2013 17:15:19 +0000 (01:15 +0800)
arch/arm/plat-rk/dvfs.c
arch/arm/plat-rk/include/plat/dvfs.h

index 523e72a1458a6dcbf155b52a360fdee8c79160c5..ce9e6a3e642e526085d6f9d863c4d793335f5513 100755 (executable)
@@ -59,6 +59,16 @@ int dvfs_regulator_set_voltage_readback(struct regulator *regulator, int min_uV,
        }\r
        return ret;\r
 }\r
+// for clk enable case to get vd regulator info\r
+void clk_enable_dvfs_regulator_check(struct vd_node *vd)\r
+{\r
+       vd->cur_volt = dvfs_regulator_get_voltage(vd->regulator);\r
+       if(vd->cur_volt<=0)\r
+       {\r
+               vd->volt_set_flag = DVFS_SET_VOLT_FAILURE;\r
+       }\r
+       vd->volt_set_flag = DVFS_SET_VOLT_SUCCESS;\r
+}\r
 \r
 struct regulator *dvfs_get_regulator(char *regulator_name) \r
 {\r
@@ -348,6 +358,9 @@ int dvfs_set_arm_logic_volt(struct dvfs_arm_table *dvfs_cpu_logic_table,
        return 0;\r
 }\r
 \r
+\r
+\r
+\r
 int clk_enable_dvfs(struct clk *clk)\r
 {\r
        struct clk_node *dvfs_clk;\r
@@ -369,7 +382,7 @@ int clk_enable_dvfs(struct clk *clk)
                                dvfs_clk->vd->regulator = dvfs_regulator_get(NULL, dvfs_clk->vd->regulator_name);\r
                        if (!IS_ERR_OR_NULL(dvfs_clk->vd->regulator)) {\r
                                // DVFS_DBG("dvfs_regulator_get(%s)\n",dvfs_clk->vd->regulator_name);\r
-                               dvfs_clk->vd->cur_volt = dvfs_regulator_get_voltage(dvfs_clk->vd->regulator);\r
+                               clk_enable_dvfs_regulator_check(dvfs_clk->vd);\r
                        } else {\r
                                //dvfs_clk->vd->regulator = NULL;\r
                                dvfs_clk->enable_dvfs = 0;\r
@@ -377,7 +390,7 @@ int clk_enable_dvfs(struct clk *clk)
                                return -1;\r
                        }\r
                } else {\r
-                       dvfs_clk->vd->cur_volt = dvfs_regulator_get_voltage(dvfs_clk->vd->regulator);\r
+                            clk_enable_dvfs_regulator_check(dvfs_clk->vd);\r
                        // DVFS_DBG("%s(%s) vd volt=%u\n",__func__,dvfs_clk->name,dvfs_clk->vd->cur_volt);\r
                }\r
 \r
@@ -390,13 +403,14 @@ int clk_enable_dvfs(struct clk *clk)
                                dvfs_clk->enable_dvfs = 0;\r
                                return -1;\r
                        } else {\r
-                               DVFS_ERR("WARNING: %s table all value are smaller than default, use default, just enable dvfs\n", __func__);\r
+                               DVFS_WARNING("%s table all value are smaller than default, use default, just enable dvfs\n", __func__);\r
                                dvfs_clk->enable_dvfs++;\r
                                return 0;\r
                        }\r
                }\r
 \r
                dvfs_clk->set_volt = clk_fv.index;\r
+               dvfs_vd_get_newvolt_byclk(dvfs_clk);\r
                // DVFS_DBG("%s,%s,freq%u(ref vol %u)\n",__func__,dvfs_clk->name,\r
                //       dvfs_clk->set_freq,dvfs_clk->set_volt);\r
 #if 0\r
@@ -405,7 +419,7 @@ int clk_enable_dvfs(struct clk *clk)
                        clk_notifier_register(clk, dvfs_clk->dvfs_nb);\r
                }\r
 #endif\r
-               dvfs_vd_get_newvolt_byclk(dvfs_clk);\r
+\r
 #if 0\r
                if(dvfs_clk->vd->cur_volt < dvfs_clk->set_volt) {\r
                        int ret;\r
@@ -819,12 +833,12 @@ int dvfs_reset_volt(struct vd_node *dvfs_vd)
                return -1;\r
        }\r
        if (flag_set_volt_correct <= 0) {\r
-               DVFS_ERR("%s (clk:%s), try to reload arm_volt error %d!!! stop scaling\n",\r
+               DVFS_ERR("%s (vd:%s), try to reload volt ,by it is error again(%d)!!! stop scaling\n",\r
                                __func__, dvfs_vd->name, flag_set_volt_correct);\r
                return -1;\r
        }\r
        dvfs_vd->volt_set_flag = DVFS_SET_VOLT_SUCCESS;\r
-       DVFS_ERR("%s (clk:%s), try to reload arm_volt! arm_volt_correct = %d\n",\r
+       DVFS_WARNING("%s (vd:%s), try to reload volt = %d\n",\r
                        __func__, dvfs_vd->name, flag_set_volt_correct);\r
 \r
        /* Reset vd's voltage */\r
index 2512a4950e7fd4bd1f8e6b2a3ec06714fe865b45..71a6905688fa315bb2b5200da279d773037b9aad 100755 (executable)
@@ -154,6 +154,8 @@ struct dvfs_arm_table {
 \r
 #define DVFS_ERR(fmt, args...) printk(KERN_ERR "DVFS ERR:\t"fmt, ##args)\r
 #define DVFS_LOG(fmt, args...) printk(KERN_DEBUG "DVFS LOG:\t"fmt, ##args)\r
+#define DVFS_WARNING(fmt, args...) printk(KERN_WARNING "DVFS WARNING:\t"fmt, ##args)\r
+\r
 \r
 \r
 #define DVFS_SET_VOLT_FAILURE  1\r