rk3066B/rk3168: Negative voltage diff support for rk3066B/rk3168
authorchenxing <chenxing@rock-chips.com>
Wed, 19 Jun 2013 09:34:25 +0000 (17:34 +0800)
committerchenxing <chenxing@rock-chips.com>
Wed, 19 Jun 2013 09:34:25 +0000 (17:34 +0800)
arch/arm/mach-rk30/dvfs.c
arch/arm/plat-rk/dvfs.c

index 2398ba5fa040d61b08396e0997f88bf00a69ba46..0d6e5aef869da472b9bc0dc9c6b0edabe9ab13f6 100755 (executable)
@@ -77,8 +77,8 @@ static struct notifier_block rk_dvfs_clk_notifier = {
        .notifier_call = rk_dvfs_clk_notifier_event,\r
 };\r
 #ifdef CONFIG_ARCH_RK3066B\r
-static int g_arm_high_logic = 50 * 1000;\r
-static int g_logic_high_arm = 100 * 1000;\r
+static int g_arm_high_logic = 0 * 1000;\r
+static int g_logic_high_arm = 50 * 1000;\r
 #else\r
 static int g_arm_high_logic = 150 * 1000;\r
 static int g_logic_high_arm = 100 * 1000;\r
index d8afde4b261da567bd9d4816dfdc7b680c99f577..f43e959d02583265ff457cc9acb4ba672564ab7c 100644 (file)
@@ -853,6 +853,7 @@ int dvfs_scale_volt(struct vd_node *vd_clk, struct vd_node *vd_dep,
 {\r
        struct regulator *regulator, *regulator_dep;\r
        int volt = 0, volt_dep = 0, step = 0, step_dep = 0;\r
+       int volt_tmp = 0, volt_dep_tmp = 0;\r
        int volt_pre = 0, volt_dep_pre = 0;\r
        int ret = 0;\r
 \r
@@ -888,51 +889,21 @@ int dvfs_scale_volt(struct vd_node *vd_clk, struct vd_node *vd_dep,
                } else if (step > 0) {\r
                        // up voltage\r
                        DVFS_DBG("step > 0\n");\r
+                       volt_tmp = volt_dep + clk_biger_than_dep;\r
+                       volt_dep_tmp = volt + dep_biger_than_clk;\r
 \r
-                       if (volt > volt_dep) {\r
-                               if (volt_dep == volt_dep_new) {\r
-                                       volt = volt_dep + clk_biger_than_dep;\r
-                               } else {\r
-                                       volt_dep = volt + dep_biger_than_clk;\r
-                               }\r
-                       } else if (volt < volt_dep){\r
-                               if (volt == volt_new) {\r
-                                       volt_dep = volt + dep_biger_than_clk;\r
-                               } else {\r
-                                       volt = volt_dep + clk_biger_than_dep;\r
-                               }\r
-                       } else {\r
-                               if (volt != volt_new)\r
-                                       volt = volt_dep + clk_biger_than_dep;\r
-                               if (volt_dep != volt_dep_new)\r
-                                       volt_dep = volt + dep_biger_than_clk;\r
-                       }\r
-                       volt = volt > volt_new ? volt_new : volt;\r
-                       volt_dep = volt_dep > volt_dep_new ? volt_dep_new : volt_dep;\r
+                       volt = volt_tmp > volt_new ? volt_new : volt_tmp;\r
+                       volt_dep = volt_dep_tmp > volt_dep_new ? volt_dep_new : volt_dep_tmp;\r
 \r
                } else if (step < 0) {\r
                        // down voltage\r
                        DVFS_DBG("step < 0\n");\r
-                       if (volt > volt_dep) {\r
-                               if (volt == volt_new) {\r
-                                       volt_dep = volt - clk_biger_than_dep;\r
-                               } else {\r
-                                       volt = volt_dep - dep_biger_than_clk;\r
-                               }\r
-                       } else if (volt < volt_dep){\r
-                               if (volt_dep == volt_dep_new) {\r
-                                       volt = volt_dep - dep_biger_than_clk;\r
-                               } else {\r
-                                       volt_dep = volt - clk_biger_than_dep;\r
-                               }\r
-                       } else {\r
-                               if (volt != volt_new)\r
-                                       volt = volt_dep - dep_biger_than_clk;\r
-                               if (volt_dep != volt_dep_new)\r
-                                       volt_dep = volt - clk_biger_than_dep;\r
-                       }\r
-                       volt = volt < volt_new ? volt_new : volt;\r
-                       volt_dep = volt_dep < volt_dep_new ? volt_dep_new : volt_dep;\r
+\r
+                       volt_tmp = volt_dep - dep_biger_than_clk;\r
+                       volt_dep_tmp = volt - clk_biger_than_dep;\r
+\r
+                       volt = volt_tmp < volt_new ? volt_new : volt_tmp;\r
+                       volt_dep = volt_dep_tmp < volt_dep_new ? volt_dep_new : volt_dep_tmp;\r
 \r
                } else {\r
                        DVFS_ERR("Oops, some bugs here:Volt_new=%d(old=%d), volt_dep_new=%d(dep_old=%d)\n",\r