diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-01-13 08:37:24 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-01-13 08:37:24 +0100 |
commit | 6db9a0f326d3144d790d9479309df480a8f562e4 (patch) | |
tree | 650a8950c35c087278ecee1b8d123f75f601ebc8 /drivers/regulator/wm8994-regulator.c | |
parent | c400c9e23feb5bb3fbe8a8d4581ecce3b19a2f38 (diff) | |
parent | 18b022eb117e7f70c191267551ff865f278a9258 (diff) |
Merge branch 'topic/asoc' into for-linus
Diffstat (limited to 'drivers/regulator/wm8994-regulator.c')
-rw-r--r-- | drivers/regulator/wm8994-regulator.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 03713bc66e4..21fefef02a4 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c @@ -131,10 +131,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(struct regulator_dev *rdev) @@ -157,7 +166,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; |