aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/sysfs-class-regulator55
-rw-r--r--Documentation/power/regulator/machine.txt140
-rw-r--r--Documentation/power/regulator/regulator.txt8
3 files changed, 104 insertions, 99 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-regulator b/Documentation/ABI/testing/sysfs-class-regulator
index 79a4a75b2d2c..3731f6f29bcb 100644
--- a/Documentation/ABI/testing/sysfs-class-regulator
+++ b/Documentation/ABI/testing/sysfs-class-regulator
@@ -1,7 +1,7 @@
1What: /sys/class/regulator/.../state 1What: /sys/class/regulator/.../state
2Date: April 2008 2Date: April 2008
3KernelVersion: 2.6.26 3KernelVersion: 2.6.26
4Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 4Contact: Liam Girdwood <lrg@slimlogic.co.uk>
5Description: 5Description:
6 Each regulator directory will contain a field called 6 Each regulator directory will contain a field called
7 state. This holds the regulator output state. 7 state. This holds the regulator output state.
@@ -27,7 +27,7 @@ Description:
27What: /sys/class/regulator/.../type 27What: /sys/class/regulator/.../type
28Date: April 2008 28Date: April 2008
29KernelVersion: 2.6.26 29KernelVersion: 2.6.26
30Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 30Contact: Liam Girdwood <lrg@slimlogic.co.uk>
31Description: 31Description:
32 Each regulator directory will contain a field called 32 Each regulator directory will contain a field called
33 type. This holds the regulator type. 33 type. This holds the regulator type.
@@ -51,7 +51,7 @@ Description:
51What: /sys/class/regulator/.../microvolts 51What: /sys/class/regulator/.../microvolts
52Date: April 2008 52Date: April 2008
53KernelVersion: 2.6.26 53KernelVersion: 2.6.26
54Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 54Contact: Liam Girdwood <lrg@slimlogic.co.uk>
55Description: 55Description:
56 Each regulator directory will contain a field called 56 Each regulator directory will contain a field called
57 microvolts. This holds the regulator output voltage setting 57 microvolts. This holds the regulator output voltage setting
@@ -65,7 +65,7 @@ Description:
65What: /sys/class/regulator/.../microamps 65What: /sys/class/regulator/.../microamps
66Date: April 2008 66Date: April 2008
67KernelVersion: 2.6.26 67KernelVersion: 2.6.26
68Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 68Contact: Liam Girdwood <lrg@slimlogic.co.uk>
69Description: 69Description:
70 Each regulator directory will contain a field called 70 Each regulator directory will contain a field called
71 microamps. This holds the regulator output current limit 71 microamps. This holds the regulator output current limit
@@ -79,7 +79,7 @@ Description:
79What: /sys/class/regulator/.../opmode 79What: /sys/class/regulator/.../opmode
80Date: April 2008 80Date: April 2008
81KernelVersion: 2.6.26 81KernelVersion: 2.6.26
82Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 82Contact: Liam Girdwood <lrg@slimlogic.co.uk>
83Description: 83Description:
84 Each regulator directory will contain a field called 84 Each regulator directory will contain a field called
85 opmode. This holds the regulator operating mode setting. 85 opmode. This holds the regulator operating mode setting.
@@ -102,7 +102,7 @@ Description:
102What: /sys/class/regulator/.../min_microvolts 102What: /sys/class/regulator/.../min_microvolts
103Date: April 2008 103Date: April 2008
104KernelVersion: 2.6.26 104KernelVersion: 2.6.26
105Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 105Contact: Liam Girdwood <lrg@slimlogic.co.uk>
106Description: 106Description:
107 Each regulator directory will contain a field called 107 Each regulator directory will contain a field called
108 min_microvolts. This holds the minimum safe working regulator 108 min_microvolts. This holds the minimum safe working regulator
@@ -116,7 +116,7 @@ Description:
116What: /sys/class/regulator/.../max_microvolts 116What: /sys/class/regulator/.../max_microvolts
117Date: April 2008 117Date: April 2008
118KernelVersion: 2.6.26 118KernelVersion: 2.6.26
119Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 119Contact: Liam Girdwood <lrg@slimlogic.co.uk>
120Description: 120Description:
121 Each regulator directory will contain a field called 121 Each regulator directory will contain a field called
122 max_microvolts. This holds the maximum safe working regulator 122 max_microvolts. This holds the maximum safe working regulator
@@ -130,7 +130,7 @@ Description:
130What: /sys/class/regulator/.../min_microamps 130What: /sys/class/regulator/.../min_microamps
131Date: April 2008 131Date: April 2008
132KernelVersion: 2.6.26 132KernelVersion: 2.6.26
133Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 133Contact: Liam Girdwood <lrg@slimlogic.co.uk>
134Description: 134Description:
135 Each regulator directory will contain a field called 135 Each regulator directory will contain a field called
136 min_microamps. This holds the minimum safe working regulator 136 min_microamps. This holds the minimum safe working regulator
@@ -145,7 +145,7 @@ Description:
145What: /sys/class/regulator/.../max_microamps 145What: /sys/class/regulator/.../max_microamps
146Date: April 2008 146Date: April 2008
147KernelVersion: 2.6.26 147KernelVersion: 2.6.26
148Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 148Contact: Liam Girdwood <lrg@slimlogic.co.uk>
149Description: 149Description:
150 Each regulator directory will contain a field called 150 Each regulator directory will contain a field called
151 max_microamps. This holds the maximum safe working regulator 151 max_microamps. This holds the maximum safe working regulator
@@ -157,10 +157,23 @@ Description:
157 platform code. 157 platform code.
158 158
159 159
160What: /sys/class/regulator/.../name
161Date: October 2008
162KernelVersion: 2.6.28
163Contact: Liam Girdwood <lrg@slimlogic.co.uk>
164Description:
165 Each regulator directory will contain a field called
166 name. This holds a string identifying the regulator for
167 display purposes.
168
169 NOTE: this will be empty if no suitable name is provided
170 by platform or regulator drivers.
171
172
160What: /sys/class/regulator/.../num_users 173What: /sys/class/regulator/.../num_users
161Date: April 2008 174Date: April 2008
162KernelVersion: 2.6.26 175KernelVersion: 2.6.26
163Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 176Contact: Liam Girdwood <lrg@slimlogic.co.uk>
164Description: 177Description:
165 Each regulator directory will contain a field called 178 Each regulator directory will contain a field called
166 num_users. This holds the number of consumer devices that 179 num_users. This holds the number of consumer devices that
@@ -170,7 +183,7 @@ Description:
170What: /sys/class/regulator/.../requested_microamps 183What: /sys/class/regulator/.../requested_microamps
171Date: April 2008 184Date: April 2008
172KernelVersion: 2.6.26 185KernelVersion: 2.6.26
173Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 186Contact: Liam Girdwood <lrg@slimlogic.co.uk>
174Description: 187Description:
175 Each regulator directory will contain a field called 188 Each regulator directory will contain a field called
176 requested_microamps. This holds the total requested load 189 requested_microamps. This holds the total requested load
@@ -181,7 +194,7 @@ Description:
181What: /sys/class/regulator/.../parent 194What: /sys/class/regulator/.../parent
182Date: April 2008 195Date: April 2008
183KernelVersion: 2.6.26 196KernelVersion: 2.6.26
184Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 197Contact: Liam Girdwood <lrg@slimlogic.co.uk>
185Description: 198Description:
186 Some regulator directories will contain a link called parent. 199 Some regulator directories will contain a link called parent.
187 This points to the parent or supply regulator if one exists. 200 This points to the parent or supply regulator if one exists.
@@ -189,7 +202,7 @@ Description:
189What: /sys/class/regulator/.../suspend_mem_microvolts 202What: /sys/class/regulator/.../suspend_mem_microvolts
190Date: May 2008 203Date: May 2008
191KernelVersion: 2.6.26 204KernelVersion: 2.6.26
192Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 205Contact: Liam Girdwood <lrg@slimlogic.co.uk>
193Description: 206Description:
194 Each regulator directory will contain a field called 207 Each regulator directory will contain a field called
195 suspend_mem_microvolts. This holds the regulator output 208 suspend_mem_microvolts. This holds the regulator output
@@ -203,7 +216,7 @@ Description:
203What: /sys/class/regulator/.../suspend_disk_microvolts 216What: /sys/class/regulator/.../suspend_disk_microvolts
204Date: May 2008 217Date: May 2008
205KernelVersion: 2.6.26 218KernelVersion: 2.6.26
206Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 219Contact: Liam Girdwood <lrg@slimlogic.co.uk>
207Description: 220Description:
208 Each regulator directory will contain a field called 221 Each regulator directory will contain a field called
209 suspend_disk_microvolts. This holds the regulator output 222 suspend_disk_microvolts. This holds the regulator output
@@ -217,7 +230,7 @@ Description:
217What: /sys/class/regulator/.../suspend_standby_microvolts 230What: /sys/class/regulator/.../suspend_standby_microvolts
218Date: May 2008 231Date: May 2008
219KernelVersion: 2.6.26 232KernelVersion: 2.6.26
220Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 233Contact: Liam Girdwood <lrg@slimlogic.co.uk>
221Description: 234Description:
222 Each regulator directory will contain a field called 235 Each regulator directory will contain a field called
223 suspend_standby_microvolts. This holds the regulator output 236 suspend_standby_microvolts. This holds the regulator output
@@ -231,7 +244,7 @@ Description:
231What: /sys/class/regulator/.../suspend_mem_mode 244What: /sys/class/regulator/.../suspend_mem_mode
232Date: May 2008 245Date: May 2008
233KernelVersion: 2.6.26 246KernelVersion: 2.6.26
234Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 247Contact: Liam Girdwood <lrg@slimlogic.co.uk>
235Description: 248Description:
236 Each regulator directory will contain a field called 249 Each regulator directory will contain a field called
237 suspend_mem_mode. This holds the regulator operating mode 250 suspend_mem_mode. This holds the regulator operating mode
@@ -245,7 +258,7 @@ Description:
245What: /sys/class/regulator/.../suspend_disk_mode 258What: /sys/class/regulator/.../suspend_disk_mode
246Date: May 2008 259Date: May 2008
247KernelVersion: 2.6.26 260KernelVersion: 2.6.26
248Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 261Contact: Liam Girdwood <lrg@slimlogic.co.uk>
249Description: 262Description:
250 Each regulator directory will contain a field called 263 Each regulator directory will contain a field called
251 suspend_disk_mode. This holds the regulator operating mode 264 suspend_disk_mode. This holds the regulator operating mode
@@ -258,7 +271,7 @@ Description:
258What: /sys/class/regulator/.../suspend_standby_mode 271What: /sys/class/regulator/.../suspend_standby_mode
259Date: May 2008 272Date: May 2008
260KernelVersion: 2.6.26 273KernelVersion: 2.6.26
261Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 274Contact: Liam Girdwood <lrg@slimlogic.co.uk>
262Description: 275Description:
263 Each regulator directory will contain a field called 276 Each regulator directory will contain a field called
264 suspend_standby_mode. This holds the regulator operating mode 277 suspend_standby_mode. This holds the regulator operating mode
@@ -272,7 +285,7 @@ Description:
272What: /sys/class/regulator/.../suspend_mem_state 285What: /sys/class/regulator/.../suspend_mem_state
273Date: May 2008 286Date: May 2008
274KernelVersion: 2.6.26 287KernelVersion: 2.6.26
275Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 288Contact: Liam Girdwood <lrg@slimlogic.co.uk>
276Description: 289Description:
277 Each regulator directory will contain a field called 290 Each regulator directory will contain a field called
278 suspend_mem_state. This holds the regulator operating state 291 suspend_mem_state. This holds the regulator operating state
@@ -287,7 +300,7 @@ Description:
287What: /sys/class/regulator/.../suspend_disk_state 300What: /sys/class/regulator/.../suspend_disk_state
288Date: May 2008 301Date: May 2008
289KernelVersion: 2.6.26 302KernelVersion: 2.6.26
290Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 303Contact: Liam Girdwood <lrg@slimlogic.co.uk>
291Description: 304Description:
292 Each regulator directory will contain a field called 305 Each regulator directory will contain a field called
293 suspend_disk_state. This holds the regulator operating state 306 suspend_disk_state. This holds the regulator operating state
@@ -302,7 +315,7 @@ Description:
302What: /sys/class/regulator/.../suspend_standby_state 315What: /sys/class/regulator/.../suspend_standby_state
303Date: May 2008 316Date: May 2008
304KernelVersion: 2.6.26 317KernelVersion: 2.6.26
305Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com> 318Contact: Liam Girdwood <lrg@slimlogic.co.uk>
306Description: 319Description:
307 Each regulator directory will contain a field called 320 Each regulator directory will contain a field called
308 suspend_standby_state. This holds the regulator operating 321 suspend_standby_state. This holds the regulator operating
diff --git a/Documentation/power/regulator/machine.txt b/Documentation/power/regulator/machine.txt
index c9a35665cf70..ce3487d99abe 100644
--- a/Documentation/power/regulator/machine.txt
+++ b/Documentation/power/regulator/machine.txt
@@ -2,17 +2,8 @@ Regulator Machine Driver Interface
2=================================== 2===================================
3 3
4The regulator machine driver interface is intended for board/machine specific 4The regulator machine driver interface is intended for board/machine specific
5initialisation code to configure the regulator subsystem. Typical things that 5initialisation code to configure the regulator subsystem.
6machine drivers would do are :-
7 6
8 1. Regulator -> Device mapping.
9 2. Regulator supply configuration.
10 3. Power Domain constraint setting.
11
12
13
141. Regulator -> device mapping
15==============================
16Consider the following machine :- 7Consider the following machine :-
17 8
18 Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V] 9 Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
@@ -21,81 +12,82 @@ Consider the following machine :-
21 12
22The drivers for consumers A & B must be mapped to the correct regulator in 13The drivers for consumers A & B must be mapped to the correct regulator in
23order to control their power supply. This mapping can be achieved in machine 14order to control their power supply. This mapping can be achieved in machine
24initialisation code by calling :- 15initialisation code by creating a struct regulator_consumer_supply for
16each regulator.
17
18struct regulator_consumer_supply {
19 struct device *dev; /* consumer */
20 const char *supply; /* consumer supply - e.g. "vcc" */
21};
25 22
26int regulator_set_device_supply(const char *regulator, struct device *dev, 23e.g. for the machine above
27 const char *supply);
28 24
29and is shown with the following code :- 25static struct regulator_consumer_supply regulator1_consumers[] = {
26{
27 .dev = &platform_consumerB_device.dev,
28 .supply = "Vcc",
29},};
30 30
31regulator_set_device_supply("Regulator-1", devB, "Vcc"); 31static struct regulator_consumer_supply regulator2_consumers[] = {
32regulator_set_device_supply("Regulator-2", devA, "Vcc"); 32{
33 .dev = &platform_consumerA_device.dev,
34 .supply = "Vcc",
35},};
33 36
34This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2 37This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2
35to the 'Vcc' supply for Consumer A. 38to the 'Vcc' supply for Consumer A.
36 39
37 40Constraints can now be registered by defining a struct regulator_init_data
382. Regulator supply configuration. 41for each regulator power domain. This structure also maps the consumers
39================================== 42to their supply regulator :-
40Consider the following machine (again) :- 43
41 44static struct regulator_init_data regulator1_data = {
42 Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V] 45 .constraints = {
43 | 46 .min_uV = 3300000,
44 +-> [Consumer B @ 3.3V] 47 .max_uV = 3300000,
48 .valid_modes_mask = REGULATOR_MODE_NORMAL,
49 },
50 .num_consumer_supplies = ARRAY_SIZE(regulator1_consumers),
51 .consumer_supplies = regulator1_consumers,
52};
45 53
46Regulator-1 supplies power to Regulator-2. This relationship must be registered 54Regulator-1 supplies power to Regulator-2. This relationship must be registered
47with the core so that Regulator-1 is also enabled when Consumer A enables it's 55with the core so that Regulator-1 is also enabled when Consumer A enables it's
48supply (Regulator-2). 56supply (Regulator-2). The supply regulator is set by the supply_regulator_dev
49 57field below:-
50This relationship can be register with the core via :- 58
51 59static struct regulator_init_data regulator2_data = {
52int regulator_set_supply(const char *regulator, const char *regulator_supply); 60 .supply_regulator_dev = &platform_regulator1_device.dev,
53 61 .constraints = {
54In this example we would use the following code :- 62 .min_uV = 1800000,
55 63 .max_uV = 2000000,
56regulator_set_supply("Regulator-2", "Regulator-1"); 64 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
57 65 .valid_modes_mask = REGULATOR_MODE_NORMAL,
58Relationships can be queried by calling :- 66 },
59 67 .num_consumer_supplies = ARRAY_SIZE(regulator2_consumers),
60const char *regulator_get_supply(const char *regulator); 68 .consumer_supplies = regulator2_consumers,
61
62
633. Power Domain constraint setting.
64===================================
65Each power domain within a system has physical constraints on voltage and
66current. This must be defined in software so that the power domain is always
67operated within specifications.
68
69Consider the following machine (again) :-
70
71 Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
72 |
73 +-> [Consumer B @ 3.3V]
74
75This gives us two regulators and two power domains:
76
77 Domain 1: Regulator-2, Consumer B.
78 Domain 2: Consumer A.
79
80Constraints can be registered by calling :-
81
82int regulator_set_platform_constraints(const char *regulator,
83 struct regulation_constraints *constraints);
84
85The example is defined as follows :-
86
87struct regulation_constraints domain_1 = {
88 .min_uV = 3300000,
89 .max_uV = 3300000,
90 .valid_modes_mask = REGULATOR_MODE_NORMAL,
91}; 69};
92 70
93struct regulation_constraints domain_2 = { 71Finally the regulator devices must be registered in the usual manner.
94 .min_uV = 1800000, 72
95 .max_uV = 2000000, 73static struct platform_device regulator_devices[] = {
96 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, 74{
97 .valid_modes_mask = REGULATOR_MODE_NORMAL, 75 .name = "regulator",
76 .id = DCDC_1,
77 .dev = {
78 .platform_data = &regulator1_data,
79 },
80},
81{
82 .name = "regulator",
83 .id = DCDC_2,
84 .dev = {
85 .platform_data = &regulator2_data,
86 },
87},
98}; 88};
89/* register regulator 1 device */
90platform_device_register(&wm8350_regulator_devices[0]);
99 91
100regulator_set_platform_constraints("Regulator-1", &domain_1); 92/* register regulator 2 device */
101regulator_set_platform_constraints("Regulator-2", &domain_2); 93platform_device_register(&wm8350_regulator_devices[1]);
diff --git a/Documentation/power/regulator/regulator.txt b/Documentation/power/regulator/regulator.txt
index a69050143592..4200accb9bba 100644
--- a/Documentation/power/regulator/regulator.txt
+++ b/Documentation/power/regulator/regulator.txt
@@ -10,11 +10,11 @@ Registration
10 10
11Drivers can register a regulator by calling :- 11Drivers can register a regulator by calling :-
12 12
13struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 13struct regulator_dev *regulator_register(struct device *dev,
14 void *reg_data); 14 struct regulator_desc *regulator_desc);
15 15
16This will register the regulators capabilities and operations the regulator 16This will register the regulators capabilities and operations to the regulator
17core. The core does not touch reg_data (private to regulator driver). 17core.
18 18
19Regulators can be unregistered by calling :- 19Regulators can be unregistered by calling :-
20 20