oaktrail.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /**************************************************************************
  2. * Copyright (c) 2007-2011, Intel Corporation.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  17. *
  18. **************************************************************************/
  19. /* MID device specific descriptors */
  20. struct oaktrail_timing_info {
  21. u16 pixel_clock;
  22. u8 hactive_lo;
  23. u8 hblank_lo;
  24. u8 hblank_hi:4;
  25. u8 hactive_hi:4;
  26. u8 vactive_lo;
  27. u8 vblank_lo;
  28. u8 vblank_hi:4;
  29. u8 vactive_hi:4;
  30. u8 hsync_offset_lo;
  31. u8 hsync_pulse_width_lo;
  32. u8 vsync_pulse_width_lo:4;
  33. u8 vsync_offset_lo:4;
  34. u8 vsync_pulse_width_hi:2;
  35. u8 vsync_offset_hi:2;
  36. u8 hsync_pulse_width_hi:2;
  37. u8 hsync_offset_hi:2;
  38. u8 width_mm_lo;
  39. u8 height_mm_lo;
  40. u8 height_mm_hi:4;
  41. u8 width_mm_hi:4;
  42. u8 hborder;
  43. u8 vborder;
  44. u8 unknown0:1;
  45. u8 hsync_positive:1;
  46. u8 vsync_positive:1;
  47. u8 separate_sync:2;
  48. u8 stereo:1;
  49. u8 unknown6:1;
  50. u8 interlaced:1;
  51. } __packed;
  52. struct gct_r10_timing_info {
  53. u16 pixel_clock;
  54. u32 hactive_lo:8;
  55. u32 hactive_hi:4;
  56. u32 hblank_lo:8;
  57. u32 hblank_hi:4;
  58. u32 hsync_offset_lo:8;
  59. u16 hsync_offset_hi:2;
  60. u16 hsync_pulse_width_lo:8;
  61. u16 hsync_pulse_width_hi:2;
  62. u16 hsync_positive:1;
  63. u16 rsvd_1:3;
  64. u8 vactive_lo:8;
  65. u16 vactive_hi:4;
  66. u16 vblank_lo:8;
  67. u16 vblank_hi:4;
  68. u16 vsync_offset_lo:4;
  69. u16 vsync_offset_hi:2;
  70. u16 vsync_pulse_width_lo:4;
  71. u16 vsync_pulse_width_hi:2;
  72. u16 vsync_positive:1;
  73. u16 rsvd_2:3;
  74. } __packed;
  75. struct oaktrail_panel_descriptor_v1 {
  76. u32 Panel_Port_Control; /* 1 dword, Register 0x61180 if LVDS */
  77. /* 0x61190 if MIPI */
  78. u32 Panel_Power_On_Sequencing;/*1 dword,Register 0x61208,*/
  79. u32 Panel_Power_Off_Sequencing;/*1 dword,Register 0x6120C,*/
  80. u32 Panel_Power_Cycle_Delay_and_Reference_Divisor;/* 1 dword */
  81. /* Register 0x61210 */
  82. struct oaktrail_timing_info DTD;/*18 bytes, Standard definition */
  83. u16 Panel_Backlight_Inverter_Descriptor;/* 16 bits, as follows */
  84. /* Bit 0, Frequency, 15 bits,0 - 32767Hz */
  85. /* Bit 15, Polarity, 1 bit, 0: Normal, 1: Inverted */
  86. u16 Panel_MIPI_Display_Descriptor;
  87. /*16 bits, Defined as follows: */
  88. /* if MIPI, 0x0000 if LVDS */
  89. /* Bit 0, Type, 2 bits, */
  90. /* 0: Type-1, */
  91. /* 1: Type-2, */
  92. /* 2: Type-3, */
  93. /* 3: Type-4 */
  94. /* Bit 2, Pixel Format, 4 bits */
  95. /* Bit0: 16bpp (not supported in LNC), */
  96. /* Bit1: 18bpp loosely packed, */
  97. /* Bit2: 18bpp packed, */
  98. /* Bit3: 24bpp */
  99. /* Bit 6, Reserved, 2 bits, 00b */
  100. /* Bit 8, Minimum Supported Frame Rate, 6 bits, 0 - 63Hz */
  101. /* Bit 14, Reserved, 2 bits, 00b */
  102. } __packed;
  103. struct oaktrail_panel_descriptor_v2 {
  104. u32 Panel_Port_Control; /* 1 dword, Register 0x61180 if LVDS */
  105. /* 0x61190 if MIPI */
  106. u32 Panel_Power_On_Sequencing;/*1 dword,Register 0x61208,*/
  107. u32 Panel_Power_Off_Sequencing;/*1 dword,Register 0x6120C,*/
  108. u8 Panel_Power_Cycle_Delay_and_Reference_Divisor;/* 1 byte */
  109. /* Register 0x61210 */
  110. struct oaktrail_timing_info DTD;/*18 bytes, Standard definition */
  111. u16 Panel_Backlight_Inverter_Descriptor;/*16 bits, as follows*/
  112. /*Bit 0, Frequency, 16 bits, 0 - 32767Hz*/
  113. u8 Panel_Initial_Brightness;/* [7:0] 0 - 100% */
  114. /*Bit 7, Polarity, 1 bit,0: Normal, 1: Inverted*/
  115. u16 Panel_MIPI_Display_Descriptor;
  116. /*16 bits, Defined as follows: */
  117. /* if MIPI, 0x0000 if LVDS */
  118. /* Bit 0, Type, 2 bits, */
  119. /* 0: Type-1, */
  120. /* 1: Type-2, */
  121. /* 2: Type-3, */
  122. /* 3: Type-4 */
  123. /* Bit 2, Pixel Format, 4 bits */
  124. /* Bit0: 16bpp (not supported in LNC), */
  125. /* Bit1: 18bpp loosely packed, */
  126. /* Bit2: 18bpp packed, */
  127. /* Bit3: 24bpp */
  128. /* Bit 6, Reserved, 2 bits, 00b */
  129. /* Bit 8, Minimum Supported Frame Rate, 6 bits, 0 - 63Hz */
  130. /* Bit 14, Reserved, 2 bits, 00b */
  131. } __packed;
  132. union oaktrail_panel_rx {
  133. struct {
  134. u16 NumberOfLanes:2; /*Num of Lanes, 2 bits,0 = 1 lane,*/
  135. /* 1 = 2 lanes, 2 = 3 lanes, 3 = 4 lanes. */
  136. u16 MaxLaneFreq:3; /* 0: 100MHz, 1: 200MHz, 2: 300MHz, */
  137. /*3: 400MHz, 4: 500MHz, 5: 600MHz, 6: 700MHz, 7: 800MHz.*/
  138. u16 SupportedVideoTransferMode:2; /*0: Non-burst only */
  139. /* 1: Burst and non-burst */
  140. /* 2/3: Reserved */
  141. u16 HSClkBehavior:1; /*0: Continuous, 1: Non-continuous*/
  142. u16 DuoDisplaySupport:1; /*1 bit,0: No, 1: Yes*/
  143. u16 ECC_ChecksumCapabilities:1;/*1 bit,0: No, 1: Yes*/
  144. u16 BidirectionalCommunication:1;/*1 bit,0: No, 1: Yes */
  145. u16 Rsvd:5;/*5 bits,00000b */
  146. } panelrx;
  147. u16 panel_receiver;
  148. } __packed;
  149. struct gct_r0 {
  150. union { /*8 bits,Defined as follows: */
  151. struct {
  152. u8 PanelType:4; /*4 bits, Bit field for panels*/
  153. /* 0 - 3: 0 = LVDS, 1 = MIPI*/
  154. /*2 bits,Specifies which of the*/
  155. u8 BootPanelIndex:2;
  156. /* 4 panels to use by default*/
  157. u8 BootMIPI_DSI_RxIndex:2;/*Specifies which of*/
  158. /* the 4 MIPI DSI receivers to use*/
  159. } PD;
  160. u8 PanelDescriptor;
  161. };
  162. struct oaktrail_panel_descriptor_v1 panel[4];/*panel descrs,38 bytes each*/
  163. union oaktrail_panel_rx panelrx[4]; /* panel receivers*/
  164. } __packed;
  165. struct gct_r1 {
  166. union { /*8 bits,Defined as follows: */
  167. struct {
  168. u8 PanelType:4; /*4 bits, Bit field for panels*/
  169. /* 0 - 3: 0 = LVDS, 1 = MIPI*/
  170. /*2 bits,Specifies which of the*/
  171. u8 BootPanelIndex:2;
  172. /* 4 panels to use by default*/
  173. u8 BootMIPI_DSI_RxIndex:2;/*Specifies which of*/
  174. /* the 4 MIPI DSI receivers to use*/
  175. } PD;
  176. u8 PanelDescriptor;
  177. };
  178. struct oaktrail_panel_descriptor_v2 panel[4];/*panel descrs,38 bytes each*/
  179. union oaktrail_panel_rx panelrx[4]; /* panel receivers*/
  180. } __packed;
  181. struct gct_r10 {
  182. struct gct_r10_timing_info DTD;
  183. u16 Panel_MIPI_Display_Descriptor;
  184. u16 Panel_MIPI_Receiver_Descriptor;
  185. u16 Panel_Backlight_Inverter_Descriptor;
  186. u8 Panel_Initial_Brightness;
  187. u32 MIPI_Ctlr_Init_ptr;
  188. u32 MIPI_Panel_Init_ptr;
  189. } __packed;
  190. struct oaktrail_gct_data {
  191. u8 bpi; /* boot panel index, number of panel used during boot */
  192. u8 pt; /* panel type, 4 bit field, 0=lvds, 1=mipi */
  193. struct oaktrail_timing_info DTD; /* timing info for the selected panel */
  194. u32 Panel_Port_Control;
  195. u32 PP_On_Sequencing;/*1 dword,Register 0x61208,*/
  196. u32 PP_Off_Sequencing;/*1 dword,Register 0x6120C,*/
  197. u32 PP_Cycle_Delay;
  198. u16 Panel_Backlight_Inverter_Descriptor;
  199. u16 Panel_MIPI_Display_Descriptor;
  200. } __packed;
  201. #define MODE_SETTING_IN_CRTC 0x1
  202. #define MODE_SETTING_IN_ENCODER 0x2
  203. #define MODE_SETTING_ON_GOING 0x3
  204. #define MODE_SETTING_IN_DSR 0x4
  205. #define MODE_SETTING_ENCODER_DONE 0x8
  206. /*
  207. * Moorestown HDMI interfaces
  208. */
  209. struct oaktrail_hdmi_dev {
  210. struct pci_dev *dev;
  211. void __iomem *regs;
  212. unsigned int mmio, mmio_len;
  213. int dpms_mode;
  214. struct hdmi_i2c_dev *i2c_dev;
  215. /* register state */
  216. u32 saveDPLL_CTRL;
  217. u32 saveDPLL_DIV_CTRL;
  218. u32 saveDPLL_ADJUST;
  219. u32 saveDPLL_UPDATE;
  220. u32 saveDPLL_CLK_ENABLE;
  221. u32 savePCH_HTOTAL_B;
  222. u32 savePCH_HBLANK_B;
  223. u32 savePCH_HSYNC_B;
  224. u32 savePCH_VTOTAL_B;
  225. u32 savePCH_VBLANK_B;
  226. u32 savePCH_VSYNC_B;
  227. u32 savePCH_PIPEBCONF;
  228. u32 savePCH_PIPEBSRC;
  229. };
  230. extern void oaktrail_hdmi_setup(struct drm_device *dev);
  231. extern void oaktrail_hdmi_teardown(struct drm_device *dev);
  232. extern int oaktrail_hdmi_i2c_init(struct pci_dev *dev);
  233. extern void oaktrail_hdmi_i2c_exit(struct pci_dev *dev);
  234. extern void oaktrail_hdmi_save(struct drm_device *dev);
  235. extern void oaktrail_hdmi_restore(struct drm_device *dev);
  236. extern void oaktrail_hdmi_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev);
  237. extern int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
  238. struct drm_display_mode *adjusted_mode, int x, int y,
  239. struct drm_framebuffer *old_fb);
  240. extern void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode);