Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[pandora-kernel.git] / drivers / regulator / wm8994-regulator.c
index 594f88e..35b2958 100644 (file)
@@ -130,10 +130,19 @@ static struct regulator_ops wm8994_ldo1_ops = {
 static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
                                    unsigned int selector)
 {
+       struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
+
        if (selector > WM8994_LDO2_MAX_SELECTOR)
                return -EINVAL;
 
-       return (selector * 100000) + 900000;
+       switch (ldo->wm8994->type) {
+       case WM8994:
+               return (selector * 100000) + 900000;
+       case WM8958:
+               return (selector * 100000) + 1000000;
+       default:
+               return -EINVAL;
+       }
 }
 
 static int wm8994_ldo2_get_voltage_sel(struct regulator_dev *rdev)
@@ -154,7 +163,17 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev,
        struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
        int selector, v;
 
-       selector = (min_uV - 900000) / 100000;
+       switch (ldo->wm8994->type) {
+       case WM8994:
+               selector = (min_uV - 900000) / 100000;
+               break;
+       case WM8958:
+               selector = (min_uV - 1000000) / 100000;
+               break;
+       default:
+               return -EINVAL;
+       }
+
        v = wm8994_ldo2_list_voltage(rdev, selector);
        if (v < 0 || v > max_uV)
                return -EINVAL;