From: 张晴 Date: Mon, 22 Apr 2013 09:20:54 +0000 (+0800) Subject: rk808:support dcdc1\2 raise voltage by step X-Git-Tag: firefly_0821_release~7238 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bde565f96af3a00dcf72fed05dad5fb76dc43c51;p=firefly-linux-kernel-4.4.55.git rk808:support dcdc1\2 raise voltage by step --- diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 30bae3db1e71..80b153126e8a 100755 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -39,6 +39,8 @@ #define PM_CONTROL struct rk808 *g_rk808; +#define DCDC_RAISE_VOL_BYSTEP 1 +#define DCDC_VOL_STEP 25000 //25mv static struct mfd_cell rk808s[] = { { @@ -413,14 +415,34 @@ static int rk808_dcdc_set_voltage(struct regulator_dev *dev, struct rk808 *rk808 = rdev_get_drvdata(dev); int buck = rdev_get_id(dev) - RK808_DCDC1; u16 val; - int ret = 0; + int ret = 0,old_voltage =0,vol_temp =0; if (buck ==2){ - return 0; - }else{ - val = rk808_dcdc_select_min_voltage(dev,min_uV,max_uV,buck); - - ret = rk808_set_bits(rk808, rk808_BUCK_SET_VOL_REG(buck), BUCK_VOL_MASK, val); + return 0; + }else if (buck==3){ + val = rk808_dcdc_select_min_voltage(dev,min_uV,max_uV,buck); + ret = rk808_set_bits(rk808, rk808_BUCK_SET_VOL_REG(buck), BUCK_VOL_MASK, val); + } + else { +#if defined(DCDC_RAISE_VOL_BYSTEP) + old_voltage = rk808_dcdc_get_voltage(dev); + if (max_uV >old_voltage){ + vol_temp = old_voltage; + do{ + vol_temp += DCDC_VOL_STEP; + val = rk808_dcdc_select_min_voltage(dev,vol_temp,vol_temp,buck); + // printk("rk808_dcdc_set_voltage buck = %d vol_temp= %d old_voltage= %d min_uV =%d \n",buck,vol_temp,old_voltage,min_uV); + ret = rk808_set_bits(rk808, rk808_BUCK_SET_VOL_REG(buck), BUCK_VOL_MASK, val); + }while(vol_temp != max_uV); + } + else{ + val = rk808_dcdc_select_min_voltage(dev,min_uV,max_uV,buck); + ret = rk808_set_bits(rk808, rk808_BUCK_SET_VOL_REG(buck), BUCK_VOL_MASK, val); + } +#else + val = rk808_dcdc_select_min_voltage(dev,min_uV,max_uV,buck); + ret = rk808_set_bits(rk808, rk808_BUCK_SET_VOL_REG(buck), BUCK_VOL_MASK, val); +#endif } return ret; }