From: chenxing Date: Wed, 19 Jun 2013 09:34:25 +0000 (+0800) Subject: rk3066B/rk3168: Negative voltage diff support for rk3066B/rk3168 X-Git-Tag: firefly_0821_release~6965^2~51 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8e4653b2bdf2324ae504fbe06ea42ca0d0935ab8;p=firefly-linux-kernel-4.4.55.git rk3066B/rk3168: Negative voltage diff support for rk3066B/rk3168 --- diff --git a/arch/arm/mach-rk30/dvfs.c b/arch/arm/mach-rk30/dvfs.c index 2398ba5fa040..0d6e5aef869d 100755 --- a/arch/arm/mach-rk30/dvfs.c +++ b/arch/arm/mach-rk30/dvfs.c @@ -77,8 +77,8 @@ static struct notifier_block rk_dvfs_clk_notifier = { .notifier_call = rk_dvfs_clk_notifier_event, }; #ifdef CONFIG_ARCH_RK3066B -static int g_arm_high_logic = 50 * 1000; -static int g_logic_high_arm = 100 * 1000; +static int g_arm_high_logic = 0 * 1000; +static int g_logic_high_arm = 50 * 1000; #else static int g_arm_high_logic = 150 * 1000; static int g_logic_high_arm = 100 * 1000; diff --git a/arch/arm/plat-rk/dvfs.c b/arch/arm/plat-rk/dvfs.c index d8afde4b261d..f43e959d0258 100644 --- a/arch/arm/plat-rk/dvfs.c +++ b/arch/arm/plat-rk/dvfs.c @@ -853,6 +853,7 @@ int dvfs_scale_volt(struct vd_node *vd_clk, struct vd_node *vd_dep, { struct regulator *regulator, *regulator_dep; int volt = 0, volt_dep = 0, step = 0, step_dep = 0; + int volt_tmp = 0, volt_dep_tmp = 0; int volt_pre = 0, volt_dep_pre = 0; int ret = 0; @@ -888,51 +889,21 @@ int dvfs_scale_volt(struct vd_node *vd_clk, struct vd_node *vd_dep, } else if (step > 0) { // up voltage DVFS_DBG("step > 0\n"); + volt_tmp = volt_dep + clk_biger_than_dep; + volt_dep_tmp = volt + dep_biger_than_clk; - if (volt > volt_dep) { - if (volt_dep == volt_dep_new) { - volt = volt_dep + clk_biger_than_dep; - } else { - volt_dep = volt + dep_biger_than_clk; - } - } else if (volt < volt_dep){ - if (volt == volt_new) { - volt_dep = volt + dep_biger_than_clk; - } else { - volt = volt_dep + clk_biger_than_dep; - } - } else { - if (volt != volt_new) - volt = volt_dep + clk_biger_than_dep; - if (volt_dep != volt_dep_new) - volt_dep = volt + dep_biger_than_clk; - } - volt = volt > volt_new ? volt_new : volt; - volt_dep = volt_dep > volt_dep_new ? volt_dep_new : volt_dep; + volt = volt_tmp > volt_new ? volt_new : volt_tmp; + volt_dep = volt_dep_tmp > volt_dep_new ? volt_dep_new : volt_dep_tmp; } else if (step < 0) { // down voltage DVFS_DBG("step < 0\n"); - if (volt > volt_dep) { - if (volt == volt_new) { - volt_dep = volt - clk_biger_than_dep; - } else { - volt = volt_dep - dep_biger_than_clk; - } - } else if (volt < volt_dep){ - if (volt_dep == volt_dep_new) { - volt = volt_dep - dep_biger_than_clk; - } else { - volt_dep = volt - clk_biger_than_dep; - } - } else { - if (volt != volt_new) - volt = volt_dep - dep_biger_than_clk; - if (volt_dep != volt_dep_new) - volt_dep = volt - clk_biger_than_dep; - } - volt = volt < volt_new ? volt_new : volt; - volt_dep = volt_dep < volt_dep_new ? volt_dep_new : volt_dep; + + volt_tmp = volt_dep - dep_biger_than_clk; + volt_dep_tmp = volt - clk_biger_than_dep; + + volt = volt_tmp < volt_new ? volt_new : volt_tmp; + volt_dep = volt_dep_tmp < volt_dep_new ? volt_dep_new : volt_dep_tmp; } else { DVFS_ERR("Oops, some bugs here:Volt_new=%d(old=%d), volt_dep_new=%d(dep_old=%d)\n",