overview.txt 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. Linux voltage and current regulator framework
  2. =============================================
  3. About
  4. =====
  5. This framework is designed to provide a standard kernel interface to control
  6. voltage and current regulators.
  7. The intention is to allow systems to dynamically control regulator power output
  8. in order to save power and prolong battery life. This applies to both voltage
  9. regulators (where voltage output is controllable) and current sinks (where
  10. current limit is controllable).
  11. (C) 2008 Wolfson Microelectronics PLC.
  12. Author: Liam Girdwood <lrg@slimlogic.co.uk>
  13. Nomenclature
  14. ============
  15. Some terms used in this document:-
  16. o Regulator - Electronic device that supplies power to other devices.
  17. Most regulators can enable and disable their output whilst
  18. some can control their output voltage and or current.
  19. Input Voltage -> Regulator -> Output Voltage
  20. o PMIC - Power Management IC. An IC that contains numerous regulators
  21. and often contains other subsystems.
  22. o Consumer - Electronic device that is supplied power by a regulator.
  23. Consumers can be classified into two types:-
  24. Static: consumer does not change its supply voltage or
  25. current limit. It only needs to enable or disable its
  26. power supply. Its supply voltage is set by the hardware,
  27. bootloader, firmware or kernel board initialisation code.
  28. Dynamic: consumer needs to change its supply voltage or
  29. current limit to meet operation demands.
  30. o Power Domain - Electronic circuit that is supplied its input power by the
  31. output power of a regulator, switch or by another power
  32. domain.
  33. The supply regulator may be behind a switch(s). i.e.
  34. Regulator -+-> Switch-1 -+-> Switch-2 --> [Consumer A]
  35. | |
  36. | +-> [Consumer B], [Consumer C]
  37. |
  38. +-> [Consumer D], [Consumer E]
  39. That is one regulator and three power domains:
  40. Domain 1: Switch-1, Consumers D & E.
  41. Domain 2: Switch-2, Consumers B & C.
  42. Domain 3: Consumer A.
  43. and this represents a "supplies" relationship:
  44. Domain-1 --> Domain-2 --> Domain-3.
  45. A power domain may have regulators that are supplied power
  46. by other regulators. i.e.
  47. Regulator-1 -+-> Regulator-2 -+-> [Consumer A]
  48. |
  49. +-> [Consumer B]
  50. This gives us two regulators and two power domains:
  51. Domain 1: Regulator-2, Consumer B.
  52. Domain 2: Consumer A.
  53. and a "supplies" relationship:
  54. Domain-1 --> Domain-2
  55. o Constraints - Constraints are used to define power levels for performance
  56. and hardware protection. Constraints exist at three levels:
  57. Regulator Level: This is defined by the regulator hardware
  58. operating parameters and is specified in the regulator
  59. datasheet. i.e.
  60. - voltage output is in the range 800mV -> 3500mV.
  61. - regulator current output limit is 20mA @ 5V but is
  62. 10mA @ 10V.
  63. Power Domain Level: This is defined in software by kernel
  64. level board initialisation code. It is used to constrain a
  65. power domain to a particular power range. i.e.
  66. - Domain-1 voltage is 3300mV
  67. - Domain-2 voltage is 1400mV -> 1600mV
  68. - Domain-3 current limit is 0mA -> 20mA.
  69. Consumer Level: This is defined by consumer drivers
  70. dynamically setting voltage or current limit levels.
  71. e.g. a consumer backlight driver asks for a current increase
  72. from 5mA to 10mA to increase LCD illumination. This passes
  73. to through the levels as follows :-
  74. Consumer: need to increase LCD brightness. Lookup and
  75. request next current mA value in brightness table (the
  76. consumer driver could be used on several different
  77. personalities based upon the same reference device).
  78. Power Domain: is the new current limit within the domain
  79. operating limits for this domain and system state (e.g.
  80. battery power, USB power)
  81. Regulator Domains: is the new current limit within the
  82. regulator operating parameters for input/output voltage.
  83. If the regulator request passes all the constraint tests
  84. then the new regulator value is applied.
  85. Design
  86. ======
  87. The framework is designed and targeted at SoC based devices but may also be
  88. relevant to non SoC devices and is split into the following four interfaces:-
  89. 1. Consumer driver interface.
  90. This uses a similar API to the kernel clock interface in that consumer
  91. drivers can get and put a regulator (like they can with clocks atm) and
  92. get/set voltage, current limit, mode, enable and disable. This should
  93. allow consumers complete control over their supply voltage and current
  94. limit. This also compiles out if not in use so drivers can be reused in
  95. systems with no regulator based power control.
  96. See Documentation/power/regulator/consumer.txt
  97. 2. Regulator driver interface.
  98. This allows regulator drivers to register their regulators and provide
  99. operations to the core. It also has a notifier call chain for propagating
  100. regulator events to clients.
  101. See Documentation/power/regulator/regulator.txt
  102. 3. Machine interface.
  103. This interface is for machine specific code and allows the creation of
  104. voltage/current domains (with constraints) for each regulator. It can
  105. provide regulator constraints that will prevent device damage through
  106. overvoltage or overcurrent caused by buggy client drivers. It also
  107. allows the creation of a regulator tree whereby some regulators are
  108. supplied by others (similar to a clock tree).
  109. See Documentation/power/regulator/machine.txt
  110. 4. Userspace ABI.
  111. The framework also exports a lot of useful voltage/current/opmode data to
  112. userspace via sysfs. This could be used to help monitor device power
  113. consumption and status.
  114. See Documentation/ABI/testing/sysfs-class-regulator