leds-lp55xx.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * LP55XX Platform Data Header
  4. *
  5. * Copyright (C) 2012 Texas Instruments
  6. *
  7. * Author: Milo(Woogyom) Kim <[email protected]>
  8. *
  9. * Derived from leds-lp5521.h, leds-lp5523.h
  10. */
  11. #ifndef _LEDS_LP55XX_H
  12. #define _LEDS_LP55XX_H
  13. #include <linux/gpio/consumer.h>
  14. #include <linux/led-class-multicolor.h>
  15. /* Clock configuration */
  16. #define LP55XX_CLOCK_AUTO 0
  17. #define LP55XX_CLOCK_INT 1
  18. #define LP55XX_CLOCK_EXT 2
  19. #define LP55XX_MAX_GROUPED_CHAN 4
  20. struct lp55xx_led_config {
  21. const char *name;
  22. const char *default_trigger;
  23. u8 chan_nr;
  24. u8 led_current; /* mA x10, 0 if led is not connected */
  25. u8 max_current;
  26. int num_colors;
  27. unsigned int max_channel;
  28. int color_id[LED_COLOR_ID_MAX];
  29. int output_num[LED_COLOR_ID_MAX];
  30. };
  31. struct lp55xx_predef_pattern {
  32. const u8 *r;
  33. const u8 *g;
  34. const u8 *b;
  35. u8 size_r;
  36. u8 size_g;
  37. u8 size_b;
  38. };
  39. enum lp8501_pwr_sel {
  40. LP8501_ALL_VDD, /* D1~9 are connected to VDD */
  41. LP8501_6VDD_3VOUT, /* D1~6 with VDD, D7~9 with VOUT */
  42. LP8501_3VDD_6VOUT, /* D1~6 with VOUT, D7~9 with VDD */
  43. LP8501_ALL_VOUT, /* D1~9 are connected to VOUT */
  44. };
  45. /*
  46. * struct lp55xx_platform_data
  47. * @led_config : Configurable led class device
  48. * @num_channels : Number of LED channels
  49. * @label : Used for naming LEDs
  50. * @clock_mode : Input clock mode. LP55XX_CLOCK_AUTO or _INT or _EXT
  51. * @setup_resources : Platform specific function before enabling the chip
  52. * @release_resources : Platform specific function after disabling the chip
  53. * @enable_gpiod : enable GPIO descriptor
  54. * @patterns : Predefined pattern data for RGB channels
  55. * @num_patterns : Number of patterns
  56. * @update_config : Value of CONFIG register
  57. */
  58. struct lp55xx_platform_data {
  59. /* LED channel configuration */
  60. struct lp55xx_led_config *led_config;
  61. u8 num_channels;
  62. const char *label;
  63. /* Clock configuration */
  64. u8 clock_mode;
  65. /* optional enable GPIO */
  66. struct gpio_desc *enable_gpiod;
  67. /* Predefined pattern data */
  68. struct lp55xx_predef_pattern *patterns;
  69. unsigned int num_patterns;
  70. /* LP8501 specific */
  71. enum lp8501_pwr_sel pwr_sel;
  72. };
  73. #endif /* _LEDS_LP55XX_H */