aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/tps6586x-regulator.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-07-13 09:50:32 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-07-13 10:21:18 -0400
commit7c7fac30581b2fe2e0783d9b6f53ca333cc2296c (patch)
tree30ea5a68f7cef406011a5da7512f22f0f15e7a7a /drivers/regulator/tps6586x-regulator.c
parenta7f1b63eb85606ad77a559b95c703b99e1205aa4 (diff)
regulator: tps6586x: add support for input supply
There is multiple voltage input pins on device which takes the voltage input for different voltage regulator. Support to configure the voltage input supplied by different regulator for each regulators. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/tps6586x-regulator.c')
-rw-r--r--drivers/regulator/tps6586x-regulator.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index c0ac2418d6ab..e6da90ab5153 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -70,7 +70,7 @@ struct tps6586x_regulator {
70 70
71static inline struct device *to_tps6586x_dev(struct regulator_dev *rdev) 71static inline struct device *to_tps6586x_dev(struct regulator_dev *rdev)
72{ 72{
73 return rdev_get_dev(rdev)->parent->parent; 73 return rdev_get_dev(rdev)->parent;
74} 74}
75 75
76static int tps6586x_set_voltage_sel(struct regulator_dev *rdev, 76static int tps6586x_set_voltage_sel(struct regulator_dev *rdev,
@@ -191,9 +191,10 @@ static const unsigned int tps6586x_dvm_voltages[] = {
191 1325000, 1350000, 1375000, 1400000, 1425000, 1450000, 1475000, 1500000, 191 1325000, 1350000, 1375000, 1400000, 1425000, 1450000, 1475000, 1500000,
192}; 192};
193 193
194#define TPS6586X_REGULATOR(_id, vdata, vreg, shift, nbits, \ 194#define TPS6586X_REGULATOR(_id, _pin_name, vdata, vreg, shift, nbits, \
195 ereg0, ebit0, ereg1, ebit1) \ 195 ereg0, ebit0, ereg1, ebit1) \
196 .desc = { \ 196 .desc = { \
197 .supply_name = _pin_name, \
197 .name = "REG-" #_id, \ 198 .name = "REG-" #_id, \
198 .ops = &tps6586x_regulator_ops, \ 199 .ops = &tps6586x_regulator_ops, \
199 .type = REGULATOR_VOLTAGE, \ 200 .type = REGULATOR_VOLTAGE, \
@@ -214,37 +215,39 @@ static const unsigned int tps6586x_dvm_voltages[] = {
214 .go_reg = TPS6586X_##goreg, \ 215 .go_reg = TPS6586X_##goreg, \
215 .go_bit = (gobit), 216 .go_bit = (gobit),
216 217
217#define TPS6586X_LDO(_id, vdata, vreg, shift, nbits, \ 218#define TPS6586X_LDO(_id, _pname, vdata, vreg, shift, nbits, \
218 ereg0, ebit0, ereg1, ebit1) \ 219 ereg0, ebit0, ereg1, ebit1) \
219{ \ 220{ \
220 TPS6586X_REGULATOR(_id, vdata, vreg, shift, nbits, \ 221 TPS6586X_REGULATOR(_id, _pname, vdata, vreg, shift, nbits, \
221 ereg0, ebit0, ereg1, ebit1) \ 222 ereg0, ebit0, ereg1, ebit1) \
222} 223}
223 224
224#define TPS6586X_DVM(_id, vdata, vreg, shift, nbits, \ 225#define TPS6586X_DVM(_id, _pname, vdata, vreg, shift, nbits, \
225 ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ 226 ereg0, ebit0, ereg1, ebit1, goreg, gobit) \
226{ \ 227{ \
227 TPS6586X_REGULATOR(_id, vdata, vreg, shift, nbits, \ 228 TPS6586X_REGULATOR(_id, _pname, vdata, vreg, shift, nbits, \
228 ereg0, ebit0, ereg1, ebit1) \ 229 ereg0, ebit0, ereg1, ebit1) \
229 TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ 230 TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \
230} 231}
231 232
232static struct tps6586x_regulator tps6586x_regulator[] = { 233static struct tps6586x_regulator tps6586x_regulator[] = {
233 TPS6586X_LDO(LDO_0, ldo0, SUPPLYV1, 5, 3, ENC, 0, END, 0), 234 TPS6586X_LDO(LDO_0, "vinldo01", ldo0, SUPPLYV1, 5, 3, ENC, 0, END, 0),
234 TPS6586X_LDO(LDO_3, ldo, SUPPLYV4, 0, 3, ENC, 2, END, 2), 235 TPS6586X_LDO(LDO_3, "vinldo23", ldo, SUPPLYV4, 0, 3, ENC, 2, END, 2),
235 TPS6586X_LDO(LDO_5, ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6), 236 TPS6586X_LDO(LDO_5, NULL, ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6),
236 TPS6586X_LDO(LDO_6, ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4), 237 TPS6586X_LDO(LDO_6, "vinldo678", ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4),
237 TPS6586X_LDO(LDO_7, ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5), 238 TPS6586X_LDO(LDO_7, "vinldo678", ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5),
238 TPS6586X_LDO(LDO_8, ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6), 239 TPS6586X_LDO(LDO_8, "vinldo678", ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6),
239 TPS6586X_LDO(LDO_9, ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), 240 TPS6586X_LDO(LDO_9, "vinldo9", ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7),
240 TPS6586X_LDO(LDO_RTC, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7), 241 TPS6586X_LDO(LDO_RTC, NULL, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7),
241 TPS6586X_LDO(LDO_1, dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), 242 TPS6586X_LDO(LDO_1, "vinldo01", dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1),
242 TPS6586X_LDO(SM_2, sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7), 243 TPS6586X_LDO(SM_2, "sm2", sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7),
243 244
244 TPS6586X_DVM(LDO_2, dvm, LDO2BV1, 0, 5, ENA, 3, ENB, 3, VCC2, 6), 245 TPS6586X_DVM(LDO_2, "vinldo23", dvm, LDO2BV1, 0, 5, ENA, 3,
245 TPS6586X_DVM(LDO_4, ldo4, LDO4V1, 0, 5, ENC, 3, END, 3, VCC1, 6), 246 ENB, 3, VCC2, 6),
246 TPS6586X_DVM(SM_0, dvm, SM0V1, 0, 5, ENA, 1, ENB, 1, VCC1, 2), 247 TPS6586X_DVM(LDO_4, "vinldo4", ldo4, LDO4V1, 0, 5, ENC, 3,
247 TPS6586X_DVM(SM_1, dvm, SM1V1, 0, 5, ENA, 0, ENB, 0, VCC1, 0), 248 END, 3, VCC1, 6),
249 TPS6586X_DVM(SM_0, "sm0", dvm, SM0V1, 0, 5, ENA, 1, ENB, 1, VCC1, 2),
250 TPS6586X_DVM(SM_1, "sm1", dvm, SM1V1, 0, 5, ENA, 0, ENB, 0, VCC1, 0),
248}; 251};
249 252
250/* 253/*
@@ -351,7 +354,7 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev)
351 if (err) 354 if (err)
352 return err; 355 return err;
353 356
354 config.dev = &pdev->dev; 357 config.dev = pdev->dev.parent;
355 config.of_node = pdev->dev.of_node; 358 config.of_node = pdev->dev.of_node;
356 config.init_data = pdev->dev.platform_data; 359 config.init_data = pdev->dev.platform_data;
357 config.driver_data = ri; 360 config.driver_data = ri;