leds-lp5523.txt 2.8 KB

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