diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-03-22 07:22:38 +0800 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-24 10:49:10 +0000 |
commit | d8eb6fa7a9ae13f144eec51028ac6acf5174aee3 (patch) | |
tree | 602d0d01220a946f5eaa1a00c0f995a7246d418c /drivers/regulator | |
parent | 4a5d301328eb7cfb88f8164ddfd90c018b70ddc4 (diff) | |
download | linux-d8eb6fa7a9ae13f144eec51028ac6acf5174aee3.tar.bz2 |
regulator: st-pwm: Convert to get_voltage_sel
Also remove test for selector in st_pwm_regulator_set_voltage_sel, the checking
is already done in .list_voltage.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/st-pwm.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/regulator/st-pwm.c b/drivers/regulator/st-pwm.c index 6ef569ffd971..e367af1c5f9d 100644 --- a/drivers/regulator/st-pwm.c +++ b/drivers/regulator/st-pwm.c @@ -39,11 +39,11 @@ struct st_pwm_voltages { unsigned int dutycycle; }; -static int st_pwm_regulator_get_voltage(struct regulator_dev *dev) +static int st_pwm_regulator_get_voltage_sel(struct regulator_dev *dev) { struct st_pwm_regulator_data *drvdata = rdev_get_drvdata(dev); - return drvdata->pdata->duty_cycle_table[drvdata->state].uV; + return drvdata->state; } static int st_pwm_regulator_set_voltage_sel(struct regulator_dev *dev, @@ -53,9 +53,6 @@ static int st_pwm_regulator_set_voltage_sel(struct regulator_dev *dev, int dutycycle; int ret; - if (selector >= dev->desc->n_voltages) - return -EINVAL; - dutycycle = (ST_PWM_REG_PERIOD / 100) * drvdata->pdata->duty_cycle_table[selector].dutycycle; @@ -92,7 +89,7 @@ static int st_pwm_regulator_list_voltage(struct regulator_dev *dev, static struct regulator_ops st_pwm_regulator_voltage_ops = { .set_voltage_sel = st_pwm_regulator_set_voltage_sel, - .get_voltage = st_pwm_regulator_get_voltage, + .get_voltage_sel = st_pwm_regulator_get_voltage_sel, .list_voltage = st_pwm_regulator_list_voltage, .map_voltage = regulator_map_voltage_iterate, }; |