diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-05-13 22:55:50 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-14 12:49:24 -0400 |
commit | 70e5f6456cf561de8842be537b066a1bab1f1fee (patch) | |
tree | 94c456202a1a4317810df1cc04d46fd92354bd4e /drivers/regulator/rc5t583-regulator.c | |
parent | 3209be17981e5f0360679143d288e6dbf1902f0f (diff) |
regulator: rc5t583: Convert to regulator_set_voltage_sel_regmap and regulator_map_voltage_linear
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/rc5t583-regulator.c')
-rw-r--r-- | drivers/regulator/rc5t583-regulator.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c index f5d853731894..987fa34627fe 100644 --- a/drivers/regulator/rc5t583-regulator.c +++ b/drivers/regulator/rc5t583-regulator.c | |||
@@ -60,32 +60,6 @@ struct rc5t583_regulator { | |||
60 | struct regulator_dev *rdev; | 60 | struct regulator_dev *rdev; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static int rc5t583_set_voltage(struct regulator_dev *rdev, | ||
64 | int min_uV, int max_uV, unsigned *selector) | ||
65 | { | ||
66 | struct rc5t583_regulator *reg = rdev_get_drvdata(rdev); | ||
67 | int sel, ret; | ||
68 | |||
69 | if (min_uV < rdev->desc->min_uV) | ||
70 | min_uV = rdev->desc->min_uV; | ||
71 | |||
72 | sel = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step); | ||
73 | |||
74 | if (sel >= rdev->desc->n_voltages) { | ||
75 | dev_err(&rdev->dev, "Invalid selector 0x%02x\n", sel); | ||
76 | return -EINVAL; | ||
77 | } | ||
78 | |||
79 | *selector = sel; | ||
80 | |||
81 | ret = rc5t583_update(reg->mfd->dev, rdev->desc->vsel_reg, sel, | ||
82 | rdev->desc->vsel_mask); | ||
83 | if (ret < 0) | ||
84 | dev_err(&rdev->dev, "Error in update voltage register 0x%02x\n", | ||
85 | rdev->desc->vsel_reg); | ||
86 | return ret; | ||
87 | } | ||
88 | |||
89 | static int rc5t583_regulator_enable_time(struct regulator_dev *rdev) | 63 | static int rc5t583_regulator_enable_time(struct regulator_dev *rdev) |
90 | { | 64 | { |
91 | struct rc5t583_regulator *reg = rdev_get_drvdata(rdev); | 65 | struct rc5t583_regulator *reg = rdev_get_drvdata(rdev); |
@@ -120,8 +94,9 @@ static struct regulator_ops rc5t583_ops = { | |||
120 | .disable = regulator_disable_regmap, | 94 | .disable = regulator_disable_regmap, |
121 | .enable_time = rc5t583_regulator_enable_time, | 95 | .enable_time = rc5t583_regulator_enable_time, |
122 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 96 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
123 | .set_voltage = rc5t583_set_voltage, | 97 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
124 | .list_voltage = regulator_list_voltage_linear, | 98 | .list_voltage = regulator_list_voltage_linear, |
99 | .map_voltage = regulator_map_voltage_linear, | ||
125 | .set_voltage_time_sel = rc5t583_set_voltage_time_sel, | 100 | .set_voltage_time_sel = rc5t583_set_voltage_time_sel, |
126 | }; | 101 | }; |
127 | 102 | ||