smart_mtp_ea8061v.h 5.5 KB

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