Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Axel Lin and committed by
Mark Brown
d8eb6fa7 4a5d3013

+3 -6
+3 -6
drivers/regulator/st-pwm.c
··· 39 39 unsigned int dutycycle; 40 40 }; 41 41 42 - static int st_pwm_regulator_get_voltage(struct regulator_dev *dev) 42 + static int st_pwm_regulator_get_voltage_sel(struct regulator_dev *dev) 43 43 { 44 44 struct st_pwm_regulator_data *drvdata = rdev_get_drvdata(dev); 45 45 46 - return drvdata->pdata->duty_cycle_table[drvdata->state].uV; 46 + return drvdata->state; 47 47 } 48 48 49 49 static int st_pwm_regulator_set_voltage_sel(struct regulator_dev *dev, ··· 52 52 struct st_pwm_regulator_data *drvdata = rdev_get_drvdata(dev); 53 53 int dutycycle; 54 54 int ret; 55 - 56 - if (selector >= dev->desc->n_voltages) 57 - return -EINVAL; 58 55 59 56 dutycycle = (ST_PWM_REG_PERIOD / 100) * 60 57 drvdata->pdata->duty_cycle_table[selector].dutycycle; ··· 89 92 90 93 static struct regulator_ops st_pwm_regulator_voltage_ops = { 91 94 .set_voltage_sel = st_pwm_regulator_set_voltage_sel, 92 - .get_voltage = st_pwm_regulator_get_voltage, 95 + .get_voltage_sel = st_pwm_regulator_get_voltage_sel, 93 96 .list_voltage = st_pwm_regulator_list_voltage, 94 97 .map_voltage = regulator_map_voltage_iterate, 95 98 };