rk3066B/rk3168: Negative voltage diff support for rk3066B/rk3168

This commit is contained in:
chenxing
2013-06-19 17:34:25 +08:00
parent 905e839c87
commit 8e4653b2bd
2 changed files with 13 additions and 42 deletions

View File

@@ -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;

View File

@@ -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",