+static int wm831x_buckv_set_voltage_step(struct regulator_dev * rdev, int min_uV, int max_uV)
+{
+ int old_vol;
+ int new_min_uV,new_max_uV;
+ int diff_value,step;
+ int ret;
+ int read_vol;
+
+ struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
+ struct wm831x *wm831x = dcdc->wm831x;
+ struct wm831x_pdata *pdata = wm831x->dev->platform_data;
+
+
+ //if(strcmp(rdev->constraints->name,"DCDC2") != 0)
+ if(strcmp(pdata->dcdc[1]->consumer_supplies[1].supply,"vcore") != 0)
+ {
+
+ ret = wm831x_buckv_set_voltage(rdev,min_uV,max_uV);
+ }
+ else
+ {
+ old_vol = wm831x_buckv_read_voltage(rdev);
+
+ new_min_uV = old_vol;
+ new_max_uV = old_vol+max_uV-min_uV;
+
+ if(old_vol > min_uV) //reduce voltage
+ {
+ diff_value = (old_vol - min_uV);
+
+ for(step = 100000; step<=diff_value; step += 100000)
+ {
+ new_min_uV = old_vol-step;
+ new_max_uV = old_vol+max_uV-min_uV-step;
+
+ ret = wm831x_buckv_set_voltage(rdev,new_min_uV,new_max_uV);
+ usleep_range(1000,1000);
+ }
+
+ if(new_min_uV > min_uV) //0< old_vol - min_uV < 100000 ||0< new_min_uV - min_uV < 1000000
+ {
+
+ ret = wm831x_buckv_set_voltage(rdev,min_uV,max_uV);
+ usleep_range(1000,1000);
+
+ }
+
+ }
+ else //rise voltage
+ {
+ diff_value = (min_uV- old_vol);
+ gpio_direction_output(RK29_PIN1_PD7, GPIO_HIGH);
+
+ for(step = 100000; step<=diff_value; step += 100000)
+ {
+ new_min_uV = old_vol + step;
+ new_max_uV = old_vol+max_uV-min_uV+step;
+
+ ret = wm831x_buckv_set_voltage(rdev,new_min_uV,new_max_uV);
+ usleep_range(1000,1000);
+ }
+ if(new_min_uV < min_uV)// min_uV - old_vol < 100000 || new_min_uV - old_vol < 100000
+ {
+ ret = wm831x_buckv_set_voltage(rdev,min_uV,max_uV);
+ usleep_range(1000,1000);
+ }
+
+ }
+
+ }
+ return ret;
+
+}
+