regulator: wm831x: Set the new rather than old value for DVS VSEL
[linux-2.6.git] / drivers / regulator / tps6524x-regulator.c
index 9166aa0..4a421be 100644 (file)
 #define N_DCDC                 3
 #define N_LDO                  2
 #define N_SWITCH               2
-#define N_REGULATORS           (3 /* DCDC */ + \
-                                2 /* LDO */  + \
-                                2 /* switch */)
+#define N_REGULATORS           (N_DCDC + N_LDO + N_SWITCH)
 
 #define FIXED_ILIMSEL          BIT(0)
 #define FIXED_VOLTAGE          BIT(1)
@@ -481,7 +479,7 @@ static int set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
        if (i >= info->n_voltages)
                i = info->n_voltages - 1;
 
-       *selector = info->voltages[i];
+       *selector = i;
 
        return write_field(hw, &info->voltage, i);
 }
@@ -651,7 +649,7 @@ static int __devinit pmic_probe(struct spi_device *spi)
                        hw->desc[i].n_voltages = 1;
 
                hw->rdev[i] = regulator_register(&hw->desc[i], dev,
-                                                init_data, hw);
+                                                init_data, hw, NULL);
                if (IS_ERR(hw->rdev[i])) {
                        ret = PTR_ERR(hw->rdev[i]);
                        hw->rdev[i] = NULL;