Merge remote-tracking branches 'regulator/fix/isl9305', 'regulator/fix/rk808' and...
[muen/linux.git] / drivers / regulator / rk808-regulator.c
index 3314bf299a51f54fcff2fed6f600ae33eaf44a57..a16d81420612e485e2a96e1fe679d3c3b13d7d31 100644 (file)
@@ -120,7 +120,7 @@ static const struct regulator_linear_range rk808_ldo3_voltage_ranges[] = {
 static int rk808_buck1_2_get_voltage_sel_regmap(struct regulator_dev *rdev)
 {
        struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev);
-       int id = rdev->desc->id - RK808_ID_DCDC1;
+       int id = rdev_get_id(rdev);
        struct gpio_desc *gpio = pdata->dvs_gpio[id];
        unsigned int val;
        int ret;
@@ -193,7 +193,7 @@ static int rk808_buck1_2_set_voltage_sel(struct regulator_dev *rdev,
                                         unsigned sel)
 {
        struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev);
-       int id = rdev->desc->id - RK808_ID_DCDC1;
+       int id = rdev_get_id(rdev);
        struct gpio_desc *gpio = pdata->dvs_gpio[id];
        unsigned int reg = rdev->desc->vsel_reg;
        unsigned old_sel;
@@ -232,7 +232,7 @@ static int rk808_buck1_2_set_voltage_time_sel(struct regulator_dev *rdev,
                                       unsigned int new_selector)
 {
        struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev);
-       int id = rdev->desc->id - RK808_ID_DCDC1;
+       int id = rdev_get_id(rdev);
        struct gpio_desc *gpio = pdata->dvs_gpio[id];
 
        /* if there is no dvs1/2 pin, we don't need wait extra time here. */
@@ -245,8 +245,7 @@ static int rk808_buck1_2_set_voltage_time_sel(struct regulator_dev *rdev,
 static int rk808_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
 {
        unsigned int ramp_value = RK808_RAMP_RATE_10MV_PER_US;
-       unsigned int reg = rk808_buck_config_regs[rdev->desc->id -
-                                                 RK808_ID_DCDC1];
+       unsigned int reg = rk808_buck_config_regs[rdev_get_id(rdev)];
 
        switch (ramp_delay) {
        case 1 ... 2000:
@@ -520,7 +519,7 @@ static const struct regulator_desc rk818_reg[] = {
                RK818_LDO1_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
                BIT(0), 400),
        RK8XX_DESC(RK818_ID_LDO2, "LDO_REG2", "vcc6", 1800, 3400, 100,
-               RK818_LDO1_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
+               RK818_LDO2_ON_VSEL_REG, RK818_LDO_VSEL_MASK, RK818_LDO_EN_REG,
                BIT(1), 400),
        {
                .name = "LDO_REG3",