adp8860.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Definitions and platform data for Analog Devices
  3. * Backlight drivers ADP8860
  4. *
  5. * Copyright 2009-2010 Analog Devices Inc.
  6. *
  7. * Licensed under the GPL-2 or later.
  8. */
  9. #ifndef __LINUX_I2C_ADP8860_H
  10. #define __LINUX_I2C_ADP8860_H
  11. #include <linux/leds.h>
  12. #include <linux/types.h>
  13. #define ID_ADP8860 8860
  14. #define ADP8860_MAX_BRIGHTNESS 0x7F
  15. #define FLAG_OFFT_SHIFT 8
  16. /*
  17. * LEDs subdevice platform data
  18. */
  19. #define ADP8860_LED_DIS_BLINK (0 << FLAG_OFFT_SHIFT)
  20. #define ADP8860_LED_OFFT_600ms (1 << FLAG_OFFT_SHIFT)
  21. #define ADP8860_LED_OFFT_1200ms (2 << FLAG_OFFT_SHIFT)
  22. #define ADP8860_LED_OFFT_1800ms (3 << FLAG_OFFT_SHIFT)
  23. #define ADP8860_LED_ONT_200ms 0
  24. #define ADP8860_LED_ONT_600ms 1
  25. #define ADP8860_LED_ONT_800ms 2
  26. #define ADP8860_LED_ONT_1200ms 3
  27. #define ADP8860_LED_D7 (7)
  28. #define ADP8860_LED_D6 (6)
  29. #define ADP8860_LED_D5 (5)
  30. #define ADP8860_LED_D4 (4)
  31. #define ADP8860_LED_D3 (3)
  32. #define ADP8860_LED_D2 (2)
  33. #define ADP8860_LED_D1 (1)
  34. /*
  35. * Backlight subdevice platform data
  36. */
  37. #define ADP8860_BL_D7 (1 << 6)
  38. #define ADP8860_BL_D6 (1 << 5)
  39. #define ADP8860_BL_D5 (1 << 4)
  40. #define ADP8860_BL_D4 (1 << 3)
  41. #define ADP8860_BL_D3 (1 << 2)
  42. #define ADP8860_BL_D2 (1 << 1)
  43. #define ADP8860_BL_D1 (1 << 0)
  44. #define ADP8860_FADE_T_DIS 0 /* Fade Timer Disabled */
  45. #define ADP8860_FADE_T_300ms 1 /* 0.3 Sec */
  46. #define ADP8860_FADE_T_600ms 2
  47. #define ADP8860_FADE_T_900ms 3
  48. #define ADP8860_FADE_T_1200ms 4
  49. #define ADP8860_FADE_T_1500ms 5
  50. #define ADP8860_FADE_T_1800ms 6
  51. #define ADP8860_FADE_T_2100ms 7
  52. #define ADP8860_FADE_T_2400ms 8
  53. #define ADP8860_FADE_T_2700ms 9
  54. #define ADP8860_FADE_T_3000ms 10
  55. #define ADP8860_FADE_T_3500ms 11
  56. #define ADP8860_FADE_T_4000ms 12
  57. #define ADP8860_FADE_T_4500ms 13
  58. #define ADP8860_FADE_T_5000ms 14
  59. #define ADP8860_FADE_T_5500ms 15 /* 5.5 Sec */
  60. #define ADP8860_FADE_LAW_LINEAR 0
  61. #define ADP8860_FADE_LAW_SQUARE 1
  62. #define ADP8860_FADE_LAW_CUBIC1 2
  63. #define ADP8860_FADE_LAW_CUBIC2 3
  64. #define ADP8860_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */
  65. #define ADP8860_BL_AMBL_FILT_160ms 1
  66. #define ADP8860_BL_AMBL_FILT_320ms 2
  67. #define ADP8860_BL_AMBL_FILT_640ms 3
  68. #define ADP8860_BL_AMBL_FILT_1280ms 4
  69. #define ADP8860_BL_AMBL_FILT_2560ms 5
  70. #define ADP8860_BL_AMBL_FILT_5120ms 6
  71. #define ADP8860_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */
  72. /*
  73. * Blacklight current 0..30mA
  74. */
  75. #define ADP8860_BL_CUR_mA(I) ((I * 127) / 30)
  76. /*
  77. * L2 comparator current 0..1106uA
  78. */
  79. #define ADP8860_L2_COMP_CURR_uA(I) ((I * 255) / 1106)
  80. /*
  81. * L3 comparator current 0..138uA
  82. */
  83. #define ADP8860_L3_COMP_CURR_uA(I) ((I * 255) / 138)
  84. struct adp8860_backlight_platform_data {
  85. u8 bl_led_assign; /* 1 = Backlight 0 = Individual LED */
  86. u8 bl_fade_in; /* Backlight Fade-In Timer */
  87. u8 bl_fade_out; /* Backlight Fade-Out Timer */
  88. u8 bl_fade_law; /* fade-on/fade-off transfer characteristic */
  89. u8 en_ambl_sens; /* 1 = enable ambient light sensor */
  90. u8 abml_filt; /* Light sensor filter time */
  91. u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  92. u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  93. u8 l2_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  94. u8 l2_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  95. u8 l3_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
  96. u8 l3_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
  97. u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
  98. u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
  99. u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
  100. u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
  101. /**
  102. * Independent Current Sinks / LEDS
  103. * Sinks not assigned to the Backlight can be exposed to
  104. * user space using the LEDS CLASS interface
  105. */
  106. int num_leds;
  107. struct led_info *leds;
  108. u8 led_fade_in; /* LED Fade-In Timer */
  109. u8 led_fade_out; /* LED Fade-Out Timer */
  110. u8 led_fade_law; /* fade-on/fade-off transfer characteristic */
  111. u8 led_on_time;
  112. /**
  113. * Gain down disable. Setting this option does not allow the
  114. * charge pump to switch to lower gains. NOT AVAILABLE on ADP8860
  115. * 1 = the charge pump doesn't switch down in gain until all LEDs are 0.
  116. * The charge pump switches up in gain as needed. This feature is
  117. * useful if the ADP8863 charge pump is used to drive an external load.
  118. * This feature must be used when utilizing small fly capacitors
  119. * (0402 or smaller).
  120. * 0 = the charge pump automatically switches up and down in gain.
  121. * This provides optimal efficiency, but is not suitable for driving
  122. * loads that are not connected through the ADP8863 diode drivers.
  123. * Additionally, the charge pump fly capacitors should be low ESR
  124. * and sized 0603 or greater.
  125. */
  126. u8 gdwn_dis;
  127. };
  128. #endif /* __LINUX_I2C_ADP8860_H */