diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-04-05 02:04:48 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-05 06:07:23 -0400 |
commit | e3a7384c3e98c48b5f122e449e22cc8a1a6c7e0d (patch) | |
tree | 3bfe325f5655f27cb23bc17e6518814a215dbf35 | |
parent | 9cc7a453b637d8c1f628f9873204ff55d7aa664c (diff) |
regulator: rc5t583: Remove nsteps from struct rc5t583_regulator_info
The nsteps can be calculated by (_max_mv - _min_mv) * 1000 / _step_uV + 1,
thus we can remove _nsteps from RC5T583_REG macro, and then remove
nsteps from struct rc5t583_regulator_info.
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>
-rw-r--r-- | drivers/regulator/rc5t583-regulator.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c index dc9ebb9bfd23..578bd5d48858 100644 --- a/drivers/regulator/rc5t583-regulator.c +++ b/drivers/regulator/rc5t583-regulator.c | |||
@@ -49,7 +49,6 @@ struct rc5t583_regulator_info { | |||
49 | int min_uV; | 49 | int min_uV; |
50 | int max_uV; | 50 | int max_uV; |
51 | int step_uV; | 51 | int step_uV; |
52 | int nsteps; | ||
53 | 52 | ||
54 | /* Regulator specific turn-on delay and voltage settling time*/ | 53 | /* Regulator specific turn-on delay and voltage settling time*/ |
55 | int enable_uv_per_us; | 54 | int enable_uv_per_us; |
@@ -131,7 +130,7 @@ static int rc5t583_set_voltage_sel(struct regulator_dev *rdev, | |||
131 | struct rc5t583_regulator *reg = rdev_get_drvdata(rdev); | 130 | struct rc5t583_regulator *reg = rdev_get_drvdata(rdev); |
132 | struct rc5t583_regulator_info *ri = reg->reg_info; | 131 | struct rc5t583_regulator_info *ri = reg->reg_info; |
133 | int ret; | 132 | int ret; |
134 | if (selector >= ri->nsteps) { | 133 | if (selector >= rdev->desc->n_voltages) { |
135 | dev_err(&rdev->dev, "Invalid selector 0x%02x\n", selector); | 134 | dev_err(&rdev->dev, "Invalid selector 0x%02x\n", selector); |
136 | return -EINVAL; | 135 | return -EINVAL; |
137 | } | 136 | } |
@@ -198,8 +197,7 @@ static struct regulator_ops rc5t583_ops = { | |||
198 | }; | 197 | }; |
199 | 198 | ||
200 | #define RC5T583_REG(_id, _en_reg, _en_bit, _disc_reg, _disc_bit, _vout_reg, \ | 199 | #define RC5T583_REG(_id, _en_reg, _en_bit, _disc_reg, _disc_bit, _vout_reg, \ |
201 | _vout_mask, _ds_reg, _min_mv, _max_mv, _step_uV, _nsteps, \ | 200 | _vout_mask, _ds_reg, _min_mv, _max_mv, _step_uV, _enable_mv) \ |
202 | _enable_mv) \ | ||
203 | { \ | 201 | { \ |
204 | .reg_en_reg = RC5T583_REG_##_en_reg, \ | 202 | .reg_en_reg = RC5T583_REG_##_en_reg, \ |
205 | .en_bit = _en_bit, \ | 203 | .en_bit = _en_bit, \ |
@@ -211,14 +209,13 @@ static struct regulator_ops rc5t583_ops = { | |||
211 | .min_uV = _min_mv * 1000, \ | 209 | .min_uV = _min_mv * 1000, \ |
212 | .max_uV = _max_mv * 1000, \ | 210 | .max_uV = _max_mv * 1000, \ |
213 | .step_uV = _step_uV, \ | 211 | .step_uV = _step_uV, \ |
214 | .nsteps = _nsteps, \ | ||
215 | .enable_uv_per_us = _enable_mv * 1000, \ | 212 | .enable_uv_per_us = _enable_mv * 1000, \ |
216 | .change_uv_per_us = 40 * 1000, \ | 213 | .change_uv_per_us = 40 * 1000, \ |
217 | .deepsleep_id = RC5T583_DS_##_id, \ | 214 | .deepsleep_id = RC5T583_DS_##_id, \ |
218 | .desc = { \ | 215 | .desc = { \ |
219 | .name = "rc5t583-regulator-"#_id, \ | 216 | .name = "rc5t583-regulator-"#_id, \ |
220 | .id = RC5T583_REGULATOR_##_id, \ | 217 | .id = RC5T583_REGULATOR_##_id, \ |
221 | .n_voltages = _nsteps, \ | 218 | .n_voltages = (_max_mv - _min_mv) * 1000 / _step_uV + 1, \ |
222 | .ops = &rc5t583_ops, \ | 219 | .ops = &rc5t583_ops, \ |
223 | .type = REGULATOR_VOLTAGE, \ | 220 | .type = REGULATOR_VOLTAGE, \ |
224 | .owner = THIS_MODULE, \ | 221 | .owner = THIS_MODULE, \ |
@@ -227,33 +224,33 @@ static struct regulator_ops rc5t583_ops = { | |||
227 | 224 | ||
228 | static struct rc5t583_regulator_info rc5t583_reg_info[RC5T583_REGULATOR_MAX] = { | 225 | static struct rc5t583_regulator_info rc5t583_reg_info[RC5T583_REGULATOR_MAX] = { |
229 | RC5T583_REG(DC0, DC0CTL, 0, DC0CTL, 1, DC0DAC, 0x7F, DC0DAC_DS, | 226 | RC5T583_REG(DC0, DC0CTL, 0, DC0CTL, 1, DC0DAC, 0x7F, DC0DAC_DS, |
230 | 700, 1500, 12500, 0x41, 4), | 227 | 700, 1500, 12500, 4), |
231 | RC5T583_REG(DC1, DC1CTL, 0, DC1CTL, 1, DC1DAC, 0x7F, DC1DAC_DS, | 228 | RC5T583_REG(DC1, DC1CTL, 0, DC1CTL, 1, DC1DAC, 0x7F, DC1DAC_DS, |
232 | 700, 1500, 12500, 0x41, 14), | 229 | 700, 1500, 12500, 14), |
233 | RC5T583_REG(DC2, DC2CTL, 0, DC2CTL, 1, DC2DAC, 0x7F, DC2DAC_DS, | 230 | RC5T583_REG(DC2, DC2CTL, 0, DC2CTL, 1, DC2DAC, 0x7F, DC2DAC_DS, |
234 | 900, 2400, 12500, 0x79, 14), | 231 | 900, 2400, 12500, 14), |
235 | RC5T583_REG(DC3, DC3CTL, 0, DC3CTL, 1, DC3DAC, 0x7F, DC3DAC_DS, | 232 | RC5T583_REG(DC3, DC3CTL, 0, DC3CTL, 1, DC3DAC, 0x7F, DC3DAC_DS, |
236 | 900, 2400, 12500, 0x79, 14), | 233 | 900, 2400, 12500, 14), |
237 | RC5T583_REG(LDO0, LDOEN2, 0, LDODIS2, 0, LDO0DAC, 0x7F, LDO0DAC_DS, | 234 | RC5T583_REG(LDO0, LDOEN2, 0, LDODIS2, 0, LDO0DAC, 0x7F, LDO0DAC_DS, |
238 | 900, 3400, 25000, 0x65, 160), | 235 | 900, 3400, 25000, 160), |
239 | RC5T583_REG(LDO1, LDOEN2, 1, LDODIS2, 1, LDO1DAC, 0x7F, LDO1DAC_DS, | 236 | RC5T583_REG(LDO1, LDOEN2, 1, LDODIS2, 1, LDO1DAC, 0x7F, LDO1DAC_DS, |
240 | 900, 3400, 25000, 0x65, 160), | 237 | 900, 3400, 25000, 160), |
241 | RC5T583_REG(LDO2, LDOEN2, 2, LDODIS2, 2, LDO2DAC, 0x7F, LDO2DAC_DS, | 238 | RC5T583_REG(LDO2, LDOEN2, 2, LDODIS2, 2, LDO2DAC, 0x7F, LDO2DAC_DS, |
242 | 900, 3400, 25000, 0x65, 160), | 239 | 900, 3400, 25000, 160), |
243 | RC5T583_REG(LDO3, LDOEN2, 3, LDODIS2, 3, LDO3DAC, 0x7F, LDO3DAC_DS, | 240 | RC5T583_REG(LDO3, LDOEN2, 3, LDODIS2, 3, LDO3DAC, 0x7F, LDO3DAC_DS, |
244 | 900, 3400, 25000, 0x65, 160), | 241 | 900, 3400, 25000, 160), |
245 | RC5T583_REG(LDO4, LDOEN2, 4, LDODIS2, 4, LDO4DAC, 0x3F, LDO4DAC_DS, | 242 | RC5T583_REG(LDO4, LDOEN2, 4, LDODIS2, 4, LDO4DAC, 0x3F, LDO4DAC_DS, |
246 | 750, 1500, 12500, 0x3D, 133), | 243 | 750, 1500, 12500, 133), |
247 | RC5T583_REG(LDO5, LDOEN2, 5, LDODIS2, 5, LDO5DAC, 0x7F, LDO5DAC_DS, | 244 | RC5T583_REG(LDO5, LDOEN2, 5, LDODIS2, 5, LDO5DAC, 0x7F, LDO5DAC_DS, |
248 | 900, 3400, 25000, 0x65, 267), | 245 | 900, 3400, 25000, 267), |
249 | RC5T583_REG(LDO6, LDOEN2, 6, LDODIS2, 6, LDO6DAC, 0x7F, LDO6DAC_DS, | 246 | RC5T583_REG(LDO6, LDOEN2, 6, LDODIS2, 6, LDO6DAC, 0x7F, LDO6DAC_DS, |
250 | 900, 3400, 25000, 0x65, 133), | 247 | 900, 3400, 25000, 133), |
251 | RC5T583_REG(LDO7, LDOEN2, 7, LDODIS2, 7, LDO7DAC, 0x7F, LDO7DAC_DS, | 248 | RC5T583_REG(LDO7, LDOEN2, 7, LDODIS2, 7, LDO7DAC, 0x7F, LDO7DAC_DS, |
252 | 900, 3400, 25000, 0x65, 233), | 249 | 900, 3400, 25000, 233), |
253 | RC5T583_REG(LDO8, LDOEN1, 0, LDODIS1, 0, LDO8DAC, 0x7F, LDO8DAC_DS, | 250 | RC5T583_REG(LDO8, LDOEN1, 0, LDODIS1, 0, LDO8DAC, 0x7F, LDO8DAC_DS, |
254 | 900, 3400, 25000, 0x65, 233), | 251 | 900, 3400, 25000, 233), |
255 | RC5T583_REG(LDO9, LDOEN1, 1, LDODIS1, 1, LDO9DAC, 0x7F, LDO9DAC_DS, | 252 | RC5T583_REG(LDO9, LDOEN1, 1, LDODIS1, 1, LDO9DAC, 0x7F, LDO9DAC_DS, |
256 | 900, 3400, 25000, 0x65, 133), | 253 | 900, 3400, 25000, 133), |
257 | }; | 254 | }; |
258 | 255 | ||
259 | static int __devinit rc5t583_regulator_probe(struct platform_device *pdev) | 256 | static int __devinit rc5t583_regulator_probe(struct platform_device *pdev) |