leds-lp55xx.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * LP55XX Platform Data Header
  3. *
  4. * Copyright (C) 2012 Texas Instruments
  5. *
  6. * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * Derived from leds-lp5521.h, leds-lp5523.h
  13. */
  14. #ifndef _LEDS_LP55XX_H
  15. #define _LEDS_LP55XX_H
  16. /* Clock configuration */
  17. #define LP55XX_CLOCK_AUTO 0
  18. #define LP55XX_CLOCK_INT 1
  19. #define LP55XX_CLOCK_EXT 2
  20. /* Bits in LP5521 CONFIG register. 'update_config' in lp55xx_platform_data */
  21. #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
  22. #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
  23. #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
  24. #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
  25. #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
  26. #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
  27. #define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
  28. #define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
  29. #define LP5521_CLK_INT 1 /* Internal clock */
  30. #define LP5521_CLK_AUTO 2 /* Automatic clock selection */
  31. /* Bits in LP5562 CONFIG register */
  32. #define LP5562_PWM_HF LP5521_PWM_HF
  33. #define LP5562_PWRSAVE_EN LP5521_PWRSAVE_EN
  34. #define LP5562_CLK_SRC_EXT LP5521_CLK_SRC_EXT
  35. #define LP5562_CLK_INT LP5521_CLK_INT
  36. #define LP5562_CLK_AUTO LP5521_CLK_AUTO
  37. struct lp55xx_led_config {
  38. const char *name;
  39. u8 chan_nr;
  40. u8 led_current; /* mA x10, 0 if led is not connected */
  41. u8 max_current;
  42. };
  43. struct lp55xx_predef_pattern {
  44. const u8 *r;
  45. const u8 *g;
  46. const u8 *b;
  47. u8 size_r;
  48. u8 size_g;
  49. u8 size_b;
  50. };
  51. /*
  52. * struct lp55xx_platform_data
  53. * @led_config : Configurable led class device
  54. * @num_channels : Number of LED channels
  55. * @label : Used for naming LEDs
  56. * @clock_mode : Input clock mode. LP55XX_CLOCK_AUTO or _INT or _EXT
  57. * @setup_resources : Platform specific function before enabling the chip
  58. * @release_resources : Platform specific function after disabling the chip
  59. * @enable : EN pin control by platform side
  60. * @patterns : Predefined pattern data for RGB channels
  61. * @num_patterns : Number of patterns
  62. * @update_config : Value of CONFIG register
  63. */
  64. struct lp55xx_platform_data {
  65. /* LED channel configuration */
  66. struct lp55xx_led_config *led_config;
  67. u8 num_channels;
  68. const char *label;
  69. /* Clock configuration */
  70. u8 clock_mode;
  71. /* Platform specific functions */
  72. int (*setup_resources)(void);
  73. void (*release_resources)(void);
  74. void (*enable)(bool state);
  75. /* Predefined pattern data */
  76. struct lp55xx_predef_pattern *patterns;
  77. unsigned int num_patterns;
  78. /* _CONFIG register */
  79. u8 update_config;
  80. };
  81. #endif /* _LEDS_LP55XX_H */