diff options
author | Axel Lin <axel.lin@ingics.com> | 2016-10-20 22:30:16 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-10-24 12:49:37 -0400 |
commit | bf8e27621effb49da525fb92a1f192db685d39bd (patch) | |
tree | eedc290986aff3fb63d997848ea60a1d7f280460 | |
parent | 1001354ca34179f3db924eb66672442a173147dc (diff) |
regulator: rk808: Use rdev_get_id() to access id of regulator
RK808_ID_DCDC1 is 0, no need to do subtract RK808_ID_DCDC1.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/regulator/rk808-regulator.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c index 3314bf299a51..fb44d5215e30 100644 --- a/drivers/regulator/rk808-regulator.c +++ b/drivers/regulator/rk808-regulator.c | |||
@@ -120,7 +120,7 @@ static const struct regulator_linear_range rk808_ldo3_voltage_ranges[] = { | |||
120 | static int rk808_buck1_2_get_voltage_sel_regmap(struct regulator_dev *rdev) | 120 | static int rk808_buck1_2_get_voltage_sel_regmap(struct regulator_dev *rdev) |
121 | { | 121 | { |
122 | struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev); | 122 | struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev); |
123 | int id = rdev->desc->id - RK808_ID_DCDC1; | 123 | int id = rdev_get_id(rdev); |
124 | struct gpio_desc *gpio = pdata->dvs_gpio[id]; | 124 | struct gpio_desc *gpio = pdata->dvs_gpio[id]; |
125 | unsigned int val; | 125 | unsigned int val; |
126 | int ret; | 126 | int ret; |
@@ -193,7 +193,7 @@ static int rk808_buck1_2_set_voltage_sel(struct regulator_dev *rdev, | |||
193 | unsigned sel) | 193 | unsigned sel) |
194 | { | 194 | { |
195 | struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev); | 195 | struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev); |
196 | int id = rdev->desc->id - RK808_ID_DCDC1; | 196 | int id = rdev_get_id(rdev); |
197 | struct gpio_desc *gpio = pdata->dvs_gpio[id]; | 197 | struct gpio_desc *gpio = pdata->dvs_gpio[id]; |
198 | unsigned int reg = rdev->desc->vsel_reg; | 198 | unsigned int reg = rdev->desc->vsel_reg; |
199 | unsigned old_sel; | 199 | unsigned old_sel; |
@@ -232,7 +232,7 @@ static int rk808_buck1_2_set_voltage_time_sel(struct regulator_dev *rdev, | |||
232 | unsigned int new_selector) | 232 | unsigned int new_selector) |
233 | { | 233 | { |
234 | struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev); | 234 | struct rk808_regulator_data *pdata = rdev_get_drvdata(rdev); |
235 | int id = rdev->desc->id - RK808_ID_DCDC1; | 235 | int id = rdev_get_id(rdev); |
236 | struct gpio_desc *gpio = pdata->dvs_gpio[id]; | 236 | struct gpio_desc *gpio = pdata->dvs_gpio[id]; |
237 | 237 | ||
238 | /* if there is no dvs1/2 pin, we don't need wait extra time here. */ | 238 | /* if there is no dvs1/2 pin, we don't need wait extra time here. */ |
@@ -245,8 +245,7 @@ static int rk808_buck1_2_set_voltage_time_sel(struct regulator_dev *rdev, | |||
245 | static int rk808_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) | 245 | static int rk808_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) |
246 | { | 246 | { |
247 | unsigned int ramp_value = RK808_RAMP_RATE_10MV_PER_US; | 247 | unsigned int ramp_value = RK808_RAMP_RATE_10MV_PER_US; |
248 | unsigned int reg = rk808_buck_config_regs[rdev->desc->id - | 248 | unsigned int reg = rk808_buck_config_regs[rdev_get_id(rdev)]; |
249 | RK808_ID_DCDC1]; | ||
250 | 249 | ||
251 | switch (ramp_delay) { | 250 | switch (ramp_delay) { |
252 | case 1 ... 2000: | 251 | case 1 ... 2000: |