video-pxafb.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * Support for the xscale frame buffer.
  3. *
  4. * Author: Jean-Frederic Clere
  5. * Created: Sep 22, 2003
  6. * Copyright: jfclere@sinix.net
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/fb.h>
  13. #include <mach/regs-lcd.h>
  14. /*
  15. * Supported LCD connections
  16. *
  17. * bits 0 - 3: for LCD panel type:
  18. *
  19. * STN - for passive matrix
  20. * DSTN - for dual scan passive matrix
  21. * TFT - for active matrix
  22. *
  23. * bits 4 - 9 : for bus width
  24. * bits 10-17 : for AC Bias Pin Frequency
  25. * bit 18 : for output enable polarity
  26. * bit 19 : for pixel clock edge
  27. * bit 20 : for output pixel format when base is RGBT16
  28. */
  29. #define LCD_CONN_TYPE(_x) ((_x) & 0x0f)
  30. #define LCD_CONN_WIDTH(_x) (((_x) >> 4) & 0x1f)
  31. #define LCD_TYPE_MASK 0xf
  32. #define LCD_TYPE_UNKNOWN 0
  33. #define LCD_TYPE_MONO_STN 1
  34. #define LCD_TYPE_MONO_DSTN 2
  35. #define LCD_TYPE_COLOR_STN 3
  36. #define LCD_TYPE_COLOR_DSTN 4
  37. #define LCD_TYPE_COLOR_TFT 5
  38. #define LCD_TYPE_SMART_PANEL 6
  39. #define LCD_TYPE_MAX 7
  40. #define LCD_MONO_STN_4BPP ((4 << 4) | LCD_TYPE_MONO_STN)
  41. #define LCD_MONO_STN_8BPP ((8 << 4) | LCD_TYPE_MONO_STN)
  42. #define LCD_MONO_DSTN_8BPP ((8 << 4) | LCD_TYPE_MONO_DSTN)
  43. #define LCD_COLOR_STN_8BPP ((8 << 4) | LCD_TYPE_COLOR_STN)
  44. #define LCD_COLOR_DSTN_16BPP ((16 << 4) | LCD_TYPE_COLOR_DSTN)
  45. #define LCD_COLOR_TFT_8BPP ((8 << 4) | LCD_TYPE_COLOR_TFT)
  46. #define LCD_COLOR_TFT_16BPP ((16 << 4) | LCD_TYPE_COLOR_TFT)
  47. #define LCD_COLOR_TFT_18BPP ((18 << 4) | LCD_TYPE_COLOR_TFT)
  48. #define LCD_SMART_PANEL_8BPP ((8 << 4) | LCD_TYPE_SMART_PANEL)
  49. #define LCD_SMART_PANEL_16BPP ((16 << 4) | LCD_TYPE_SMART_PANEL)
  50. #define LCD_SMART_PANEL_18BPP ((18 << 4) | LCD_TYPE_SMART_PANEL)
  51. #define LCD_AC_BIAS_FREQ(x) (((x) & 0xff) << 10)
  52. #define LCD_BIAS_ACTIVE_HIGH (0 << 18)
  53. #define LCD_BIAS_ACTIVE_LOW (1 << 18)
  54. #define LCD_PCLK_EDGE_RISE (0 << 19)
  55. #define LCD_PCLK_EDGE_FALL (1 << 19)
  56. #define LCD_ALTERNATE_MAPPING (1 << 20)
  57. /*
  58. * This structure describes the machine which we are running on.
  59. * It is set in linux/arch/arm/mach-pxa/machine_name.c and used in the probe routine
  60. * of linux/drivers/video/pxafb.c
  61. */
  62. struct pxafb_mode_info {
  63. u_long pixclock;
  64. u_short xres;
  65. u_short yres;
  66. u_char bpp;
  67. u_int cmap_greyscale:1,
  68. depth:8,
  69. transparency:1,
  70. unused:22;
  71. /* Parallel Mode Timing */
  72. u_char hsync_len;
  73. u_char left_margin;
  74. u_char right_margin;
  75. u_char vsync_len;
  76. u_char upper_margin;
  77. u_char lower_margin;
  78. u_char sync;
  79. /* Smart Panel Mode Timing - see PXA27x DM 7.4.15.0.3 for details
  80. * Note:
  81. * 1. all parameters in nanosecond (ns)
  82. * 2. a0cs{rd,wr}_set_hld are controlled by the same register bits
  83. * in pxa27x and pxa3xx, initialize them to the same value or
  84. * the larger one will be used
  85. * 3. same to {rd,wr}_pulse_width
  86. *
  87. * 4. LCD_PCLK_EDGE_{RISE,FALL} controls the L_PCLK_WR polarity
  88. * 5. sync & FB_SYNC_HOR_HIGH_ACT controls the L_LCLK_A0
  89. * 6. sync & FB_SYNC_VERT_HIGH_ACT controls the L_LCLK_RD
  90. */
  91. unsigned a0csrd_set_hld; /* A0 and CS Setup/Hold Time before/after L_FCLK_RD */
  92. unsigned a0cswr_set_hld; /* A0 and CS Setup/Hold Time before/after L_PCLK_WR */
  93. unsigned wr_pulse_width; /* L_PCLK_WR pulse width */
  94. unsigned rd_pulse_width; /* L_FCLK_RD pulse width */
  95. unsigned cmd_inh_time; /* Command Inhibit time between two writes */
  96. unsigned op_hold_time; /* Output Hold time from L_FCLK_RD negation */
  97. };
  98. struct pxafb_mach_info {
  99. struct pxafb_mode_info *modes;
  100. unsigned int num_modes;
  101. unsigned int lcd_conn;
  102. unsigned long video_mem_size;
  103. u_int fixed_modes:1,
  104. cmap_inverse:1,
  105. cmap_static:1,
  106. acceleration_enabled:1,
  107. unused:28;
  108. /* The following should be defined in LCCR0
  109. * LCCR0_Act or LCCR0_Pas Active or Passive
  110. * LCCR0_Sngl or LCCR0_Dual Single/Dual panel
  111. * LCCR0_Mono or LCCR0_Color Mono/Color
  112. * LCCR0_4PixMono or LCCR0_8PixMono (in mono single mode)
  113. * LCCR0_DMADel(Tcpu) (optional) DMA request delay
  114. *
  115. * The following should not be defined in LCCR0:
  116. * LCCR0_OUM, LCCR0_BM, LCCR0_QDM, LCCR0_DIS, LCCR0_EFM
  117. * LCCR0_IUM, LCCR0_SFM, LCCR0_LDM, LCCR0_ENB
  118. */
  119. u_int lccr0;
  120. /* The following should be defined in LCCR3
  121. * LCCR3_OutEnH or LCCR3_OutEnL Output enable polarity
  122. * LCCR3_PixRsEdg or LCCR3_PixFlEdg Pixel clock edge type
  123. * LCCR3_Acb(X) AB Bias pin frequency
  124. * LCCR3_DPC (optional) Double Pixel Clock mode (untested)
  125. *
  126. * The following should not be defined in LCCR3
  127. * LCCR3_HSP, LCCR3_VSP, LCCR0_Pcd(x), LCCR3_Bpp
  128. */
  129. u_int lccr3;
  130. /* The following should be defined in LCCR4
  131. * LCCR4_PAL_FOR_0 or LCCR4_PAL_FOR_1 or LCCR4_PAL_FOR_2
  132. *
  133. * All other bits in LCCR4 should be left alone.
  134. */
  135. u_int lccr4;
  136. void (*pxafb_backlight_power)(int);
  137. void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
  138. void (*smart_update)(struct fb_info *);
  139. };
  140. void pxa_set_fb_info(struct device *, struct pxafb_mach_info *);
  141. unsigned long pxafb_get_hsync_time(struct device *dev);
  142. #ifdef CONFIG_FB_PXA_SMARTPANEL
  143. extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int);
  144. extern int pxafb_smart_flush(struct fb_info *info);
  145. #else
  146. static inline int pxafb_smart_queue(struct fb_info *info,
  147. uint16_t *cmds, int n)
  148. {
  149. return 0;
  150. }
  151. static inline int pxafb_smart_flush(struct fb_info *info)
  152. {
  153. return 0;
  154. }
  155. #endif