leds-lp5523.rst 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. ========================
  2. Kernel driver for lp5523
  3. ========================
  4. * National Semiconductor LP5523 led driver chip
  5. * Datasheet: http://www.national.com/pf/LP/LP5523.html
  6. Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo
  7. Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)
  8. Description
  9. -----------
  10. LP5523 can drive up to 9 channels. Leds can be controlled directly via
  11. the led class control interface.
  12. The name of each channel is configurable in the platform data - name and label.
  13. There are three options to make the channel name.
  14. a) Define the 'name' in the platform data
  15. To make specific channel name, then use 'name' platform data.
  16. - /sys/class/leds/R1 (name: 'R1')
  17. - /sys/class/leds/B1 (name: 'B1')
  18. b) Use the 'label' with no 'name' field
  19. For one device name with channel number, then use 'label'.
  20. - /sys/class/leds/RGB:channelN (label: 'RGB', N: 0 ~ 8)
  21. c) Default
  22. If both fields are NULL, 'lp5523' is used by default.
  23. - /sys/class/leds/lp5523:channelN (N: 0 ~ 8)
  24. LP5523 has the internal program memory for running various LED patterns.
  25. There are two ways to run LED patterns.
  26. 1) Legacy interface - enginex_mode, enginex_load and enginex_leds
  27. Control interface for the engines:
  28. x is 1 .. 3
  29. enginex_mode:
  30. disabled, load, run
  31. enginex_load:
  32. microcode load
  33. enginex_leds:
  34. led mux control
  35. ::
  36. cd /sys/class/leds/lp5523:channel2/device
  37. echo "load" > engine3_mode
  38. echo "9d80400004ff05ff437f0000" > engine3_load
  39. echo "111111111" > engine3_leds
  40. echo "run" > engine3_mode
  41. To stop the engine::
  42. echo "disabled" > engine3_mode
  43. 2) Firmware interface - LP55xx common interface
  44. For the details, please refer to 'firmware' section in leds-lp55xx.txt
  45. LP5523 has three master faders. If a channel is mapped to one of
  46. the master faders, its output is dimmed based on the value of the master
  47. fader.
  48. For example::
  49. echo "123000123" > master_fader_leds
  50. creates the following channel-fader mappings::
  51. channel 0,6 to master_fader1
  52. channel 1,7 to master_fader2
  53. channel 2,8 to master_fader3
  54. Then, to have 25% of the original output on channel 0,6::
  55. echo 64 > master_fader1
  56. To have 0% of the original output (i.e. no output) channel 1,7::
  57. echo 0 > master_fader2
  58. To have 100% of the original output (i.e. no dimming) on channel 2,8::
  59. echo 255 > master_fader3
  60. To clear all master fader controls::
  61. echo "000000000" > master_fader_leds
  62. Selftest uses always the current from the platform data.
  63. Each channel contains led current settings.
  64. - /sys/class/leds/lp5523:channel2/led_current - RW
  65. - /sys/class/leds/lp5523:channel2/max_current - RO
  66. Format: 10x mA i.e 10 means 1.0 mA
  67. Example platform data::
  68. static struct lp55xx_led_config lp5523_led_config[] = {
  69. {
  70. .name = "D1",
  71. .chan_nr = 0,
  72. .led_current = 50,
  73. .max_current = 130,
  74. },
  75. ...
  76. {
  77. .chan_nr = 8,
  78. .led_current = 50,
  79. .max_current = 130,
  80. }
  81. };
  82. static int lp5523_setup(void)
  83. {
  84. /* Setup HW resources */
  85. }
  86. static void lp5523_release(void)
  87. {
  88. /* Release HW resources */
  89. }
  90. static void lp5523_enable(bool state)
  91. {
  92. /* Control chip enable signal */
  93. }
  94. static struct lp55xx_platform_data lp5523_platform_data = {
  95. .led_config = lp5523_led_config,
  96. .num_channels = ARRAY_SIZE(lp5523_led_config),
  97. .clock_mode = LP55XX_CLOCK_EXT,
  98. .setup_resources = lp5523_setup,
  99. .release_resources = lp5523_release,
  100. .enable = lp5523_enable,
  101. };
  102. Note
  103. chan_nr can have values between 0 and 8.