summaryrefslogtreecommitdiffstats
path: root/Documentation/power/regulator/overview.txt
blob: 40ca2d6e2742d182933443012aad9f6157eac361 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
Linux voltage and current regulator framework
=============================================

About
=====

This framework is designed to provide a standard kernel interface to control
voltage and current regulators.

The intention is to allow systems to dynamically control regulator power output
in order to save power and prolong battery life. This applies to both voltage
regulators (where voltage output is controllable) and current sinks (where
current limit is controllable).

(C) 2008  Wolfson Microelectronics PLC.
Author: Liam Girdwood <lrg@slimlogic.co.uk>


Nomenclature
============

Some terms used in this document:-

  o Regulator    - Electronic device that supplies power to other devices.
                   Most regulators can enable and disable their output whilst
                   some can control their output voltage and or current.

                   Input Voltage -> Regulator -> Output Voltage


  o PMIC         - Power Management IC. An IC that contains numerous regulators
                   and often contains other subsystems.


  o Consumer     - Electronic device that is supplied power by a regulator.
                   Consumers can be classified into two types:-

                   Static: consumer does not change its supply voltage or
                   current limit. It only needs to enable or disable its
                   power supply. Its supply voltage is set by the hardware,
                   bootloader, firmware or kernel board initialisation code.

                   Dynamic: consumer needs to change its supply voltage or
                   current limit to meet operation demands.


  o Power Domain - Electronic circuit that is supplied its input power by the
                   output power of a regulator, switch or by another power
                   domain.

                   The supply regulator may be behind a switch(s). i.e.

                   Regulator -+-> Switch-1 -+-> Switch-2 --> [Consumer A]
                              |             |
                              |             +-> [Consumer B], [Consumer C]
                              |
                              +-> [Consumer D], [Consumer E]

                   That is one regulator and three power domains:

                   Domain 1: Switch-1, Consumers D & E.
                   Domain 2: Switch-2, Consumers B & C.
                   Domain 3: Consumer A.

                   and this represents a "supplies" relationship:

                   Domain-1 --> Domain-2 --> Domain-3.

                   A power domain may have regulators that are supplied power
                   by other regulators. i.e.

                   Regulator-1 -+-> Regulator-2 -+-> [Consumer A]
                                |
                                +-> [Consumer B]

                   This gives us two regulators and two power domains:

                   Domain 1: Regulator-2, Consumer B.
                   Domain 2: Consumer A.

                   and a "supplies" relationship:

                   Domain-1 --> Domain-2


  o Constraints  - Constraints are used to define power levels for performance
                   and hardware protection. Constraints exist at three levels:

                   Regulator Level: This is defined by the regulator hardware
                   operating parameters and is specified in the regulator
                   datasheet. i.e.

                     - voltage output is in the range 800mV -> 3500mV.
                     - regulator current output limit is 20mA @ 5V but is
                       10mA @ 10V.

                   Power Domain Level: This is defined in software by kernel
                   level board initialisation code. It is used to constrain a
                   power domain to a particular power range. i.e.

                     - Domain-1 voltage is 3300mV
                     - Domain-2 voltage is 1400mV -> 1600mV
                     - Domain-3 current limit is 0mA -> 20mA.

                   Consumer Level: This is defined by consumer drivers
                   dynamically setting voltage or current limit levels.

                   e.g. a consumer backlight driver asks for a current increase
                   from 5mA to 10mA to increase LCD illumination. This passes
                   to through the levels as follows :-

                   Consumer: need to increase LCD brightness. Lookup and
                   request next current mA value in brightness table (the
                   consumer driver could be used on several different
                   personalities based upon the same reference device).

                   Power Domain: is the new current limit within the domain
                   operating limits for this domain and system state (e.g.
                   battery power, USB power)

                   Regulator Domains: is the new current limit within the
                   regulator operating parameters for input/output voltage.

                   If the regulator request passes all the constraint tests
                   then the new regulator value is applied.


Design
======

The framework is designed and targeted at SoC based devices but may also be
relevant to non SoC devices and is split into the following four interfaces:-


   1. Consumer driver interface.

      This uses a similar API to the kernel clock interface in that consumer
      drivers can get and put a regulator (like they can with clocks atm) and
      get/set voltage, current limit, mode, enable and disable. This should
      allow consumers complete control over their supply voltage and current
      limit. This also compiles out if not in use so drivers can be reused in
      systems with no regulator based power control.

        See Documentation/power/regulator/consumer.txt

   2. Regulator driver interface.

      This allows regulator drivers to register their regulators and provide
      operations to the core. It also has a notifier call chain for propagating
      regulator events to clients.

        See Documentation/power/regulator/regulator.txt

   3. Machine interface.

      This interface is for machine specific code and allows the creation of
      voltage/current domains (with constraints) for each regulator. It can
      provide regulator constraints that will prevent device damage through
      overvoltage or overcurrent caused by buggy client drivers. It also
      allows the creation of a regulator tree whereby some regulators are
      supplied by others (similar to a clock tree).

        See Documentation/power/regulator/machine.txt

   4. Userspace ABI.

      The framework also exports a lot of useful voltage/current/opmode data to
      userspace via sysfs. This could be used to help monitor device power
      consumption and status.

        See Documentation/ABI/testing/sysfs-class-regulator