diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-09-04 16:43:39 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-05 19:57:00 -0400 |
commit | 9394b80c35760d13492a3a895add2891bc64bf86 (patch) | |
tree | d602dfa31f1e59defe4dc40a7672b8a74bca877f /drivers | |
parent | 4cbe5a555fa58a79b6ecbb6c531b8bab0650778d (diff) |
regulator: tps6586x: add support for SYS rail
Device have SYS rail which is always ON. It is system power bus. LDO5
and LDO_RTC get powered through this rail internally. Add support for
this rail and make the LDO5/LDO_RTC supply by it. Update document
accordingly.
[swarren: Instantiate the sys regulator from board-harmony-power.c to
avoid regression.]
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/tps6586x.c | 13 | ||||
-rw-r--r-- | drivers/regulator/tps6586x-regulator.c | 20 |
2 files changed, 31 insertions, 2 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index 353c34812120..380a3c886d31 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/regmap.h> | 26 | #include <linux/regmap.h> |
27 | #include <linux/regulator/of_regulator.h> | 27 | #include <linux/regulator/of_regulator.h> |
28 | #include <linux/regulator/machine.h> | ||
28 | 29 | ||
29 | #include <linux/mfd/core.h> | 30 | #include <linux/mfd/core.h> |
30 | #include <linux/mfd/tps6586x.h> | 31 | #include <linux/mfd/tps6586x.h> |
@@ -346,6 +347,7 @@ failed: | |||
346 | 347 | ||
347 | #ifdef CONFIG_OF | 348 | #ifdef CONFIG_OF |
348 | static struct of_regulator_match tps6586x_matches[] = { | 349 | static struct of_regulator_match tps6586x_matches[] = { |
350 | { .name = "sys", .driver_data = (void *)TPS6586X_ID_SYS }, | ||
349 | { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 }, | 351 | { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 }, |
350 | { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 }, | 352 | { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 }, |
351 | { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 }, | 353 | { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 }, |
@@ -369,6 +371,7 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien | |||
369 | struct tps6586x_platform_data *pdata; | 371 | struct tps6586x_platform_data *pdata; |
370 | struct tps6586x_subdev_info *devs; | 372 | struct tps6586x_subdev_info *devs; |
371 | struct device_node *regs; | 373 | struct device_node *regs; |
374 | const char *sys_rail_name = NULL; | ||
372 | unsigned int count; | 375 | unsigned int count; |
373 | unsigned int i, j; | 376 | unsigned int i, j; |
374 | int err; | 377 | int err; |
@@ -391,12 +394,22 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien | |||
391 | return NULL; | 394 | return NULL; |
392 | 395 | ||
393 | for (i = 0, j = 0; i < num && j < count; i++) { | 396 | for (i = 0, j = 0; i < num && j < count; i++) { |
397 | struct regulator_init_data *reg_idata; | ||
398 | |||
394 | if (!tps6586x_matches[i].init_data) | 399 | if (!tps6586x_matches[i].init_data) |
395 | continue; | 400 | continue; |
396 | 401 | ||
402 | reg_idata = tps6586x_matches[i].init_data; | ||
397 | devs[j].name = "tps6586x-regulator"; | 403 | devs[j].name = "tps6586x-regulator"; |
398 | devs[j].platform_data = tps6586x_matches[i].init_data; | 404 | devs[j].platform_data = tps6586x_matches[i].init_data; |
399 | devs[j].id = (int)tps6586x_matches[i].driver_data; | 405 | devs[j].id = (int)tps6586x_matches[i].driver_data; |
406 | if (devs[j].id == TPS6586X_ID_SYS) | ||
407 | sys_rail_name = reg_idata->constraints.name; | ||
408 | |||
409 | if ((devs[j].id == TPS6586X_ID_LDO_5) || | ||
410 | (devs[j].id == TPS6586X_ID_LDO_RTC)) | ||
411 | reg_idata->supply_regulator = sys_rail_name; | ||
412 | |||
400 | devs[j].of_node = tps6586x_matches[i].of_node; | 413 | devs[j].of_node = tps6586x_matches[i].of_node; |
401 | j++; | 414 | j++; |
402 | } | 415 | } |
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 19241fc30050..82125269b667 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
@@ -162,6 +162,9 @@ static struct regulator_ops tps6586x_regulator_ops = { | |||
162 | .disable = tps6586x_regulator_disable, | 162 | .disable = tps6586x_regulator_disable, |
163 | }; | 163 | }; |
164 | 164 | ||
165 | static struct regulator_ops tps6586x_sys_regulator_ops = { | ||
166 | }; | ||
167 | |||
165 | static const unsigned int tps6586x_ldo0_voltages[] = { | 168 | static const unsigned int tps6586x_ldo0_voltages[] = { |
166 | 1200000, 1500000, 1800000, 2500000, 2700000, 2850000, 3100000, 3300000, | 169 | 1200000, 1500000, 1800000, 2500000, 2700000, 2850000, 3100000, 3300000, |
167 | }; | 170 | }; |
@@ -230,15 +233,28 @@ static const unsigned int tps6586x_dvm_voltages[] = { | |||
230 | TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ | 233 | TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ |
231 | } | 234 | } |
232 | 235 | ||
236 | #define TPS6586X_SYS_REGULATOR() \ | ||
237 | { \ | ||
238 | .desc = { \ | ||
239 | .supply_name = "sys", \ | ||
240 | .name = "REG-SYS", \ | ||
241 | .ops = &tps6586x_sys_regulator_ops, \ | ||
242 | .type = REGULATOR_VOLTAGE, \ | ||
243 | .id = TPS6586X_ID_SYS, \ | ||
244 | .owner = THIS_MODULE, \ | ||
245 | }, \ | ||
246 | } | ||
247 | |||
233 | static struct tps6586x_regulator tps6586x_regulator[] = { | 248 | static struct tps6586x_regulator tps6586x_regulator[] = { |
249 | TPS6586X_SYS_REGULATOR(), | ||
234 | TPS6586X_LDO(LDO_0, "vinldo01", ldo0, SUPPLYV1, 5, 3, ENC, 0, END, 0), | 250 | TPS6586X_LDO(LDO_0, "vinldo01", ldo0, SUPPLYV1, 5, 3, ENC, 0, END, 0), |
235 | TPS6586X_LDO(LDO_3, "vinldo23", ldo, SUPPLYV4, 0, 3, ENC, 2, END, 2), | 251 | TPS6586X_LDO(LDO_3, "vinldo23", ldo, SUPPLYV4, 0, 3, ENC, 2, END, 2), |
236 | TPS6586X_LDO(LDO_5, NULL, ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6), | 252 | TPS6586X_LDO(LDO_5, "REG-SYS", ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6), |
237 | TPS6586X_LDO(LDO_6, "vinldo678", ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4), | 253 | TPS6586X_LDO(LDO_6, "vinldo678", ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4), |
238 | TPS6586X_LDO(LDO_7, "vinldo678", ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5), | 254 | TPS6586X_LDO(LDO_7, "vinldo678", ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5), |
239 | TPS6586X_LDO(LDO_8, "vinldo678", ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6), | 255 | TPS6586X_LDO(LDO_8, "vinldo678", ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6), |
240 | TPS6586X_LDO(LDO_9, "vinldo9", ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), | 256 | TPS6586X_LDO(LDO_9, "vinldo9", ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), |
241 | TPS6586X_LDO(LDO_RTC, NULL, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7), | 257 | TPS6586X_LDO(LDO_RTC, "REG-SYS", ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7), |
242 | TPS6586X_LDO(LDO_1, "vinldo01", dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), | 258 | TPS6586X_LDO(LDO_1, "vinldo01", dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), |
243 | TPS6586X_LDO(SM_2, "vin-sm2", sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7), | 259 | TPS6586X_LDO(SM_2, "vin-sm2", sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7), |
244 | 260 | ||