aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-09-04 16:43:39 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-09-05 19:57:00 -0400
commit9394b80c35760d13492a3a895add2891bc64bf86 (patch)
treed602dfa31f1e59defe4dc40a7672b8a74bca877f
parent4cbe5a555fa58a79b6ecbb6c531b8bab0650778d (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>
-rw-r--r--Documentation/devicetree/bindings/regulator/tps6586x.txt65
-rw-r--r--arch/arm/mach-tegra/board-harmony-power.c12
-rw-r--r--drivers/mfd/tps6586x.c13
-rw-r--r--drivers/regulator/tps6586x-regulator.c20
-rw-r--r--include/linux/mfd/tps6586x.h1
5 files changed, 81 insertions, 30 deletions
diff --git a/Documentation/devicetree/bindings/regulator/tps6586x.txt b/Documentation/devicetree/bindings/regulator/tps6586x.txt
index da80c2ae0915..a2436e1edfc1 100644
--- a/Documentation/devicetree/bindings/regulator/tps6586x.txt
+++ b/Documentation/devicetree/bindings/regulator/tps6586x.txt
@@ -8,7 +8,8 @@ Required properties:
8- gpio-controller: mark the device as a GPIO controller 8- gpio-controller: mark the device as a GPIO controller
9- regulators: list of regulators provided by this controller, must have 9- regulators: list of regulators provided by this controller, must have
10 property "regulator-compatible" to match their hardware counterparts: 10 property "regulator-compatible" to match their hardware counterparts:
11 sm[0-2], ldo[0-9] and ldo_rtc 11 sys, sm[0-2], ldo[0-9] and ldo_rtc
12- sys-supply: The input supply for SYS.
12- vin-sm0-supply: The input supply for the SM0. 13- vin-sm0-supply: The input supply for the SM0.
13- vin-sm1-supply: The input supply for the SM1. 14- vin-sm1-supply: The input supply for the SM1.
14- vin-sm2-supply: The input supply for the SM2. 15- vin-sm2-supply: The input supply for the SM2.
@@ -20,6 +21,9 @@ Required properties:
20 21
21Each regulator is defined using the standard binding for regulators. 22Each regulator is defined using the standard binding for regulators.
22 23
24Note: LDO5 and LDO_RTC is supplied by SYS regulator internally and driver
25 take care of making proper parent child relationship.
26
23Example: 27Example:
24 28
25 pmu: tps6586x@34 { 29 pmu: tps6586x@34 {
@@ -30,6 +34,7 @@ Example:
30 #gpio-cells = <2>; 34 #gpio-cells = <2>;
31 gpio-controller; 35 gpio-controller;
32 36
37 sys-supply = <&some_reg>;
33 vin-sm0-supply = <&some_reg>; 38 vin-sm0-supply = <&some_reg>;
34 vin-sm1-supply = <&some_reg>; 39 vin-sm1-supply = <&some_reg>;
35 vin-sm2-supply = <&some_reg>; 40 vin-sm2-supply = <&some_reg>;
@@ -43,8 +48,16 @@ Example:
43 #address-cells = <1>; 48 #address-cells = <1>;
44 #size-cells = <0>; 49 #size-cells = <0>;
45 50
46 sm0_reg: regulator@0 { 51 sys_reg: regulator@0 {
47 reg = <0>; 52 reg = <0>;
53 regulator-compatible = "sys";
54 regulator-name = "vdd_sys";
55 regulator-boot-on;
56 regulator-always-on;
57 };
58
59 sm0_reg: regulator@1 {
60 reg = <1>;
48 regulator-compatible = "sm0"; 61 regulator-compatible = "sm0";
49 regulator-min-microvolt = < 725000>; 62 regulator-min-microvolt = < 725000>;
50 regulator-max-microvolt = <1500000>; 63 regulator-max-microvolt = <1500000>;
@@ -52,8 +65,8 @@ Example:
52 regulator-always-on; 65 regulator-always-on;
53 }; 66 };
54 67
55 sm1_reg: regulator@1 { 68 sm1_reg: regulator@2 {
56 reg = <1>; 69 reg = <2>;
57 regulator-compatible = "sm1"; 70 regulator-compatible = "sm1";
58 regulator-min-microvolt = < 725000>; 71 regulator-min-microvolt = < 725000>;
59 regulator-max-microvolt = <1500000>; 72 regulator-max-microvolt = <1500000>;
@@ -61,8 +74,8 @@ Example:
61 regulator-always-on; 74 regulator-always-on;
62 }; 75 };
63 76
64 sm2_reg: regulator@2 { 77 sm2_reg: regulator@3 {
65 reg = <2>; 78 reg = <3>;
66 regulator-compatible = "sm2"; 79 regulator-compatible = "sm2";
67 regulator-min-microvolt = <3000000>; 80 regulator-min-microvolt = <3000000>;
68 regulator-max-microvolt = <4550000>; 81 regulator-max-microvolt = <4550000>;
@@ -70,72 +83,72 @@ Example:
70 regulator-always-on; 83 regulator-always-on;
71 }; 84 };
72 85
73 ldo0_reg: regulator@3 { 86 ldo0_reg: regulator@4 {
74 reg = <3>; 87 reg = <4>;
75 regulator-compatible = "ldo0"; 88 regulator-compatible = "ldo0";
76 regulator-name = "PCIE CLK"; 89 regulator-name = "PCIE CLK";
77 regulator-min-microvolt = <3300000>; 90 regulator-min-microvolt = <3300000>;
78 regulator-max-microvolt = <3300000>; 91 regulator-max-microvolt = <3300000>;
79 }; 92 };
80 93
81 ldo1_reg: regulator@4 { 94 ldo1_reg: regulator@5 {
82 reg = <4>; 95 reg = <5>;
83 regulator-compatible = "ldo1"; 96 regulator-compatible = "ldo1";
84 regulator-min-microvolt = < 725000>; 97 regulator-min-microvolt = < 725000>;
85 regulator-max-microvolt = <1500000>; 98 regulator-max-microvolt = <1500000>;
86 }; 99 };
87 100
88 ldo2_reg: regulator@5 { 101 ldo2_reg: regulator@6 {
89 reg = <5>; 102 reg = <6>;
90 regulator-compatible = "ldo2"; 103 regulator-compatible = "ldo2";
91 regulator-min-microvolt = < 725000>; 104 regulator-min-microvolt = < 725000>;
92 regulator-max-microvolt = <1500000>; 105 regulator-max-microvolt = <1500000>;
93 }; 106 };
94 107
95 ldo3_reg: regulator@6 { 108 ldo3_reg: regulator@7 {
96 reg = <6>; 109 reg = <7>;
97 regulator-compatible = "ldo3"; 110 regulator-compatible = "ldo3";
98 regulator-min-microvolt = <1250000>; 111 regulator-min-microvolt = <1250000>;
99 regulator-max-microvolt = <3300000>; 112 regulator-max-microvolt = <3300000>;
100 }; 113 };
101 114
102 ldo4_reg: regulator@7 { 115 ldo4_reg: regulator@8 {
103 reg = <7>; 116 reg = <8>;
104 regulator-compatible = "ldo4"; 117 regulator-compatible = "ldo4";
105 regulator-min-microvolt = <1700000>; 118 regulator-min-microvolt = <1700000>;
106 regulator-max-microvolt = <2475000>; 119 regulator-max-microvolt = <2475000>;
107 }; 120 };
108 121
109 ldo5_reg: regulator@8 { 122 ldo5_reg: regulator@9 {
110 reg = <8>; 123 reg = <9>;
111 regulator-compatible = "ldo5"; 124 regulator-compatible = "ldo5";
112 regulator-min-microvolt = <1250000>; 125 regulator-min-microvolt = <1250000>;
113 regulator-max-microvolt = <3300000>; 126 regulator-max-microvolt = <3300000>;
114 }; 127 };
115 128
116 ldo6_reg: regulator@9 { 129 ldo6_reg: regulator@10 {
117 reg = <9>; 130 reg = <10>;
118 regulator-compatible = "ldo6"; 131 regulator-compatible = "ldo6";
119 regulator-min-microvolt = <1250000>; 132 regulator-min-microvolt = <1250000>;
120 regulator-max-microvolt = <3300000>; 133 regulator-max-microvolt = <3300000>;
121 }; 134 };
122 135
123 ldo7_reg: regulator@10 { 136 ldo7_reg: regulator@11 {
124 reg = <10>; 137 reg = <11>;
125 regulator-compatible = "ldo7"; 138 regulator-compatible = "ldo7";
126 regulator-min-microvolt = <1250000>; 139 regulator-min-microvolt = <1250000>;
127 regulator-max-microvolt = <3300000>; 140 regulator-max-microvolt = <3300000>;
128 }; 141 };
129 142
130 ldo8_reg: regulator@11 { 143 ldo8_reg: regulator@12 {
131 reg = <11>; 144 reg = <12>;
132 regulator-compatible = "ldo8"; 145 regulator-compatible = "ldo8";
133 regulator-min-microvolt = <1250000>; 146 regulator-min-microvolt = <1250000>;
134 regulator-max-microvolt = <3300000>; 147 regulator-max-microvolt = <3300000>;
135 }; 148 };
136 149
137 ldo9_reg: regulator@12 { 150 ldo9_reg: regulator@13 {
138 reg = <12>; 151 reg = <13>;
139 regulator-compatible = "ldo9"; 152 regulator-compatible = "ldo9";
140 regulator-min-microvolt = <1250000>; 153 regulator-min-microvolt = <1250000>;
141 regulator-max-microvolt = <3300000>; 154 regulator-max-microvolt = <3300000>;
diff --git a/arch/arm/mach-tegra/board-harmony-power.c b/arch/arm/mach-tegra/board-harmony-power.c
index b7344beec102..94486e7e9dfd 100644
--- a/arch/arm/mach-tegra/board-harmony-power.c
+++ b/arch/arm/mach-tegra/board-harmony-power.c
@@ -67,6 +67,13 @@ static struct regulator_init_data ldo0_data = {
67 }, \ 67 }, \
68 } 68 }
69 69
70static struct regulator_init_data sys_data = {
71 .supply_regulator = "vdd_5v0",
72 .constraints = {
73 .name = "vdd_sys",
74 },
75};
76
70HARMONY_REGULATOR_INIT(sm0, "vdd_sm0", "vdd_sys", 725, 1500, 1); 77HARMONY_REGULATOR_INIT(sm0, "vdd_sm0", "vdd_sys", 725, 1500, 1);
71HARMONY_REGULATOR_INIT(sm1, "vdd_sm1", "vdd_sys", 725, 1500, 1); 78HARMONY_REGULATOR_INIT(sm1, "vdd_sm1", "vdd_sys", 725, 1500, 1);
72HARMONY_REGULATOR_INIT(sm2, "vdd_sm2", "vdd_sys", 3000, 4550, 1); 79HARMONY_REGULATOR_INIT(sm2, "vdd_sm2", "vdd_sys", 3000, 4550, 1);
@@ -74,7 +81,7 @@ HARMONY_REGULATOR_INIT(ldo1, "vdd_ldo1", "vdd_sm2", 725, 1500, 1);
74HARMONY_REGULATOR_INIT(ldo2, "vdd_ldo2", "vdd_sm2", 725, 1500, 0); 81HARMONY_REGULATOR_INIT(ldo2, "vdd_ldo2", "vdd_sm2", 725, 1500, 0);
75HARMONY_REGULATOR_INIT(ldo3, "vdd_ldo3", "vdd_sm2", 1250, 3300, 1); 82HARMONY_REGULATOR_INIT(ldo3, "vdd_ldo3", "vdd_sm2", 1250, 3300, 1);
76HARMONY_REGULATOR_INIT(ldo4, "vdd_ldo4", "vdd_sm2", 1700, 2475, 1); 83HARMONY_REGULATOR_INIT(ldo4, "vdd_ldo4", "vdd_sm2", 1700, 2475, 1);
77HARMONY_REGULATOR_INIT(ldo5, "vdd_ldo5", NULL, 1250, 3300, 1); 84HARMONY_REGULATOR_INIT(ldo5, "vdd_ldo5", "vdd_sys", 1250, 3300, 1);
78HARMONY_REGULATOR_INIT(ldo6, "vdd_ldo6", "vdd_sm2", 1250, 3300, 0); 85HARMONY_REGULATOR_INIT(ldo6, "vdd_ldo6", "vdd_sm2", 1250, 3300, 0);
79HARMONY_REGULATOR_INIT(ldo7, "vdd_ldo7", "vdd_sm2", 1250, 3300, 0); 86HARMONY_REGULATOR_INIT(ldo7, "vdd_ldo7", "vdd_sm2", 1250, 3300, 0);
80HARMONY_REGULATOR_INIT(ldo8, "vdd_ldo8", "vdd_sm2", 1250, 3300, 0); 87HARMONY_REGULATOR_INIT(ldo8, "vdd_ldo8", "vdd_sm2", 1250, 3300, 0);
@@ -88,6 +95,7 @@ HARMONY_REGULATOR_INIT(ldo9, "vdd_ldo9", "vdd_sm2", 1250, 3300, 1);
88 } 95 }
89 96
90static struct tps6586x_subdev_info tps_devs[] = { 97static struct tps6586x_subdev_info tps_devs[] = {
98 TPS_REG(SYS, &sys_data),
91 TPS_REG(SM_0, &sm0_data), 99 TPS_REG(SM_0, &sm0_data),
92 TPS_REG(SM_1, &sm1_data), 100 TPS_REG(SM_1, &sm1_data),
93 TPS_REG(SM_2, &sm2_data), 101 TPS_REG(SM_2, &sm2_data),
@@ -120,7 +128,7 @@ static struct i2c_board_info __initdata harmony_regulators[] = {
120 128
121int __init harmony_regulator_init(void) 129int __init harmony_regulator_init(void)
122{ 130{
123 regulator_register_always_on(0, "vdd_sys", 131 regulator_register_always_on(0, "vdd_5v0",
124 NULL, 0, 5000000); 132 NULL, 0, 5000000);
125 133
126 if (machine_is_harmony()) { 134 if (machine_is_harmony()) {
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
348static struct of_regulator_match tps6586x_matches[] = { 349static 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
165static struct regulator_ops tps6586x_sys_regulator_ops = {
166};
167
165static const unsigned int tps6586x_ldo0_voltages[] = { 168static 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
233static struct tps6586x_regulator tps6586x_regulator[] = { 248static 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
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index f350fd0ba1df..94514710a03f 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -14,6 +14,7 @@
14#define TPS6586X_SLEW_RATE_MASK 0x07 14#define TPS6586X_SLEW_RATE_MASK 0x07
15 15
16enum { 16enum {
17 TPS6586X_ID_SYS,
17 TPS6586X_ID_SM_0, 18 TPS6586X_ID_SM_0,
18 TPS6586X_ID_SM_1, 19 TPS6586X_ID_SM_1,
19 TPS6586X_ID_SM_2, 20 TPS6586X_ID_SM_2,