leds-qpnp.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. Qualcomm QPNP Leds
  2. QPNP (Qualcomm Plug N Play) LEDs driver is used for
  3. controlling LEDs that are part of PMIC on Qualcomm reference
  4. platforms. The PMIC is connected to Host processor via
  5. SPMI bus. This driver supports various LED modules such as
  6. Keypad backlight, WLED (white LED), RGB LED and flash LED.
  7. Each LED module is represented as a node of "leds-qpnp". This
  8. node will further contain the type of LED supported and its
  9. properties. At least one child node is required for each LED
  10. module. Each must have the required properties below, in addition
  11. to the properties for the LED type, WLED, Flash, RGB and MPP.
  12. Required properties for each child node, WLED, Flash and RGB:
  13. - compatible : should be "qcom,leds-qpnp"
  14. - qcom,id : must be one of values supported in enum qpnp_led
  15. - label : type of led that will be used, ie "wled"
  16. - qcom,max-current : maximum current that the LED can sustain in mA
  17. - linux,name : name of the led that is used in led framework
  18. Optional properties for each child node, WLED, Flash, MPP, RGB and KPDBL:
  19. - qcom,in-order-command-processing : specify if user space requests leds in order
  20. WLED is primarily used as display backlight. Display subsystem uses
  21. LED triggers for WLED to control the brightness as needed.
  22. Optional properties for WLED:
  23. - qcom,num-strings: number of wled strings supported
  24. - qcom,ovp-val: over voltage protection threshold,
  25. follows enum wled_ovp_threshold
  26. - qcom,boost-curr-lim: boot currnet limit, follows enum wled_current_bost_limit
  27. - qcom,ctrl-delay-us: delay in activation of led
  28. - qcom,dig-mod-gen-en: digital module generator
  29. - qcom,cs-out-en: current sink output enable
  30. - qcom,op-fdbck: selection of output as feedback for the boost, 00 = automatic selection, 01 = select LED1 output, 02 = select LED2 output, 03 = select LED3 output
  31. - qcom,cp-select: high pole capacitance
  32. - linux,default-trigger: trigger the led from external modules such as display
  33. - qcom,default-state: default state of the led, should be "on" or "off"
  34. Flash is used primarily as a camera or video flash.
  35. Optional properties for flash:
  36. - qcom,headroom: headroom to use. Values should be 0, 1, 2, 3 for 250mV, 300mV, 400mV and 500mV
  37. - qcom,duration: duration of the flash and torch, 10ms - 1280ms for flash and 2s - 33s for torch
  38. - qcom,clamp-curr: current to clamp at, mA
  39. - qcom,startup-dly: delay before flashing after flash executed. Values should 0, 1, 2, 3 for 10us, 32us, 64us, and 128us
  40. - qcom,saftey-timer: include for safety timer use, otherwise watchdog timer will be used
  41. - linux,default-trigger: trigger the led from external modules such as display
  42. - qcom,default-state: default state of the led, should be "on" or "off"
  43. - qcom,torch-enable: set flash led to torch mode functionality and triggers software workaround for torch if hardware does not support
  44. - flash-boost-supply: SMBB regulator for LED flash mode
  45. - torch-boost-supply: SMBB regulator for LED torch mode
  46. - flash-wa-supply: SMBB regulator for flash workarounds.
  47. RGB Led is a tri-colored led, Red, Blue & Green.
  48. Required properties for RGB led:
  49. - qcom,mode: mode the led should operate in, options "pwm" and "lpg". "manual" mode is not supported for RGB led.
  50. Required properties for PWM mode only:
  51. - qcom,pwm-channel: pwm channel the led will operate on
  52. - qcom,pwm-us: time the pwm device will modulate at (us)
  53. Required properties for LPG mode only:
  54. - qcom,pwm-channel: pwm channel the led will operate on
  55. - qcom,pwm-us: time the pwm device will modulate at (us)
  56. - qcom,duty-pcts: array of values for duty cycle to go through
  57. - qcom,start-idx: starting point duty-pcts array
  58. Optional properties for LPG mode only:
  59. - qcom,pause-lo: pause at low end of cycle
  60. - qcom,pause-hi: pause at high end of cycle
  61. - qcom,ramp-step-ms: step between each cycle (ms)
  62. - qcom,lut-flags: flags to be used in lut configuration
  63. Optional properties for RGB led:
  64. - linux,default-trigger: trigger the led from external modules such as display
  65. - qcom,default-state: default state of the led, should be "on" or "off"
  66. - qcom,turn-off-delay-ms: delay in millisecond for turning off the led when its default-state is "on". Value is being ignored in case default-state is "off".
  67. - qcom,use-blink: Use blink sysfs entry for switching into lpg mode. For optimal use, set default mode to pwm. All required lpg parameters must be supplied.
  68. MPP LED is an LED controled through a Multi Purpose Pin.
  69. Optional properties for MPP LED:
  70. - linux,default-trigger: trigger the led from external modules such as display
  71. - qcom,default-state: default state of the led, should be "on" or "off"
  72. - qcom,source-sel: select power source, default 1 (enabled)
  73. - qcom,mode-ctrl: select operation mode, default 0x60 = Mode Sink
  74. - qcom,mode: mode the led should operate in, options "pwm", "lpg" and "manual"
  75. - qcom,vin-ctrl: select input source, supported values are 0 to 3
  76. - qcom,use-blink: Use blink sysfs entry for switching into lpg mode. For optimal use, set default mode to pwm. All required lpg parameters must be supplied.
  77. - qcom,min-brightness - Lowest possible brightness supported on this LED other than 0.
  78. - qcom,current-setting: default current value for wled used as button backlight in mA
  79. Required properties for PWM mode only:
  80. - qcom,pwm-channel: pwm channel the led will operate on
  81. - qcom,pwm-us: time the pwm device will modulate at (us)
  82. Required properties for LPG mode only:
  83. - qcom,pwm-channel: pwm channel the led will operate on
  84. - qcom,pwm-us: time the pwm device will modulate at (us)
  85. - qcom,duty-pcts: array of values for duty cycle to go through
  86. - qcom,start-idx: starting point duty-pcts array
  87. Optional properties for LPG mode only:
  88. - qcom,pause-lo: pause at low end of cycle
  89. - qcom,pause-hi: pause at high end of cycle
  90. - qcom,ramp-step-ms: step between each cycle (ms)
  91. - qcom,lut-flags: flags to be used in lut configuration
  92. Keypad backlight is a backlight source for buttons. It supports four rows
  93. and the required rows are enabled by specifying values in the properties.
  94. Required properties for keypad backlight:
  95. - qcom,mode: mode the led should operate in, options "pwm" and "lpg". "manual" mode is not supported for keypad backlight.
  96. - qcom,row-id: specify the id of the row. Supported values are 0 to 3.
  97. Optional properties for keypad backlight:
  98. - qcom,row-src-vbst: select source for rows. Specify for vbst and ignore it
  99. for vph_pwr.
  100. - qcom,row-src-en: specify to enable row source
  101. - qcom,always-on: specify if the module has to be always on
  102. - qcom,use-blink: Use blink sysfs entry for switching into lpg mode. For optimal use, set default mode to pwm. All required lpg parameters must be supplied.
  103. Required properties for PWM mode only:
  104. - qcom,pwm-channel: pwm channel the led will operate on
  105. - qcom,pwm-us: time the pwm device will modulate at (us)
  106. Required properties for LPG mode only:
  107. - qcom,pwm-channel: pwm channel the led will operate on
  108. - qcom,pwm-us: time the pwm device will modulate at (us)
  109. - qcom,duty-pcts: array of values for duty cycle to go through
  110. - qcom,start-idx: starting point duty-pcts array
  111. Optional properties for LPG mode only:
  112. - qcom,pause-lo: pause at low end of cycle
  113. - qcom,pause-hi: pause at high end of cycle
  114. - qcom,ramp-step-ms: step between each cycle (ms)
  115. - qcom,lut-flags: flags to be used in lut configuration
  116. Example:
  117. qcom,leds@a100 {
  118. status = "okay";
  119. qcom,led_mpp_2 {
  120. label = "mpp";
  121. linux,name = "button-backlight";
  122. linux,default-trigger = "hr-trigger";
  123. qcom,default-state = "off";
  124. qcom,current-setting = <20>;
  125. qcom,max-current = <40>;
  126. qcom,id = <6>;
  127. qcom,source-sel = <1>;
  128. qcom,mode-ctrl = <0x61>;
  129. qcom,mode = "manual";
  130. };
  131. };
  132. qcom,leds@a200 {
  133. status = "okay";
  134. qcom,led_mpp_3 {
  135. label = "mpp";
  136. linux,name = "wled-backlight";
  137. linux-default-trigger = "none";
  138. qcom,default-state = "on";
  139. qcom,max-current = <40>;
  140. qcom,id = <6>;
  141. qcom,source-sel = <1>;
  142. qcom,mode-ctrl = <0x10>;
  143. qcom,vin-ctrl = <0x03>;
  144. qcom,min-brightness = <20>;
  145. };
  146. };
  147. qcom,leds@a300 {
  148. status = "okay";
  149. qcom,led_mpp_pwm {
  150. label = "mpp";
  151. linux,name = "green";
  152. linux,default-trigger = "none";
  153. qcom,default-state = "off";
  154. qcom,max-current = <40>;
  155. qcom,current-setting = <5>;
  156. qcom,id = <6>;
  157. qcom,mode = "pwm";
  158. qcom,source-sel = <8>;
  159. qcom,mode-ctrl = <0x60>;
  160. qcom,pwm-channel = <0>;
  161. qcom,pwm-us = <1000>;
  162. };
  163. };
  164. qcom,leds@d000 {
  165. status = "okay";
  166. qcom,rgb_pwm {
  167. label = "rgb";
  168. linux,name = "led:rgb_red";
  169. qcom,mode = "pwm";
  170. qcom,pwm-us = <1000>;
  171. qcom,pwm-channel = <6>;
  172. qcom,max-current = <12>;
  173. qcom,default-state = "off";
  174. qcom,id = <3>;
  175. linux,default-trigger =
  176. "battery-charging";
  177. };
  178. qcom,rgb_lpg {
  179. label = "rgb";
  180. linux,name = "led:rgb_green";
  181. qcom,mode = "lpg";
  182. qcom,pwm-channel = <5>;
  183. qcom,pwm-us = <1000>;
  184. qcom,duty-ms = <20>;
  185. qcom,start-idx = <1>;
  186. qcom,idx-len = <10>;
  187. qcom,duty-pcts = [00 19 32 4B 64
  188. 64 4B 32 19 00];
  189. qcom,max-current = <12>;
  190. qcom,default-state = "off";
  191. qcom,id = <3>;
  192. linux,default-trigger =
  193. "battery-charging";
  194. };
  195. qcom,rgb_blink {
  196. label = "rgb";
  197. linux,name = "led:rgb_blue";
  198. qcom,mode = "pwm";
  199. qcom,pwm-channel = <4>;
  200. qcom,start-idx = <1>;
  201. qcom,idx-len = <10>;
  202. qcom,duty-pcts = [00 19 32 4B 64
  203. 64 4B 32 19 00];
  204. qcom,lut-flags = <3>;
  205. qcom,pause-lo = <0>;
  206. qcom,pause-hi = <0>;
  207. qcom,ramp-step-ms = <255>;
  208. qcom,max-current = <12>;
  209. qcom,default-state = "on";
  210. qcom,turn-off-delay-ms = <500>;
  211. qcom,id = <5>;
  212. linux,default-trigger = "none";
  213. qcom,pwm-us = <1000>;
  214. qcom,use-blink;
  215. };
  216. };
  217. qcom,leds@d300 {
  218. compatible = "qcom,leds-qpnp";
  219. status = "okay";
  220. flash-boost-supply = <&pm8941_chg_boost>;
  221. torch-boost-supply = <&pm8941_boost>;
  222. qcom,flash_0 {
  223. qcom,max-current = <1000>;
  224. qcom,default-state = "off";
  225. qcom,headroom = <0>;
  226. qcom,duration = <200>;
  227. qcom,clamp-curr = <200>;
  228. qcom,startup-dly = <1>;
  229. qcom,safety-timer;
  230. label = "flash";
  231. linux,default-trigger =
  232. "flash0_trigger";
  233. linux,name = "led:flash_0";
  234. qcom,current = <625>;
  235. qcom,id = <1>;
  236. qcom,no-torch-module;
  237. };
  238. };
  239. qcom,leds@d800 {
  240. compatible = "qcom,leds-qpnp";
  241. status = "okay";
  242. qcom,wled_0 {
  243. linux,default-trigger = "bkl-trigger"
  244. label = "wled";
  245. qcom,cs-out-en;
  246. qcom,op-fdbck = <1>;
  247. qcom,default-state "off";
  248. qcom,max-current = <25>;
  249. qcom,ctrl-delay-us = <0>;
  250. qcom,boost-curr-lim = <3>;
  251. qcom,cp-sel = <0>;
  252. qcom,switch-freq = <2>;
  253. qcom,ovp-val = <2>;
  254. qcom,num-strings = <1>;
  255. qcom,id = <0>;
  256. linux,name = "led:wled_backlight";
  257. };
  258. };
  259. qcom,leds@e200 {
  260. status = "okay";
  261. qcom,kpdbl1 {
  262. label = "kpdbl";
  263. linux,name = "kpdbl-pwm-1";
  264. qcom,mode = <0>;
  265. qcom,pwm-channel = <8>;
  266. qcom,pwm-us = <1000>;
  267. qcom,id = <7>;
  268. qcom,max-current = <20>;
  269. qcom,row-id = <0>;
  270. qcom,row-src-en;
  271. qcom,always-on;
  272. };
  273. qcom,kpdbl2 {
  274. label = "kpdbl";
  275. linux,name = "kpdbl-lut-2";
  276. qcom,mode = <1>;
  277. qcom,pwm-channel = <9>;
  278. qcom,pwm-us = <1000>;
  279. qcom,start-idx = <1>;
  280. qcom,duty-pcts = [00 00 00 00 64
  281. 64 00 00 00 00];
  282. qcom,id = <7>;
  283. qcom,max-current = <20>;
  284. qcom,row-id = <1>;
  285. qcom,row-src-en;
  286. };
  287. };