smart_mtp_se6e3fa.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. * =================================================================
  3. *
  4. * Filename: smart_mtp_se6e8fa.h
  5. *
  6. * Description: Smart dimming algorithm implementation
  7. *
  8. * Author: jb09.kim
  9. * Company: Samsung Electronics
  10. *
  11. * ================================================================
  12. */
  13. /*
  14. <one line to give the program's name and a brief idea of what it does.>
  15. Copyright (C) 2012, Samsung Electronics. All rights reserved.
  16. *
  17. * This program is free software; you can redistribute it and/or modify
  18. * it under the terms of the GNU General Public License version 2 and
  19. * only version 2 as published by the Free Software Foundation.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  29. * 02110-1301, USA.
  30. *
  31. */
  32. #ifndef _SMART_MTP_SE6E3FA_H_
  33. #define _SMART_MTP_SE6E3FA_H_
  34. #include <linux/module.h>
  35. #include <linux/kernel.h>
  36. #include <linux/errno.h>
  37. #include <linux/mutex.h>
  38. #include <linux/wait.h>
  39. #include <linux/ctype.h>
  40. #include <asm/div64.h>
  41. /* octa ldi id3 */
  42. #define EVT0_ID 0x00
  43. #define EVT0_SECOND_ID 0x01
  44. #define EVT1_ID 0x21
  45. #define EVT1_SECOND_ID 0x22
  46. #define EVT1_H_REV_I 0x23
  47. #define EVT1_H_REV_J 0x24
  48. /* youm ldi id3 */
  49. #define EVT0_F_REV_A 0x10
  50. #define EVT0_F_REV_E 0x11
  51. #define EVT0_F_REV_F 0x12
  52. #define EVT2_F_REV_G 0x32
  53. /*
  54. * From 4.8 inch model use AID function
  55. * CASE#1 is used for now.
  56. */
  57. #define AID_OPERATION
  58. #define GAMMA_CURVE_2P25 1
  59. #define GAMMA_CURVE_2P2 2
  60. #define GAMMA_CURVE_2P15 3
  61. #define GAMMA_CURVE_2P1 4
  62. #define GAMMA_CURVE_2P0 5
  63. #define GAMMA_CURVE_1P9 6
  64. #define MTP_START_ADDR 0xC8
  65. #define LUMINANCE_MAX 62
  66. #define GAMMA_SET_MAX 33
  67. #define BIT_SHIFT 22
  68. /*
  69. it means BIT_SHIFT is 22. pow(2,BIT_SHIFT) is 4194304.
  70. BIT_SHIFT is used for right bit shfit
  71. */
  72. #define BIT_SHFIT_MUL 4194304
  73. #define S6E3FA_GRAY_SCALE_MAX 256
  74. /*6.3*4194304 */
  75. #define S6E3FA_VREG0_REF 26424115
  76. /*V0,V3,V11,V23,V35,V51,V87,V151,V203,V255*/
  77. #define S6E3FA_MAX 11
  78. /* PANEL DEPENDENT THINGS */
  79. #define MAX_CANDELA 300
  80. #define MIN_CANDELA 5
  81. /*
  82. * ID 0x20
  83. */
  84. #define V255_300CD_R_MSB_20 0x01
  85. #define V255_300CD_R_LSB_20 0x00
  86. #define V255_300CD_G_MSB_20 0x01
  87. #define V255_300CD_G_LSB_20 0x00
  88. #define V255_300CD_B_MSB_20 0x01
  89. #define V255_300CD_B_LSB_20 0x00
  90. #define V203_300CD_R_20 0x80
  91. #define V203_300CD_G_20 0x80
  92. #define V203_300CD_B_20 0x80
  93. #define V151_300CD_R_20 0x80
  94. #define V151_300CD_G_20 0x80
  95. #define V151_300CD_B_20 0x80
  96. #define V87_300CD_R_20 0x80
  97. #define V87_300CD_G_20 0x80
  98. #define V87_300CD_B_20 0x80
  99. #define V51_300CD_R_20 0x80
  100. #define V51_300CD_G_20 0x80
  101. #define V51_300CD_B_20 0x80
  102. #define V35_300CD_R_20 0x80
  103. #define V35_300CD_G_20 0x80
  104. #define V35_300CD_B_20 0x80
  105. #define V23_300CD_R_20 0x80
  106. #define V23_300CD_G_20 0x80
  107. #define V23_300CD_B_20 0x80
  108. #define V11_300CD_R_20 0x80
  109. #define V11_300CD_G_20 0x80
  110. #define V11_300CD_B_20 0x80
  111. #define V3_300CD_R_20 0x80
  112. #define V3_300CD_G_20 0x80
  113. #define V3_300CD_B_20 0x80
  114. #define VT_300CD_R_20 0x00
  115. #define VT_300CD_G_20 0x00
  116. #define VT_300CD_B_20 0x00
  117. /* PANEL DEPENDENT THINGS END*/
  118. enum {
  119. V1_INDEX = 0,
  120. V3_INDEX = 1,
  121. V11_INDEX = 2,
  122. V23_INDEX = 3,
  123. V35_INDEX = 4,
  124. V51_INDEX = 5,
  125. V87_INDEX = 6,
  126. V151_INDEX = 7,
  127. V203_INDEX = 8,
  128. V255_INDEX = 9,
  129. };
  130. struct GAMMA_LEVEL {
  131. int level_0;
  132. int level_1;
  133. int level_3;
  134. int level_11;
  135. int level_23;
  136. int level_35;
  137. int level_51;
  138. int level_87;
  139. int level_151;
  140. int level_203;
  141. int level_255;
  142. } __packed;
  143. struct RGB_OUTPUT_VOLTARE {
  144. struct GAMMA_LEVEL R_VOLTAGE;
  145. struct GAMMA_LEVEL G_VOLTAGE;
  146. struct GAMMA_LEVEL B_VOLTAGE;
  147. } __packed;
  148. struct GRAY_VOLTAGE {
  149. /*
  150. This voltage value use 14bit right shit
  151. it means voltage is divied by 16384.
  152. */
  153. int R_Gray;
  154. int G_Gray;
  155. int B_Gray;
  156. } __packed;
  157. struct GRAY_SCALE {
  158. struct GRAY_VOLTAGE TABLE[S6E3FA_GRAY_SCALE_MAX];
  159. struct GRAY_VOLTAGE VT_TABLE;
  160. } __packed;
  161. /*V0,V1,V3,V11,V23,V35,V51,V87,V151,V203,V255*/
  162. struct MTP_SET {
  163. char OFFSET_255_MSB;
  164. char OFFSET_255_LSB;
  165. char OFFSET_203;
  166. char OFFSET_151;
  167. char OFFSET_87;
  168. char OFFSET_51;
  169. char OFFSET_35;
  170. char OFFSET_23;
  171. char OFFSET_11;
  172. char OFFSET_3;
  173. char OFFSET_1;
  174. } __packed;
  175. #ifdef CONFIG_HBM_PSRE
  176. struct MTP_OFFSET_400CD {
  177. struct MTP_SET R_OFFSET;
  178. struct MTP_SET G_OFFSET;
  179. struct MTP_SET B_OFFSET;
  180. char mtp_400cd[6]; /*gamma for 400cd*/
  181. char elvss_400cd; /*elvss for 400cd*/
  182. } __packed;
  183. #endif
  184. struct MTP_OFFSET {
  185. struct MTP_SET R_OFFSET;
  186. struct MTP_SET G_OFFSET;
  187. struct MTP_SET B_OFFSET;
  188. } __packed;
  189. struct illuminance_table {
  190. int lux;
  191. char gamma_setting[GAMMA_SET_MAX];
  192. } __packed;
  193. struct SMART_DIM {
  194. #ifdef CONFIG_HBM_PSRE
  195. struct MTP_OFFSET_400CD MTP_ORIGN;
  196. #else
  197. struct MTP_OFFSET MTP_ORIGN;
  198. #endif
  199. struct MTP_OFFSET MTP;
  200. struct RGB_OUTPUT_VOLTARE RGB_OUTPUT;
  201. struct GRAY_SCALE GRAY;
  202. /* Because of AID funtion, below members are added*/
  203. int lux_table_max;
  204. int *plux_table;
  205. struct illuminance_table gen_table[LUMINANCE_MAX];
  206. int brightness_level;
  207. int ldi_revision;
  208. } __packed;
  209. #endif