ili9320.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /* include/video/ili9320.c
  2. *
  3. * ILI9320 LCD controller configuration control.
  4. *
  5. * Copyright 2007 Simtec Electronics
  6. * Ben Dooks <ben@simtec.co.uk>
  7. *
  8. * http://armlinux.simtec.co.uk/
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #define ILI9320_REG(x) (x)
  15. #define ILI9320_INDEX ILI9320_REG(0x00)
  16. #define ILI9320_OSCILATION ILI9320_REG(0x00)
  17. #define ILI9320_DRIVER ILI9320_REG(0x01)
  18. #define ILI9320_DRIVEWAVE ILI9320_REG(0x02)
  19. #define ILI9320_ENTRYMODE ILI9320_REG(0x03)
  20. #define ILI9320_RESIZING ILI9320_REG(0x04)
  21. #define ILI9320_DISPLAY1 ILI9320_REG(0x07)
  22. #define ILI9320_DISPLAY2 ILI9320_REG(0x08)
  23. #define ILI9320_DISPLAY3 ILI9320_REG(0x09)
  24. #define ILI9320_DISPLAY4 ILI9320_REG(0x0A)
  25. #define ILI9320_RGB_IF1 ILI9320_REG(0x0C)
  26. #define ILI9320_FRAMEMAKER ILI9320_REG(0x0D)
  27. #define ILI9320_RGB_IF2 ILI9320_REG(0x0F)
  28. #define ILI9320_POWER1 ILI9320_REG(0x10)
  29. #define ILI9320_POWER2 ILI9320_REG(0x11)
  30. #define ILI9320_POWER3 ILI9320_REG(0x12)
  31. #define ILI9320_POWER4 ILI9320_REG(0x13)
  32. #define ILI9320_GRAM_HORIZ_ADDR ILI9320_REG(0x20)
  33. #define ILI9320_GRAM_VERT_ADD ILI9320_REG(0x21)
  34. #define ILI9320_POWER7 ILI9320_REG(0x29)
  35. #define ILI9320_FRAME_RATE_COLOUR ILI9320_REG(0x2B)
  36. #define ILI9320_GAMMA1 ILI9320_REG(0x30)
  37. #define ILI9320_GAMMA2 ILI9320_REG(0x31)
  38. #define ILI9320_GAMMA3 ILI9320_REG(0x32)
  39. #define ILI9320_GAMMA4 ILI9320_REG(0x35)
  40. #define ILI9320_GAMMA5 ILI9320_REG(0x36)
  41. #define ILI9320_GAMMA6 ILI9320_REG(0x37)
  42. #define ILI9320_GAMMA7 ILI9320_REG(0x38)
  43. #define ILI9320_GAMMA8 ILI9320_REG(0x39)
  44. #define ILI9320_GAMMA9 ILI9320_REG(0x3C)
  45. #define ILI9320_GAMMA10 ILI9320_REG(0x3D)
  46. #define ILI9320_HORIZ_START ILI9320_REG(0x50)
  47. #define ILI9320_HORIZ_END ILI9320_REG(0x51)
  48. #define ILI9320_VERT_START ILI9320_REG(0x52)
  49. #define ILI9320_VERT_END ILI9320_REG(0x53)
  50. #define ILI9320_DRIVER2 ILI9320_REG(0x60)
  51. #define ILI9320_BASE_IMAGE ILI9320_REG(0x61)
  52. #define ILI9320_VERT_SCROLL ILI9320_REG(0x6a)
  53. #define ILI9320_PARTIAL1_POSITION ILI9320_REG(0x80)
  54. #define ILI9320_PARTIAL1_START ILI9320_REG(0x81)
  55. #define ILI9320_PARTIAL1_END ILI9320_REG(0x82)
  56. #define ILI9320_PARTIAL2_POSITION ILI9320_REG(0x83)
  57. #define ILI9320_PARTIAL2_START ILI9320_REG(0x84)
  58. #define ILI9320_PARTIAL2_END ILI9320_REG(0x85)
  59. #define ILI9320_INTERFACE1 ILI9320_REG(0x90)
  60. #define ILI9320_INTERFACE2 ILI9320_REG(0x92)
  61. #define ILI9320_INTERFACE3 ILI9320_REG(0x93)
  62. #define ILI9320_INTERFACE4 ILI9320_REG(0x95)
  63. #define ILI9320_INTERFACE5 ILI9320_REG(0x97)
  64. #define ILI9320_INTERFACE6 ILI9320_REG(0x98)
  65. /* Register contents definitions. */
  66. #define ILI9320_OSCILATION_OSC (1 << 0)
  67. #define ILI9320_DRIVER_SS (1 << 8)
  68. #define ILI9320_DRIVER_SM (1 << 10)
  69. #define ILI9320_DRIVEWAVE_EOR (1 << 8)
  70. #define ILI9320_DRIVEWAVE_BC (1 << 9)
  71. #define ILI9320_DRIVEWAVE_MUSTSET (1 << 10)
  72. #define ILI9320_ENTRYMODE_AM (1 << 3)
  73. #define ILI9320_ENTRYMODE_ID(x) ((x) << 4)
  74. #define ILI9320_ENTRYMODE_ORG (1 << 7)
  75. #define ILI9320_ENTRYMODE_HWM (1 << 8)
  76. #define ILI9320_ENTRYMODE_BGR (1 << 12)
  77. #define ILI9320_ENTRYMODE_DFM (1 << 14)
  78. #define ILI9320_ENTRYMODE_TRI (1 << 15)
  79. #define ILI9320_RESIZING_RSZ(x) ((x) << 0)
  80. #define ILI9320_RESIZING_RCH(x) ((x) << 4)
  81. #define ILI9320_RESIZING_RCV(x) ((x) << 8)
  82. #define ILI9320_DISPLAY1_D(x) ((x) << 0)
  83. #define ILI9320_DISPLAY1_CL (1 << 3)
  84. #define ILI9320_DISPLAY1_DTE (1 << 4)
  85. #define ILI9320_DISPLAY1_GON (1 << 5)
  86. #define ILI9320_DISPLAY1_BASEE (1 << 8)
  87. #define ILI9320_DISPLAY1_PTDE(x) ((x) << 12)
  88. #define ILI9320_DISPLAY2_BP(x) ((x) << 0)
  89. #define ILI9320_DISPLAY2_FP(x) ((x) << 8)
  90. #define ILI9320_RGBIF1_RIM_RGB18 (0 << 0)
  91. #define ILI9320_RGBIF1_RIM_RGB16 (1 << 0)
  92. #define ILI9320_RGBIF1_RIM_RGB6 (2 << 0)
  93. #define ILI9320_RGBIF1_CLK_INT (0 << 4)
  94. #define ILI9320_RGBIF1_CLK_RGBIF (1 << 4)
  95. #define ILI9320_RGBIF1_CLK_VSYNC (2 << 4)
  96. #define ILI9320_RGBIF1_RM (1 << 8)
  97. #define ILI9320_RGBIF1_ENC_FRAMES(x) (((x) - 1)<< 13)
  98. #define ILI9320_RGBIF2_DPL (1 << 0)
  99. #define ILI9320_RGBIF2_EPL (1 << 1)
  100. #define ILI9320_RGBIF2_HSPL (1 << 3)
  101. #define ILI9320_RGBIF2_VSPL (1 << 4)
  102. #define ILI9320_POWER1_SLP (1 << 1)
  103. #define ILI9320_POWER1_DSTB (1 << 2)
  104. #define ILI9320_POWER1_AP(x) ((x) << 4)
  105. #define ILI9320_POWER1_APE (1 << 7)
  106. #define ILI9320_POWER1_BT(x) ((x) << 8)
  107. #define ILI9320_POWER1_SAP (1 << 12)
  108. #define ILI9320_POWER2_VC(x) ((x) << 0)
  109. #define ILI9320_POWER2_DC0(x) ((x) << 4)
  110. #define ILI9320_POWER2_DC1(x) ((x) << 8)
  111. #define ILI9320_POWER3_VRH(x) ((x) << 0)
  112. #define ILI9320_POWER3_PON (1 << 4)
  113. #define ILI9320_POWER3_VCMR (1 << 8)
  114. #define ILI9320_POWER4_VREOUT(x) ((x) << 8)
  115. #define ILI9320_DRIVER2_SCNL(x) ((x) << 0)
  116. #define ILI9320_DRIVER2_NL(x) ((x) << 8)
  117. #define ILI9320_DRIVER2_GS (1 << 15)
  118. #define ILI9320_BASEIMAGE_REV (1 << 0)
  119. #define ILI9320_BASEIMAGE_VLE (1 << 1)
  120. #define ILI9320_BASEIMAGE_NDL (1 << 2)
  121. #define ILI9320_INTERFACE4_RTNE(x) (x)
  122. #define ILI9320_INTERFACE4_DIVE(x) ((x) << 8)
  123. /* SPI interface definitions */
  124. #define ILI9320_SPI_IDCODE (0x70)
  125. #define ILI9320_SPI_ID(x) ((x) << 2)
  126. #define ILI9320_SPI_READ (0x01)
  127. #define ILI9320_SPI_WRITE (0x00)
  128. #define ILI9320_SPI_DATA (0x02)
  129. #define ILI9320_SPI_INDEX (0x00)
  130. /* platform data to pass configuration from lcd */
  131. enum ili9320_suspend {
  132. ILI9320_SUSPEND_OFF,
  133. ILI9320_SUSPEND_DEEP,
  134. };
  135. struct ili9320_platdata {
  136. unsigned short hsize;
  137. unsigned short vsize;
  138. enum ili9320_suspend suspend;
  139. /* set the reset line, 0 = reset asserted, 1 = normal */
  140. void (*reset)(unsigned int val);
  141. unsigned short entry_mode;
  142. unsigned short display2;
  143. unsigned short display3;
  144. unsigned short display4;
  145. unsigned short rgb_if1;
  146. unsigned short rgb_if2;
  147. unsigned short interface2;
  148. unsigned short interface3;
  149. unsigned short interface4;
  150. unsigned short interface5;
  151. unsigned short interface6;
  152. };