lcd-panel.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. /* lcd-panel.h
  2. written by Marc Singer
  3. 18 Jul 2005
  4. Copyright (C) 2005 Marc Singer
  5. -----------
  6. DESCRIPTION
  7. -----------
  8. Only one panel may be defined at a time.
  9. The pixel clock is calculated to be no greater than the target.
  10. Each timing value is accompanied by a specification comment.
  11. UNITS/MIN/TYP/MAX
  12. Most of the units will be in clocks.
  13. USE_RGB555
  14. Define this macro to configure the AMBA LCD controller to use an
  15. RGB555 encoding for the pels instead of the normal RGB565.
  16. LPD9520, LPD79524, LPD7A400, LPD7A404-10, LPD7A404-11
  17. These boards are best approximated by 555 for all panels. Some
  18. can use an extra low-order bit of blue in bit 16 of the color
  19. value, but we don't have a way to communicate this non-linear
  20. mapping to the kernel.
  21. */
  22. #if !defined (__LCD_PANEL_H__)
  23. # define __LCD_PANEL_H__
  24. #if defined (MACH_LPD79520)\
  25. || defined (MACH_LPD79524)\
  26. || defined (MACH_LPD7A400)\
  27. || defined (MACH_LPD7A404)
  28. # define USE_RGB555
  29. #endif
  30. struct clcd_panel_extra {
  31. unsigned int hrmode;
  32. unsigned int clsen;
  33. unsigned int spsen;
  34. unsigned int pcdel;
  35. unsigned int revdel;
  36. unsigned int lpdel;
  37. unsigned int spldel;
  38. unsigned int pc2del;
  39. };
  40. #define NS_TO_CLOCK(ns,c) ((((ns)*((c)/1000) + (1000000 - 1))/1000000))
  41. #define CLOCK_TO_DIV(e,c) (((c) + (e) - 1)/(e))
  42. #if defined CONFIG_FB_ARMCLCD_SHARP_LQ035Q7DB02_HRTFT
  43. /* Logic Product Development LCD 3.5" QVGA HRTFT -10 */
  44. /* Sharp PN LQ035Q7DB02 w/HRTFT controller chip */
  45. #define PIX_CLOCK_TARGET (6800000)
  46. #define PIX_CLOCK_DIVIDER CLOCK_TO_DIV (PIX_CLOCK_TARGET, HCLK)
  47. #define PIX_CLOCK (HCLK/PIX_CLOCK_DIVIDER)
  48. static struct clcd_panel lcd_panel = {
  49. .mode = {
  50. .name = "3.5in QVGA (LQ035Q7DB02)",
  51. .xres = 240,
  52. .yres = 320,
  53. .pixclock = PIX_CLOCK,
  54. .left_margin = 16,
  55. .right_margin = 21,
  56. .upper_margin = 8, // line/8/8/8
  57. .lower_margin = 5,
  58. .hsync_len = 61,
  59. .vsync_len = NS_TO_CLOCK (60, PIX_CLOCK),
  60. .vmode = FB_VMODE_NONINTERLACED,
  61. },
  62. .width = -1,
  63. .height = -1,
  64. .tim2 = TIM2_IPC | (PIX_CLOCK_DIVIDER - 2),
  65. .cntl = CNTL_LCDTFT | CNTL_WATERMARK,
  66. .bpp = 16,
  67. };
  68. #define HAS_LCD_PANEL_EXTRA
  69. static struct clcd_panel_extra lcd_panel_extra = {
  70. .hrmode = 1,
  71. .clsen = 1,
  72. .spsen = 1,
  73. .pcdel = 8,
  74. .revdel = 7,
  75. .lpdel = 13,
  76. .spldel = 77,
  77. .pc2del = 208,
  78. };
  79. #endif
  80. #if defined CONFIG_FB_ARMCLCD_SHARP_LQ057Q3DC02
  81. /* Logic Product Development LCD 5.7" QVGA -10 */
  82. /* Sharp PN LQ057Q3DC02 */
  83. /* QVGA mode, V/Q=LOW */
  84. /* From Sharp on 2006.1.3. I believe some of the values are incorrect
  85. * based on the datasheet.
  86. Timing0 TIMING1 TIMING2 CONTROL
  87. 0x140A0C4C 0x080504EF 0x013F380D 0x00000829
  88. HBP= 20 VBP= 8 BCD= 0
  89. HFP= 10 VFP= 5 CPL=319
  90. HSW= 12 VSW= 1 IOE= 0
  91. PPL= 19 LPP=239 IPC= 1
  92. IHS= 1
  93. IVS= 1
  94. ACB= 0
  95. CSEL= 0
  96. PCD= 13
  97. */
  98. /* The full horizontal cycle (Th) is clock/360/400/450. */
  99. /* The full vertical cycle (Tv) is line/251/262/280. */
  100. #define PIX_CLOCK_TARGET (6300000) /* -/6.3/7 MHz */
  101. #define PIX_CLOCK_DIVIDER CLOCK_TO_DIV (PIX_CLOCK_TARGET, HCLK)
  102. #define PIX_CLOCK (HCLK/PIX_CLOCK_DIVIDER)
  103. static struct clcd_panel lcd_panel = {
  104. .mode = {
  105. .name = "5.7in QVGA (LQ057Q3DC02)",
  106. .xres = 320,
  107. .yres = 240,
  108. .pixclock = PIX_CLOCK,
  109. .left_margin = 11,
  110. .right_margin = 400-11-320-2,
  111. .upper_margin = 7, // line/7/7/7
  112. .lower_margin = 262-7-240-2,
  113. .hsync_len = 2, // clk/2/96/200
  114. .vsync_len = 2, // line/2/-/34
  115. .vmode = FB_VMODE_NONINTERLACED,
  116. },
  117. .width = -1,
  118. .height = -1,
  119. .tim2 = TIM2_IHS | TIM2_IVS
  120. | (PIX_CLOCK_DIVIDER - 2),
  121. .cntl = CNTL_LCDTFT | CNTL_WATERMARK,
  122. .bpp = 16,
  123. };
  124. #endif
  125. #if defined CONFIG_FB_ARMCLCD_SHARP_LQ64D343
  126. /* Logic Product Development LCD 6.4" VGA -10 */
  127. /* Sharp PN LQ64D343 */
  128. /* The full horizontal cycle (Th) is clock/750/800/900. */
  129. /* The full vertical cycle (Tv) is line/515/525/560. */
  130. #define PIX_CLOCK_TARGET (28330000)
  131. #define PIX_CLOCK_DIVIDER CLOCK_TO_DIV (PIX_CLOCK_TARGET, HCLK)
  132. #define PIX_CLOCK (HCLK/PIX_CLOCK_DIVIDER)
  133. static struct clcd_panel lcd_panel = {
  134. .mode = {
  135. .name = "6.4in QVGA (LQ64D343)",
  136. .xres = 640,
  137. .yres = 480,
  138. .pixclock = PIX_CLOCK,
  139. .left_margin = 32,
  140. .right_margin = 800-32-640-96,
  141. .upper_margin = 32, // line/34/34/34
  142. .lower_margin = 540-32-480-2,
  143. .hsync_len = 96, // clk/2/96/200
  144. .vsync_len = 2, // line/2/-/34
  145. .vmode = FB_VMODE_NONINTERLACED,
  146. },
  147. .width = -1,
  148. .height = -1,
  149. .tim2 = TIM2_IHS | TIM2_IVS
  150. | (PIX_CLOCK_DIVIDER - 2),
  151. .cntl = CNTL_LCDTFT | CNTL_WATERMARK,
  152. .bpp = 16,
  153. };
  154. #endif
  155. #if defined CONFIG_FB_ARMCLCD_SHARP_LQ10D368
  156. /* Logic Product Development LCD 10.4" VGA -10 */
  157. /* Sharp PN LQ10D368 */
  158. #define PIX_CLOCK_TARGET (28330000)
  159. #define PIX_CLOCK_DIVIDER CLOCK_TO_DIV (PIX_CLOCK_TARGET, HCLK)
  160. #define PIX_CLOCK (HCLK/PIX_CLOCK_DIVIDER)
  161. static struct clcd_panel lcd_panel = {
  162. .mode = {
  163. .name = "10.4in VGA (LQ10D368)",
  164. .xres = 640,
  165. .yres = 480,
  166. .pixclock = PIX_CLOCK,
  167. .left_margin = 21,
  168. .right_margin = 15,
  169. .upper_margin = 34,
  170. .lower_margin = 5,
  171. .hsync_len = 96,
  172. .vsync_len = 16,
  173. .vmode = FB_VMODE_NONINTERLACED,
  174. },
  175. .width = -1,
  176. .height = -1,
  177. .tim2 = TIM2_IHS | TIM2_IVS
  178. | (PIX_CLOCK_DIVIDER - 2),
  179. .cntl = CNTL_LCDTFT | CNTL_WATERMARK,
  180. .bpp = 16,
  181. };
  182. #endif
  183. #if defined CONFIG_FB_ARMCLCD_SHARP_LQ121S1DG41
  184. /* Logic Product Development LCD 12.1" SVGA -10 */
  185. /* Sharp PN LQ121S1DG41, was LQ121S1DG31 */
  186. /* Note that with a 99993900 Hz HCLK, it is not possible to hit the
  187. * target clock frequency range of 35MHz to 42MHz. */
  188. /* If the target pixel clock is substantially lower than the panel
  189. * spec, this is done to prevent the LCD display from glitching when
  190. * the CPU is under load. A pixel clock higher than 25MHz
  191. * (empirically determined) will compete with the CPU for bus cycles
  192. * for the Ethernet chip. However, even a pixel clock of 10MHz
  193. * competes with Compact Flash interface during some operations
  194. * (fdisk, e2fsck). And, at that speed the display may have a visible
  195. * flicker. */
  196. /* The full horizontal cycle (Th) is clock/832/1056/1395. */
  197. #define PIX_CLOCK_TARGET (20000000)
  198. #define PIX_CLOCK_DIVIDER CLOCK_TO_DIV (PIX_CLOCK_TARGET, HCLK)
  199. #define PIX_CLOCK (HCLK/PIX_CLOCK_DIVIDER)
  200. static struct clcd_panel lcd_panel = {
  201. .mode = {
  202. .name = "12.1in SVGA (LQ121S1DG41)",
  203. .xres = 800,
  204. .yres = 600,
  205. .pixclock = PIX_CLOCK,
  206. .left_margin = 89, // ns/5/-/(1/PIX_CLOCK)-10
  207. .right_margin = 1056-800-89-128,
  208. .upper_margin = 23, // line/23/23/23
  209. .lower_margin = 44,
  210. .hsync_len = 128, // clk/2/128/200
  211. .vsync_len = 4, // line/2/4/6
  212. .vmode = FB_VMODE_NONINTERLACED,
  213. },
  214. .width = -1,
  215. .height = -1,
  216. .tim2 = TIM2_IHS | TIM2_IVS
  217. | (PIX_CLOCK_DIVIDER - 2),
  218. .cntl = CNTL_LCDTFT | CNTL_WATERMARK,
  219. .bpp = 16,
  220. };
  221. #endif
  222. #if defined CONFIG_FB_ARMCLCD_HITACHI
  223. /* Hitachi*/
  224. /* Submitted by Michele Da Rold <michele.darold@ecsproject.com> */
  225. #define PIX_CLOCK_TARGET (49000000)
  226. #define PIX_CLOCK_DIVIDER CLOCK_TO_DIV (PIX_CLOCK_TARGET, HCLK)
  227. #define PIX_CLOCK (HCLK/PIX_CLOCK_DIVIDER)
  228. static struct clcd_panel lcd_panel = {
  229. .mode = {
  230. .name = "Hitachi 800x480",
  231. .xres = 800,
  232. .yres = 480,
  233. .pixclock = PIX_CLOCK,
  234. .left_margin = 88,
  235. .right_margin = 40,
  236. .upper_margin = 32,
  237. .lower_margin = 11,
  238. .hsync_len = 128,
  239. .vsync_len = 2,
  240. .vmode = FB_VMODE_NONINTERLACED,
  241. },
  242. .width = -1,
  243. .height = -1,
  244. .tim2 = TIM2_IPC | TIM2_IHS | TIM2_IVS
  245. | (PIX_CLOCK_DIVIDER - 2),
  246. .cntl = CNTL_LCDTFT | CNTL_WATERMARK,
  247. .bpp = 16,
  248. };
  249. #endif
  250. #if defined CONFIG_FB_ARMCLCD_AUO_A070VW01_WIDE
  251. /* AU Optotronics A070VW01 7.0 Wide Screen color Display*/
  252. /* Submitted by Michele Da Rold <michele.darold@ecsproject.com> */
  253. #define PIX_CLOCK_TARGET (10000000)
  254. #define PIX_CLOCK_DIVIDER CLOCK_TO_DIV (PIX_CLOCK_TARGET, HCLK)
  255. #define PIX_CLOCK (HCLK/PIX_CLOCK_DIVIDER)
  256. static struct clcd_panel lcd_panel = {
  257. .mode = {
  258. .name = "7.0in Wide (A070VW01)",
  259. .xres = 480,
  260. .yres = 234,
  261. .pixclock = PIX_CLOCK,
  262. .left_margin = 30,
  263. .right_margin = 25,
  264. .upper_margin = 14,
  265. .lower_margin = 12,
  266. .hsync_len = 100,
  267. .vsync_len = 1,
  268. .vmode = FB_VMODE_NONINTERLACED,
  269. },
  270. .width = -1,
  271. .height = -1,
  272. .tim2 = TIM2_IPC | TIM2_IHS | TIM2_IVS
  273. | (PIX_CLOCK_DIVIDER - 2),
  274. .cntl = CNTL_LCDTFT | CNTL_WATERMARK,
  275. .bpp = 16,
  276. };
  277. #endif
  278. #undef NS_TO_CLOCK
  279. #undef CLOCK_TO_DIV
  280. #endif /* __LCD_PANEL_H__ */