psb_intel_reg.h 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319
  1. /*
  2. * Copyright (c) 2009, Intel Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  16. */
  17. #ifndef __PSB_INTEL_REG_H__
  18. #define __PSB_INTEL_REG_H__
  19. /*
  20. * GPIO regs
  21. */
  22. #define GPIOA 0x5010
  23. #define GPIOB 0x5014
  24. #define GPIOC 0x5018
  25. #define GPIOD 0x501c
  26. #define GPIOE 0x5020
  27. #define GPIOF 0x5024
  28. #define GPIOG 0x5028
  29. #define GPIOH 0x502c
  30. # define GPIO_CLOCK_DIR_MASK (1 << 0)
  31. # define GPIO_CLOCK_DIR_IN (0 << 1)
  32. # define GPIO_CLOCK_DIR_OUT (1 << 1)
  33. # define GPIO_CLOCK_VAL_MASK (1 << 2)
  34. # define GPIO_CLOCK_VAL_OUT (1 << 3)
  35. # define GPIO_CLOCK_VAL_IN (1 << 4)
  36. # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
  37. # define GPIO_DATA_DIR_MASK (1 << 8)
  38. # define GPIO_DATA_DIR_IN (0 << 9)
  39. # define GPIO_DATA_DIR_OUT (1 << 9)
  40. # define GPIO_DATA_VAL_MASK (1 << 10)
  41. # define GPIO_DATA_VAL_OUT (1 << 11)
  42. # define GPIO_DATA_VAL_IN (1 << 12)
  43. # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
  44. #define GMBUS0 0x5100 /* clock/port select */
  45. #define GMBUS_RATE_100KHZ (0<<8)
  46. #define GMBUS_RATE_50KHZ (1<<8)
  47. #define GMBUS_RATE_400KHZ (2<<8) /* reserved on Pineview */
  48. #define GMBUS_RATE_1MHZ (3<<8) /* reserved on Pineview */
  49. #define GMBUS_HOLD_EXT (1<<7) /* 300ns hold time, rsvd on Pineview */
  50. #define GMBUS_PORT_DISABLED 0
  51. #define GMBUS_PORT_SSC 1
  52. #define GMBUS_PORT_VGADDC 2
  53. #define GMBUS_PORT_PANEL 3
  54. #define GMBUS_PORT_DPC 4 /* HDMIC */
  55. #define GMBUS_PORT_DPB 5 /* SDVO, HDMIB */
  56. /* 6 reserved */
  57. #define GMBUS_PORT_DPD 7 /* HDMID */
  58. #define GMBUS_NUM_PORTS 8
  59. #define GMBUS1 0x5104 /* command/status */
  60. #define GMBUS_SW_CLR_INT (1<<31)
  61. #define GMBUS_SW_RDY (1<<30)
  62. #define GMBUS_ENT (1<<29) /* enable timeout */
  63. #define GMBUS_CYCLE_NONE (0<<25)
  64. #define GMBUS_CYCLE_WAIT (1<<25)
  65. #define GMBUS_CYCLE_INDEX (2<<25)
  66. #define GMBUS_CYCLE_STOP (4<<25)
  67. #define GMBUS_BYTE_COUNT_SHIFT 16
  68. #define GMBUS_SLAVE_INDEX_SHIFT 8
  69. #define GMBUS_SLAVE_ADDR_SHIFT 1
  70. #define GMBUS_SLAVE_READ (1<<0)
  71. #define GMBUS_SLAVE_WRITE (0<<0)
  72. #define GMBUS2 0x5108 /* status */
  73. #define GMBUS_INUSE (1<<15)
  74. #define GMBUS_HW_WAIT_PHASE (1<<14)
  75. #define GMBUS_STALL_TIMEOUT (1<<13)
  76. #define GMBUS_INT (1<<12)
  77. #define GMBUS_HW_RDY (1<<11)
  78. #define GMBUS_SATOER (1<<10)
  79. #define GMBUS_ACTIVE (1<<9)
  80. #define GMBUS3 0x510c /* data buffer bytes 3-0 */
  81. #define GMBUS4 0x5110 /* interrupt mask (Pineview+) */
  82. #define GMBUS_SLAVE_TIMEOUT_EN (1<<4)
  83. #define GMBUS_NAK_EN (1<<3)
  84. #define GMBUS_IDLE_EN (1<<2)
  85. #define GMBUS_HW_WAIT_EN (1<<1)
  86. #define GMBUS_HW_RDY_EN (1<<0)
  87. #define GMBUS5 0x5120 /* byte index */
  88. #define GMBUS_2BYTE_INDEX_EN (1<<31)
  89. #define BLC_PWM_CTL 0x61254
  90. #define BLC_PWM_CTL2 0x61250
  91. #define BLC_PWM_CTL_C 0x62254
  92. #define BLC_PWM_CTL2_C 0x62250
  93. #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
  94. /*
  95. * This is the most significant 15 bits of the number of backlight cycles in a
  96. * complete cycle of the modulated backlight control.
  97. *
  98. * The actual value is this field multiplied by two.
  99. */
  100. #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
  101. #define BLM_LEGACY_MODE (1 << 16)
  102. /*
  103. * This is the number of cycles out of the backlight modulation cycle for which
  104. * the backlight is on.
  105. *
  106. * This field must be no greater than the number of cycles in the complete
  107. * backlight modulation cycle.
  108. */
  109. #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
  110. #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
  111. #define I915_GCFGC 0xf0
  112. #define I915_LOW_FREQUENCY_ENABLE (1 << 7)
  113. #define I915_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
  114. #define I915_DISPLAY_CLOCK_333_MHZ (4 << 4)
  115. #define I915_DISPLAY_CLOCK_MASK (7 << 4)
  116. #define I855_HPLLCC 0xc0
  117. #define I855_CLOCK_CONTROL_MASK (3 << 0)
  118. #define I855_CLOCK_133_200 (0 << 0)
  119. #define I855_CLOCK_100_200 (1 << 0)
  120. #define I855_CLOCK_100_133 (2 << 0)
  121. #define I855_CLOCK_166_250 (3 << 0)
  122. /* I830 CRTC registers */
  123. #define HTOTAL_A 0x60000
  124. #define HBLANK_A 0x60004
  125. #define HSYNC_A 0x60008
  126. #define VTOTAL_A 0x6000c
  127. #define VBLANK_A 0x60010
  128. #define VSYNC_A 0x60014
  129. #define PIPEASRC 0x6001c
  130. #define BCLRPAT_A 0x60020
  131. #define VSYNCSHIFT_A 0x60028
  132. #define HTOTAL_B 0x61000
  133. #define HBLANK_B 0x61004
  134. #define HSYNC_B 0x61008
  135. #define VTOTAL_B 0x6100c
  136. #define VBLANK_B 0x61010
  137. #define VSYNC_B 0x61014
  138. #define PIPEBSRC 0x6101c
  139. #define BCLRPAT_B 0x61020
  140. #define VSYNCSHIFT_B 0x61028
  141. #define HTOTAL_C 0x62000
  142. #define HBLANK_C 0x62004
  143. #define HSYNC_C 0x62008
  144. #define VTOTAL_C 0x6200c
  145. #define VBLANK_C 0x62010
  146. #define VSYNC_C 0x62014
  147. #define PIPECSRC 0x6201c
  148. #define BCLRPAT_C 0x62020
  149. #define VSYNCSHIFT_C 0x62028
  150. #define PP_STATUS 0x61200
  151. # define PP_ON (1 << 31)
  152. /*
  153. * Indicates that all dependencies of the panel are on:
  154. *
  155. * - PLL enabled
  156. * - pipe enabled
  157. * - LVDS/DVOB/DVOC on
  158. */
  159. #define PP_READY (1 << 30)
  160. #define PP_SEQUENCE_NONE (0 << 28)
  161. #define PP_SEQUENCE_ON (1 << 28)
  162. #define PP_SEQUENCE_OFF (2 << 28)
  163. #define PP_SEQUENCE_MASK 0x30000000
  164. #define PP_CONTROL 0x61204
  165. #define POWER_TARGET_ON (1 << 0)
  166. #define LVDSPP_ON 0x61208
  167. #define LVDSPP_OFF 0x6120c
  168. #define PP_CYCLE 0x61210
  169. #define PP_ON_DELAYS 0x61208 /* Cedartrail */
  170. #define PP_OFF_DELAYS 0x6120c /* Cedartrail */
  171. #define PFIT_CONTROL 0x61230
  172. #define PFIT_ENABLE (1 << 31)
  173. #define PFIT_PIPE_MASK (3 << 29)
  174. #define PFIT_PIPE_SHIFT 29
  175. #define PFIT_SCALING_MODE_PILLARBOX (1 << 27)
  176. #define PFIT_SCALING_MODE_LETTERBOX (3 << 26)
  177. #define VERT_INTERP_DISABLE (0 << 10)
  178. #define VERT_INTERP_BILINEAR (1 << 10)
  179. #define VERT_INTERP_MASK (3 << 10)
  180. #define VERT_AUTO_SCALE (1 << 9)
  181. #define HORIZ_INTERP_DISABLE (0 << 6)
  182. #define HORIZ_INTERP_BILINEAR (1 << 6)
  183. #define HORIZ_INTERP_MASK (3 << 6)
  184. #define HORIZ_AUTO_SCALE (1 << 5)
  185. #define PANEL_8TO6_DITHER_ENABLE (1 << 3)
  186. #define PFIT_PGM_RATIOS 0x61234
  187. #define PFIT_VERT_SCALE_MASK 0xfff00000
  188. #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
  189. #define PFIT_AUTO_RATIOS 0x61238
  190. #define DPLL_A 0x06014
  191. #define DPLL_B 0x06018
  192. #define DPLL_VCO_ENABLE (1 << 31)
  193. #define DPLL_DVO_HIGH_SPEED (1 << 30)
  194. #define DPLL_SYNCLOCK_ENABLE (1 << 29)
  195. #define DPLL_VGA_MODE_DIS (1 << 28)
  196. #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
  197. #define DPLLB_MODE_LVDS (2 << 26) /* i915 */
  198. #define DPLL_MODE_MASK (3 << 26)
  199. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
  200. #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
  201. #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
  202. #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
  203. #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
  204. #define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
  205. #define DPLL_LOCK (1 << 15) /* CDV */
  206. /*
  207. * The i830 generation, in DAC/serial mode, defines p1 as two plus this
  208. * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
  209. */
  210. # define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
  211. /*
  212. * The i830 generation, in LVDS mode, defines P1 as the bit number set within
  213. * this field (only one bit may be set).
  214. */
  215. #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
  216. #define DPLL_FPA01_P1_POST_DIV_SHIFT 16
  217. #define PLL_P2_DIVIDE_BY_4 (1 << 23) /* i830, required
  218. * in DVO non-gang */
  219. # define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
  220. #define PLL_REF_INPUT_DREFCLK (0 << 13)
  221. #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
  222. #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO
  223. * TVCLKIN */
  224. #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
  225. #define PLL_REF_INPUT_MASK (3 << 13)
  226. #define PLL_LOAD_PULSE_PHASE_SHIFT 9
  227. /*
  228. * Parallel to Serial Load Pulse phase selection.
  229. * Selects the phase for the 10X DPLL clock for the PCIe
  230. * digital display port. The range is 4 to 13; 10 or more
  231. * is just a flip delay. The default is 6
  232. */
  233. #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
  234. #define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
  235. /*
  236. * SDVO multiplier for 945G/GM. Not used on 965.
  237. *
  238. * DPLL_MD_UDI_MULTIPLIER_MASK
  239. */
  240. #define SDVO_MULTIPLIER_MASK 0x000000ff
  241. #define SDVO_MULTIPLIER_SHIFT_HIRES 4
  242. #define SDVO_MULTIPLIER_SHIFT_VGA 0
  243. /*
  244. * PLL_MD
  245. */
  246. /* Pipe A SDVO/UDI clock multiplier/divider register for G965. */
  247. #define DPLL_A_MD 0x0601c
  248. /* Pipe B SDVO/UDI clock multiplier/divider register for G965. */
  249. #define DPLL_B_MD 0x06020
  250. /*
  251. * UDI pixel divider, controlling how many pixels are stuffed into a packet.
  252. *
  253. * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
  254. */
  255. #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
  256. #define DPLL_MD_UDI_DIVIDER_SHIFT 24
  257. /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
  258. #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
  259. #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
  260. /*
  261. * SDVO/UDI pixel multiplier.
  262. *
  263. * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
  264. * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
  265. * modes, the bus rate would be below the limits, so SDVO allows for stuffing
  266. * dummy bytes in the datastream at an increased clock rate, with both sides of
  267. * the link knowing how many bytes are fill.
  268. *
  269. * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
  270. * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
  271. * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
  272. * through an SDVO command.
  273. *
  274. * This register field has values of multiplication factor minus 1, with
  275. * a maximum multiplier of 5 for SDVO.
  276. */
  277. #define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
  278. #define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
  279. /*
  280. * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
  281. * This best be set to the default value (3) or the CRT won't work. No,
  282. * I don't entirely understand what this does...
  283. */
  284. #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
  285. #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
  286. #define DPLL_TEST 0x606c
  287. #define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
  288. #define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
  289. #define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
  290. #define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
  291. #define DPLLB_TEST_N_BYPASS (1 << 19)
  292. #define DPLLB_TEST_M_BYPASS (1 << 18)
  293. #define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
  294. #define DPLLA_TEST_N_BYPASS (1 << 3)
  295. #define DPLLA_TEST_M_BYPASS (1 << 2)
  296. #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
  297. #define ADPA 0x61100
  298. #define ADPA_DAC_ENABLE (1 << 31)
  299. #define ADPA_DAC_DISABLE 0
  300. #define ADPA_PIPE_SELECT_MASK (1 << 30)
  301. #define ADPA_PIPE_A_SELECT 0
  302. #define ADPA_PIPE_B_SELECT (1 << 30)
  303. #define ADPA_USE_VGA_HVPOLARITY (1 << 15)
  304. #define ADPA_SETS_HVPOLARITY 0
  305. #define ADPA_VSYNC_CNTL_DISABLE (1 << 11)
  306. #define ADPA_VSYNC_CNTL_ENABLE 0
  307. #define ADPA_HSYNC_CNTL_DISABLE (1 << 10)
  308. #define ADPA_HSYNC_CNTL_ENABLE 0
  309. #define ADPA_VSYNC_ACTIVE_HIGH (1 << 4)
  310. #define ADPA_VSYNC_ACTIVE_LOW 0
  311. #define ADPA_HSYNC_ACTIVE_HIGH (1 << 3)
  312. #define ADPA_HSYNC_ACTIVE_LOW 0
  313. #define FPA0 0x06040
  314. #define FPA1 0x06044
  315. #define FPB0 0x06048
  316. #define FPB1 0x0604c
  317. #define FP_N_DIV_MASK 0x003f0000
  318. #define FP_N_DIV_SHIFT 16
  319. #define FP_M1_DIV_MASK 0x00003f00
  320. #define FP_M1_DIV_SHIFT 8
  321. #define FP_M2_DIV_MASK 0x0000003f
  322. #define FP_M2_DIV_SHIFT 0
  323. #define PORT_HOTPLUG_EN 0x61110
  324. #define SDVOB_HOTPLUG_INT_EN (1 << 26)
  325. #define SDVOC_HOTPLUG_INT_EN (1 << 25)
  326. #define TV_HOTPLUG_INT_EN (1 << 18)
  327. #define CRT_HOTPLUG_INT_EN (1 << 9)
  328. #define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
  329. /* CDV.. */
  330. #define CRT_HOTPLUG_ACTIVATION_PERIOD_64 (1 << 8)
  331. #define CRT_HOTPLUG_DAC_ON_TIME_2M (0 << 7)
  332. #define CRT_HOTPLUG_DAC_ON_TIME_4M (1 << 7)
  333. #define CRT_HOTPLUG_VOLTAGE_COMPARE_40 (0 << 5)
  334. #define CRT_HOTPLUG_VOLTAGE_COMPARE_50 (1 << 5)
  335. #define CRT_HOTPLUG_VOLTAGE_COMPARE_60 (2 << 5)
  336. #define CRT_HOTPLUG_VOLTAGE_COMPARE_70 (3 << 5)
  337. #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK (3 << 5)
  338. #define CRT_HOTPLUG_DETECT_DELAY_1G (0 << 4)
  339. #define CRT_HOTPLUG_DETECT_DELAY_2G (1 << 4)
  340. #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV (0 << 2)
  341. #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
  342. #define CRT_HOTPLUG_DETECT_MASK 0x000000F8
  343. #define PORT_HOTPLUG_STAT 0x61114
  344. #define CRT_HOTPLUG_INT_STATUS (1 << 11)
  345. #define TV_HOTPLUG_INT_STATUS (1 << 10)
  346. #define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
  347. #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
  348. #define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
  349. #define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
  350. #define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
  351. #define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
  352. #define SDVOB 0x61140
  353. #define SDVOC 0x61160
  354. #define SDVO_ENABLE (1 << 31)
  355. #define SDVO_PIPE_B_SELECT (1 << 30)
  356. #define SDVO_STALL_SELECT (1 << 29)
  357. #define SDVO_INTERRUPT_ENABLE (1 << 26)
  358. #define SDVO_COLOR_RANGE_16_235 (1 << 8)
  359. #define SDVO_AUDIO_ENABLE (1 << 6)
  360. /**
  361. * 915G/GM SDVO pixel multiplier.
  362. *
  363. * Programmed value is multiplier - 1, up to 5x.
  364. *
  365. * DPLL_MD_UDI_MULTIPLIER_MASK
  366. */
  367. #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
  368. #define SDVO_PORT_MULTIPLY_SHIFT 23
  369. #define SDVO_PHASE_SELECT_MASK (15 << 19)
  370. #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
  371. #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
  372. #define SDVOC_GANG_MODE (1 << 16)
  373. #define SDVO_BORDER_ENABLE (1 << 7)
  374. #define SDVOB_PCIE_CONCURRENCY (1 << 3)
  375. #define SDVO_DETECTED (1 << 2)
  376. /* Bits to be preserved when writing */
  377. #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14))
  378. #define SDVOC_PRESERVE_MASK (1 << 17)
  379. /*
  380. * This register controls the LVDS output enable, pipe selection, and data
  381. * format selection.
  382. *
  383. * All of the clock/data pairs are force powered down by power sequencing.
  384. */
  385. #define LVDS 0x61180
  386. /*
  387. * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
  388. * the DPLL semantics change when the LVDS is assigned to that pipe.
  389. */
  390. #define LVDS_PORT_EN (1 << 31)
  391. /* Selects pipe B for LVDS data. Must be set on pre-965. */
  392. #define LVDS_PIPEB_SELECT (1 << 30)
  393. /* Turns on border drawing to allow centered display. */
  394. #define LVDS_BORDER_EN (1 << 15)
  395. /*
  396. * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
  397. * pixel.
  398. */
  399. #define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
  400. #define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
  401. #define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
  402. /*
  403. * Controls the A3 data pair, which contains the additional LSBs for 24 bit
  404. * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
  405. * on.
  406. */
  407. #define LVDS_A3_POWER_MASK (3 << 6)
  408. #define LVDS_A3_POWER_DOWN (0 << 6)
  409. #define LVDS_A3_POWER_UP (3 << 6)
  410. /*
  411. * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
  412. * is set.
  413. */
  414. #define LVDS_CLKB_POWER_MASK (3 << 4)
  415. #define LVDS_CLKB_POWER_DOWN (0 << 4)
  416. #define LVDS_CLKB_POWER_UP (3 << 4)
  417. /*
  418. * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
  419. * setting for whether we are in dual-channel mode. The B3 pair will
  420. * additionally only be powered up when LVDS_A3_POWER_UP is set.
  421. */
  422. #define LVDS_B0B3_POWER_MASK (3 << 2)
  423. #define LVDS_B0B3_POWER_DOWN (0 << 2)
  424. #define LVDS_B0B3_POWER_UP (3 << 2)
  425. #define PIPEACONF 0x70008
  426. #define PIPEACONF_ENABLE (1 << 31)
  427. #define PIPEACONF_DISABLE 0
  428. #define PIPEACONF_DOUBLE_WIDE (1 << 30)
  429. #define PIPECONF_ACTIVE (1 << 30)
  430. #define I965_PIPECONF_ACTIVE (1 << 30)
  431. #define PIPECONF_DSIPLL_LOCK (1 << 29)
  432. #define PIPEACONF_SINGLE_WIDE 0
  433. #define PIPEACONF_PIPE_UNLOCKED 0
  434. #define PIPEACONF_DSR (1 << 26)
  435. #define PIPEACONF_PIPE_LOCKED (1 << 25)
  436. #define PIPEACONF_PALETTE 0
  437. #define PIPECONF_FORCE_BORDER (1 << 25)
  438. #define PIPEACONF_GAMMA (1 << 24)
  439. #define PIPECONF_PROGRESSIVE (0 << 21)
  440. #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
  441. #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
  442. #define PIPECONF_PLANE_OFF (1 << 19)
  443. #define PIPECONF_CURSOR_OFF (1 << 18)
  444. #define PIPEBCONF 0x71008
  445. #define PIPEBCONF_ENABLE (1 << 31)
  446. #define PIPEBCONF_DISABLE 0
  447. #define PIPEBCONF_DOUBLE_WIDE (1 << 30)
  448. #define PIPEBCONF_DISABLE 0
  449. #define PIPEBCONF_GAMMA (1 << 24)
  450. #define PIPEBCONF_PALETTE 0
  451. #define PIPECCONF 0x72008
  452. #define PIPEBGCMAXRED 0x71010
  453. #define PIPEBGCMAXGREEN 0x71014
  454. #define PIPEBGCMAXBLUE 0x71018
  455. #define PIPEASTAT 0x70024
  456. #define PIPEBSTAT 0x71024
  457. #define PIPECSTAT 0x72024
  458. #define PIPE_VBLANK_INTERRUPT_STATUS (1UL << 1)
  459. #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL << 2)
  460. #define PIPE_VBLANK_CLEAR (1 << 1)
  461. #define PIPE_VBLANK_STATUS (1 << 1)
  462. #define PIPE_TE_STATUS (1UL << 6)
  463. #define PIPE_DPST_EVENT_STATUS (1UL << 7)
  464. #define PIPE_VSYNC_CLEAR (1UL << 9)
  465. #define PIPE_VSYNC_STATUS (1UL << 9)
  466. #define PIPE_HDMI_AUDIO_UNDERRUN_STATUS (1UL << 10)
  467. #define PIPE_HDMI_AUDIO_BUFFER_DONE_STATUS (1UL << 11)
  468. #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL << 17)
  469. #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL << 18)
  470. #define PIPE_TE_ENABLE (1UL << 22)
  471. #define PIPE_DPST_EVENT_ENABLE (1UL << 23)
  472. #define PIPE_VSYNC_ENABL (1UL << 25)
  473. #define PIPE_HDMI_AUDIO_UNDERRUN (1UL << 26)
  474. #define PIPE_HDMI_AUDIO_BUFFER_DONE (1UL << 27)
  475. #define PIPE_HDMI_AUDIO_INT_MASK (PIPE_HDMI_AUDIO_UNDERRUN | \
  476. PIPE_HDMI_AUDIO_BUFFER_DONE)
  477. #define PIPE_EVENT_MASK ((1 << 29)|(1 << 28)|(1 << 27)|(1 << 26)|(1 << 24)|(1 << 23)|(1 << 22)|(1 << 21)|(1 << 20)|(1 << 16))
  478. #define PIPE_VBLANK_MASK ((1 << 25)|(1 << 24)|(1 << 18)|(1 << 17))
  479. #define HISTOGRAM_INT_CONTROL 0x61268
  480. #define HISTOGRAM_BIN_DATA 0X61264
  481. #define HISTOGRAM_LOGIC_CONTROL 0x61260
  482. #define PWM_CONTROL_LOGIC 0x61250
  483. #define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL << 10)
  484. #define HISTOGRAM_INTERRUPT_ENABLE (1UL << 31)
  485. #define HISTOGRAM_LOGIC_ENABLE (1UL << 31)
  486. #define PWM_LOGIC_ENABLE (1UL << 31)
  487. #define PWM_PHASEIN_ENABLE (1UL << 25)
  488. #define PWM_PHASEIN_INT_ENABLE (1UL << 24)
  489. #define PWM_PHASEIN_VB_COUNT 0x00001f00
  490. #define PWM_PHASEIN_INC 0x0000001f
  491. #define HISTOGRAM_INT_CTRL_CLEAR (1UL << 30)
  492. #define DPST_YUV_LUMA_MODE 0
  493. struct dpst_ie_histogram_control {
  494. union {
  495. uint32_t data;
  496. struct {
  497. uint32_t bin_reg_index:7;
  498. uint32_t reserved:4;
  499. uint32_t bin_reg_func_select:1;
  500. uint32_t sync_to_phase_in:1;
  501. uint32_t alt_enhancement_mode:2;
  502. uint32_t reserved1:1;
  503. uint32_t sync_to_phase_in_count:8;
  504. uint32_t histogram_mode_select:1;
  505. uint32_t reserved2:4;
  506. uint32_t ie_pipe_assignment:1;
  507. uint32_t ie_mode_table_enabled:1;
  508. uint32_t ie_histogram_enable:1;
  509. };
  510. };
  511. };
  512. struct dpst_guardband {
  513. union {
  514. uint32_t data;
  515. struct {
  516. uint32_t guardband:22;
  517. uint32_t guardband_interrupt_delay:8;
  518. uint32_t interrupt_status:1;
  519. uint32_t interrupt_enable:1;
  520. };
  521. };
  522. };
  523. #define PIPEAFRAMEHIGH 0x70040
  524. #define PIPEAFRAMEPIXEL 0x70044
  525. #define PIPEBFRAMEHIGH 0x71040
  526. #define PIPEBFRAMEPIXEL 0x71044
  527. #define PIPECFRAMEHIGH 0x72040
  528. #define PIPECFRAMEPIXEL 0x72044
  529. #define PIPE_FRAME_HIGH_MASK 0x0000ffff
  530. #define PIPE_FRAME_HIGH_SHIFT 0
  531. #define PIPE_FRAME_LOW_MASK 0xff000000
  532. #define PIPE_FRAME_LOW_SHIFT 24
  533. #define PIPE_PIXEL_MASK 0x00ffffff
  534. #define PIPE_PIXEL_SHIFT 0
  535. #define DSPARB 0x70030
  536. #define DSPFW1 0x70034
  537. #define DSPFW2 0x70038
  538. #define DSPFW3 0x7003c
  539. #define DSPFW4 0x70050
  540. #define DSPFW5 0x70054
  541. #define DSPFW6 0x70058
  542. #define DSPCHICKENBIT 0x70400
  543. #define DSPACNTR 0x70180
  544. #define DSPBCNTR 0x71180
  545. #define DSPCCNTR 0x72180
  546. #define DISPLAY_PLANE_ENABLE (1 << 31)
  547. #define DISPLAY_PLANE_DISABLE 0
  548. #define DISPPLANE_GAMMA_ENABLE (1 << 30)
  549. #define DISPPLANE_GAMMA_DISABLE 0
  550. #define DISPPLANE_PIXFORMAT_MASK (0xf << 26)
  551. #define DISPPLANE_8BPP (0x2 << 26)
  552. #define DISPPLANE_15_16BPP (0x4 << 26)
  553. #define DISPPLANE_16BPP (0x5 << 26)
  554. #define DISPPLANE_32BPP_NO_ALPHA (0x6 << 26)
  555. #define DISPPLANE_32BPP (0x7 << 26)
  556. #define DISPPLANE_STEREO_ENABLE (1 << 25)
  557. #define DISPPLANE_STEREO_DISABLE 0
  558. #define DISPPLANE_SEL_PIPE_MASK (1 << 24)
  559. #define DISPPLANE_SEL_PIPE_POS 24
  560. #define DISPPLANE_SEL_PIPE_A 0
  561. #define DISPPLANE_SEL_PIPE_B (1 << 24)
  562. #define DISPPLANE_SRC_KEY_ENABLE (1 << 22)
  563. #define DISPPLANE_SRC_KEY_DISABLE 0
  564. #define DISPPLANE_LINE_DOUBLE (1 << 20)
  565. #define DISPPLANE_NO_LINE_DOUBLE 0
  566. #define DISPPLANE_STEREO_POLARITY_FIRST 0
  567. #define DISPPLANE_STEREO_POLARITY_SECOND (1 << 18)
  568. /* plane B only */
  569. #define DISPPLANE_ALPHA_TRANS_ENABLE (1 << 15)
  570. #define DISPPLANE_ALPHA_TRANS_DISABLE 0
  571. #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
  572. #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
  573. #define DISPPLANE_BOTTOM (4)
  574. #define DSPABASE 0x70184
  575. #define DSPALINOFF 0x70184
  576. #define DSPASTRIDE 0x70188
  577. #define DSPBBASE 0x71184
  578. #define DSPBLINOFF 0X71184
  579. #define DSPBADDR DSPBBASE
  580. #define DSPBSTRIDE 0x71188
  581. #define DSPCBASE 0x72184
  582. #define DSPCLINOFF 0x72184
  583. #define DSPCSTRIDE 0x72188
  584. #define DSPAKEYVAL 0x70194
  585. #define DSPAKEYMASK 0x70198
  586. #define DSPAPOS 0x7018C /* reserved */
  587. #define DSPASIZE 0x70190
  588. #define DSPBPOS 0x7118C
  589. #define DSPBSIZE 0x71190
  590. #define DSPCPOS 0x7218C
  591. #define DSPCSIZE 0x72190
  592. #define DSPASURF 0x7019C
  593. #define DSPATILEOFF 0x701A4
  594. #define DSPBSURF 0x7119C
  595. #define DSPBTILEOFF 0x711A4
  596. #define DSPCSURF 0x7219C
  597. #define DSPCTILEOFF 0x721A4
  598. #define DSPCKEYMAXVAL 0x721A0
  599. #define DSPCKEYMINVAL 0x72194
  600. #define DSPCKEYMSK 0x72198
  601. #define VGACNTRL 0x71400
  602. #define VGA_DISP_DISABLE (1 << 31)
  603. #define VGA_2X_MODE (1 << 30)
  604. #define VGA_PIPE_B_SELECT (1 << 29)
  605. /*
  606. * Overlay registers
  607. */
  608. #define OV_C_OFFSET 0x08000
  609. #define OV_OVADD 0x30000
  610. #define OV_DOVASTA 0x30008
  611. # define OV_PIPE_SELECT ((1 << 6)|(1 << 7))
  612. # define OV_PIPE_SELECT_POS 6
  613. # define OV_PIPE_A 0
  614. # define OV_PIPE_C 1
  615. #define OV_OGAMC5 0x30010
  616. #define OV_OGAMC4 0x30014
  617. #define OV_OGAMC3 0x30018
  618. #define OV_OGAMC2 0x3001C
  619. #define OV_OGAMC1 0x30020
  620. #define OV_OGAMC0 0x30024
  621. #define OVC_OVADD 0x38000
  622. #define OVC_DOVCSTA 0x38008
  623. #define OVC_OGAMC5 0x38010
  624. #define OVC_OGAMC4 0x38014
  625. #define OVC_OGAMC3 0x38018
  626. #define OVC_OGAMC2 0x3801C
  627. #define OVC_OGAMC1 0x38020
  628. #define OVC_OGAMC0 0x38024
  629. /*
  630. * Some BIOS scratch area registers. The 845 (and 830?) store the amount
  631. * of video memory available to the BIOS in SWF1.
  632. */
  633. #define SWF0 0x71410
  634. #define SWF1 0x71414
  635. #define SWF2 0x71418
  636. #define SWF3 0x7141c
  637. #define SWF4 0x71420
  638. #define SWF5 0x71424
  639. #define SWF6 0x71428
  640. /*
  641. * 855 scratch registers.
  642. */
  643. #define SWF00 0x70410
  644. #define SWF01 0x70414
  645. #define SWF02 0x70418
  646. #define SWF03 0x7041c
  647. #define SWF04 0x70420
  648. #define SWF05 0x70424
  649. #define SWF06 0x70428
  650. #define SWF10 SWF0
  651. #define SWF11 SWF1
  652. #define SWF12 SWF2
  653. #define SWF13 SWF3
  654. #define SWF14 SWF4
  655. #define SWF15 SWF5
  656. #define SWF16 SWF6
  657. #define SWF30 0x72414
  658. #define SWF31 0x72418
  659. #define SWF32 0x7241c
  660. /*
  661. * Palette registers
  662. */
  663. #define PALETTE_A 0x0a000
  664. #define PALETTE_B 0x0a800
  665. #define PALETTE_C 0x0ac00
  666. /* Cursor A & B regs */
  667. #define CURACNTR 0x70080
  668. #define CURSOR_MODE_DISABLE 0x00
  669. #define CURSOR_MODE_64_32B_AX 0x07
  670. #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
  671. #define MCURSOR_GAMMA_ENABLE (1 << 26)
  672. #define CURABASE 0x70084
  673. #define CURAPOS 0x70088
  674. #define CURSOR_POS_MASK 0x007FF
  675. #define CURSOR_POS_SIGN 0x8000
  676. #define CURSOR_X_SHIFT 0
  677. #define CURSOR_Y_SHIFT 16
  678. #define CURBCNTR 0x700c0
  679. #define CURBBASE 0x700c4
  680. #define CURBPOS 0x700c8
  681. #define CURCCNTR 0x700e0
  682. #define CURCBASE 0x700e4
  683. #define CURCPOS 0x700e8
  684. /*
  685. * Interrupt Registers
  686. */
  687. #define IER 0x020a0
  688. #define IIR 0x020a4
  689. #define IMR 0x020a8
  690. #define ISR 0x020ac
  691. /*
  692. * MOORESTOWN delta registers
  693. */
  694. #define MRST_DPLL_A 0x0f014
  695. #define MDFLD_DPLL_B 0x0f018
  696. #define MDFLD_INPUT_REF_SEL (1 << 14)
  697. #define MDFLD_VCO_SEL (1 << 16)
  698. #define DPLLA_MODE_LVDS (2 << 26) /* mrst */
  699. #define MDFLD_PLL_LATCHEN (1 << 28)
  700. #define MDFLD_PWR_GATE_EN (1 << 30)
  701. #define MDFLD_P1_MASK (0x1FF << 17)
  702. #define MRST_FPA0 0x0f040
  703. #define MRST_FPA1 0x0f044
  704. #define MDFLD_DPLL_DIV0 0x0f048
  705. #define MDFLD_DPLL_DIV1 0x0f04c
  706. #define MRST_PERF_MODE 0x020f4
  707. /*
  708. * MEDFIELD HDMI registers
  709. */
  710. #define HDMIPHYMISCCTL 0x61134
  711. #define HDMI_PHY_POWER_DOWN 0x7f
  712. #define HDMIB_CONTROL 0x61140
  713. #define HDMIB_PORT_EN (1 << 31)
  714. #define HDMIB_PIPE_B_SELECT (1 << 30)
  715. #define HDMIB_NULL_PACKET (1 << 9)
  716. #define HDMIB_HDCP_PORT (1 << 5)
  717. /* #define LVDS 0x61180 */
  718. #define MRST_PANEL_8TO6_DITHER_ENABLE (1 << 25)
  719. #define MRST_PANEL_24_DOT_1_FORMAT (1 << 24)
  720. #define LVDS_A3_POWER_UP_0_OUTPUT (1 << 6)
  721. #define MIPI 0x61190
  722. #define MIPI_C 0x62190
  723. #define MIPI_PORT_EN (1 << 31)
  724. /* Turns on border drawing to allow centered display. */
  725. #define SEL_FLOPPED_HSTX (1 << 23)
  726. #define PASS_FROM_SPHY_TO_AFE (1 << 16)
  727. #define MIPI_BORDER_EN (1 << 15)
  728. #define MIPIA_3LANE_MIPIC_1LANE 0x1
  729. #define MIPIA_2LANE_MIPIC_2LANE 0x2
  730. #define TE_TRIGGER_DSI_PROTOCOL (1 << 2)
  731. #define TE_TRIGGER_GPIO_PIN (1 << 3)
  732. #define MIPI_TE_COUNT 0x61194
  733. /* #define PP_CONTROL 0x61204 */
  734. #define POWER_DOWN_ON_RESET (1 << 1)
  735. /* #define PFIT_CONTROL 0x61230 */
  736. #define PFIT_PIPE_SELECT (3 << 29)
  737. #define PFIT_PIPE_SELECT_SHIFT (29)
  738. /* #define BLC_PWM_CTL 0x61254 */
  739. #define MRST_BACKLIGHT_MODULATION_FREQ_SHIFT (16)
  740. #define MRST_BACKLIGHT_MODULATION_FREQ_MASK (0xffff << 16)
  741. /* #define PIPEACONF 0x70008 */
  742. #define PIPEACONF_PIPE_STATE (1 << 30)
  743. /* #define DSPACNTR 0x70180 */
  744. #define MRST_DSPABASE 0x7019c
  745. #define MRST_DSPBBASE 0x7119c
  746. #define MDFLD_DSPCBASE 0x7219c
  747. /*
  748. * Moorestown registers.
  749. */
  750. /*
  751. * MIPI IP registers
  752. */
  753. #define MIPIC_REG_OFFSET 0x800
  754. #define DEVICE_READY_REG 0xb000
  755. #define LP_OUTPUT_HOLD (1 << 16)
  756. #define EXIT_ULPS_DEV_READY 0x3
  757. #define LP_OUTPUT_HOLD_RELEASE 0x810000
  758. # define ENTERING_ULPS (2 << 1)
  759. # define EXITING_ULPS (1 << 1)
  760. # define ULPS_MASK (3 << 1)
  761. # define BUS_POSSESSION (1 << 3)
  762. #define INTR_STAT_REG 0xb004
  763. #define RX_SOT_ERROR (1 << 0)
  764. #define RX_SOT_SYNC_ERROR (1 << 1)
  765. #define RX_ESCAPE_MODE_ENTRY_ERROR (1 << 3)
  766. #define RX_LP_TX_SYNC_ERROR (1 << 4)
  767. #define RX_HS_RECEIVE_TIMEOUT_ERROR (1 << 5)
  768. #define RX_FALSE_CONTROL_ERROR (1 << 6)
  769. #define RX_ECC_SINGLE_BIT_ERROR (1 << 7)
  770. #define RX_ECC_MULTI_BIT_ERROR (1 << 8)
  771. #define RX_CHECKSUM_ERROR (1 << 9)
  772. #define RX_DSI_DATA_TYPE_NOT_RECOGNIZED (1 << 10)
  773. #define RX_DSI_VC_ID_INVALID (1 << 11)
  774. #define TX_FALSE_CONTROL_ERROR (1 << 12)
  775. #define TX_ECC_SINGLE_BIT_ERROR (1 << 13)
  776. #define TX_ECC_MULTI_BIT_ERROR (1 << 14)
  777. #define TX_CHECKSUM_ERROR (1 << 15)
  778. #define TX_DSI_DATA_TYPE_NOT_RECOGNIZED (1 << 16)
  779. #define TX_DSI_VC_ID_INVALID (1 << 17)
  780. #define HIGH_CONTENTION (1 << 18)
  781. #define LOW_CONTENTION (1 << 19)
  782. #define DPI_FIFO_UNDER_RUN (1 << 20)
  783. #define HS_TX_TIMEOUT (1 << 21)
  784. #define LP_RX_TIMEOUT (1 << 22)
  785. #define TURN_AROUND_ACK_TIMEOUT (1 << 23)
  786. #define ACK_WITH_NO_ERROR (1 << 24)
  787. #define HS_GENERIC_WR_FIFO_FULL (1 << 27)
  788. #define LP_GENERIC_WR_FIFO_FULL (1 << 28)
  789. #define SPL_PKT_SENT (1 << 30)
  790. #define INTR_EN_REG 0xb008
  791. #define DSI_FUNC_PRG_REG 0xb00c
  792. #define DPI_CHANNEL_NUMBER_POS 0x03
  793. #define DBI_CHANNEL_NUMBER_POS 0x05
  794. #define FMT_DPI_POS 0x07
  795. #define FMT_DBI_POS 0x0A
  796. #define DBI_DATA_WIDTH_POS 0x0D
  797. /* DPI PIXEL FORMATS */
  798. #define RGB_565_FMT 0x01 /* RGB 565 FORMAT */
  799. #define RGB_666_FMT 0x02 /* RGB 666 FORMAT */
  800. #define LRGB_666_FMT 0x03 /* RGB LOOSELY PACKED
  801. * 666 FORMAT
  802. */
  803. #define RGB_888_FMT 0x04 /* RGB 888 FORMAT */
  804. #define VIRTUAL_CHANNEL_NUMBER_0 0x00 /* Virtual channel 0 */
  805. #define VIRTUAL_CHANNEL_NUMBER_1 0x01 /* Virtual channel 1 */
  806. #define VIRTUAL_CHANNEL_NUMBER_2 0x02 /* Virtual channel 2 */
  807. #define VIRTUAL_CHANNEL_NUMBER_3 0x03 /* Virtual channel 3 */
  808. #define DBI_NOT_SUPPORTED 0x00 /* command mode
  809. * is not supported
  810. */
  811. #define DBI_DATA_WIDTH_16BIT 0x01 /* 16 bit data */
  812. #define DBI_DATA_WIDTH_9BIT 0x02 /* 9 bit data */
  813. #define DBI_DATA_WIDTH_8BIT 0x03 /* 8 bit data */
  814. #define DBI_DATA_WIDTH_OPT1 0x04 /* option 1 */
  815. #define DBI_DATA_WIDTH_OPT2 0x05 /* option 2 */
  816. #define HS_TX_TIMEOUT_REG 0xb010
  817. #define LP_RX_TIMEOUT_REG 0xb014
  818. #define TURN_AROUND_TIMEOUT_REG 0xb018
  819. #define DEVICE_RESET_REG 0xb01C
  820. #define DPI_RESOLUTION_REG 0xb020
  821. #define RES_V_POS 0x10
  822. #define DBI_RESOLUTION_REG 0xb024 /* Reserved for MDFLD */
  823. #define HORIZ_SYNC_PAD_COUNT_REG 0xb028
  824. #define HORIZ_BACK_PORCH_COUNT_REG 0xb02C
  825. #define HORIZ_FRONT_PORCH_COUNT_REG 0xb030
  826. #define HORIZ_ACTIVE_AREA_COUNT_REG 0xb034
  827. #define VERT_SYNC_PAD_COUNT_REG 0xb038
  828. #define VERT_BACK_PORCH_COUNT_REG 0xb03c
  829. #define VERT_FRONT_PORCH_COUNT_REG 0xb040
  830. #define HIGH_LOW_SWITCH_COUNT_REG 0xb044
  831. #define DPI_CONTROL_REG 0xb048
  832. #define DPI_SHUT_DOWN (1 << 0)
  833. #define DPI_TURN_ON (1 << 1)
  834. #define DPI_COLOR_MODE_ON (1 << 2)
  835. #define DPI_COLOR_MODE_OFF (1 << 3)
  836. #define DPI_BACK_LIGHT_ON (1 << 4)
  837. #define DPI_BACK_LIGHT_OFF (1 << 5)
  838. #define DPI_LP (1 << 6)
  839. #define DPI_DATA_REG 0xb04c
  840. #define DPI_BACK_LIGHT_ON_DATA 0x07
  841. #define DPI_BACK_LIGHT_OFF_DATA 0x17
  842. #define INIT_COUNT_REG 0xb050
  843. #define MAX_RET_PAK_REG 0xb054
  844. #define VIDEO_FMT_REG 0xb058
  845. #define COMPLETE_LAST_PCKT (1 << 2)
  846. #define EOT_DISABLE_REG 0xb05c
  847. #define ENABLE_CLOCK_STOPPING (1 << 1)
  848. #define LP_BYTECLK_REG 0xb060
  849. #define LP_GEN_DATA_REG 0xb064
  850. #define HS_GEN_DATA_REG 0xb068
  851. #define LP_GEN_CTRL_REG 0xb06C
  852. #define HS_GEN_CTRL_REG 0xb070
  853. #define DCS_CHANNEL_NUMBER_POS 0x6
  854. #define MCS_COMMANDS_POS 0x8
  855. #define WORD_COUNTS_POS 0x8
  856. #define MCS_PARAMETER_POS 0x10
  857. #define GEN_FIFO_STAT_REG 0xb074
  858. #define HS_DATA_FIFO_FULL (1 << 0)
  859. #define HS_DATA_FIFO_HALF_EMPTY (1 << 1)
  860. #define HS_DATA_FIFO_EMPTY (1 << 2)
  861. #define LP_DATA_FIFO_FULL (1 << 8)
  862. #define LP_DATA_FIFO_HALF_EMPTY (1 << 9)
  863. #define LP_DATA_FIFO_EMPTY (1 << 10)
  864. #define HS_CTRL_FIFO_FULL (1 << 16)
  865. #define HS_CTRL_FIFO_HALF_EMPTY (1 << 17)
  866. #define HS_CTRL_FIFO_EMPTY (1 << 18)
  867. #define LP_CTRL_FIFO_FULL (1 << 24)
  868. #define LP_CTRL_FIFO_HALF_EMPTY (1 << 25)
  869. #define LP_CTRL_FIFO_EMPTY (1 << 26)
  870. #define DBI_FIFO_EMPTY (1 << 27)
  871. #define DPI_FIFO_EMPTY (1 << 28)
  872. #define HS_LS_DBI_ENABLE_REG 0xb078
  873. #define TXCLKESC_REG 0xb07c
  874. #define DPHY_PARAM_REG 0xb080
  875. #define DBI_BW_CTRL_REG 0xb084
  876. #define CLK_LANE_SWT_REG 0xb088
  877. /*
  878. * MIPI Adapter registers
  879. */
  880. #define MIPI_CONTROL_REG 0xb104
  881. #define MIPI_2X_CLOCK_BITS ((1 << 0) | (1 << 1))
  882. #define MIPI_DATA_ADDRESS_REG 0xb108
  883. #define MIPI_DATA_LENGTH_REG 0xb10C
  884. #define MIPI_COMMAND_ADDRESS_REG 0xb110
  885. #define MIPI_COMMAND_LENGTH_REG 0xb114
  886. #define MIPI_READ_DATA_RETURN_REG0 0xb118
  887. #define MIPI_READ_DATA_RETURN_REG1 0xb11C
  888. #define MIPI_READ_DATA_RETURN_REG2 0xb120
  889. #define MIPI_READ_DATA_RETURN_REG3 0xb124
  890. #define MIPI_READ_DATA_RETURN_REG4 0xb128
  891. #define MIPI_READ_DATA_RETURN_REG5 0xb12C
  892. #define MIPI_READ_DATA_RETURN_REG6 0xb130
  893. #define MIPI_READ_DATA_RETURN_REG7 0xb134
  894. #define MIPI_READ_DATA_VALID_REG 0xb138
  895. /* DBI COMMANDS */
  896. #define soft_reset 0x01
  897. /*
  898. * The display module performs a software reset.
  899. * Registers are written with their SW Reset default values.
  900. */
  901. #define get_power_mode 0x0a
  902. /*
  903. * The display module returns the current power mode
  904. */
  905. #define get_address_mode 0x0b
  906. /*
  907. * The display module returns the current status.
  908. */
  909. #define get_pixel_format 0x0c
  910. /*
  911. * This command gets the pixel format for the RGB image data
  912. * used by the interface.
  913. */
  914. #define get_display_mode 0x0d
  915. /*
  916. * The display module returns the Display Image Mode status.
  917. */
  918. #define get_signal_mode 0x0e
  919. /*
  920. * The display module returns the Display Signal Mode.
  921. */
  922. #define get_diagnostic_result 0x0f
  923. /*
  924. * The display module returns the self-diagnostic results following
  925. * a Sleep Out command.
  926. */
  927. #define enter_sleep_mode 0x10
  928. /*
  929. * This command causes the display module to enter the Sleep mode.
  930. * In this mode, all unnecessary blocks inside the display module are
  931. * disabled except interface communication. This is the lowest power
  932. * mode the display module supports.
  933. */
  934. #define exit_sleep_mode 0x11
  935. /*
  936. * This command causes the display module to exit Sleep mode.
  937. * All blocks inside the display module are enabled.
  938. */
  939. #define enter_partial_mode 0x12
  940. /*
  941. * This command causes the display module to enter the Partial Display
  942. * Mode. The Partial Display Mode window is described by the
  943. * set_partial_area command.
  944. */
  945. #define enter_normal_mode 0x13
  946. /*
  947. * This command causes the display module to enter the Normal mode.
  948. * Normal Mode is defined as Partial Display mode and Scroll mode are off
  949. */
  950. #define exit_invert_mode 0x20
  951. /*
  952. * This command causes the display module to stop inverting the image
  953. * data on the display device. The frame memory contents remain unchanged.
  954. * No status bits are changed.
  955. */
  956. #define enter_invert_mode 0x21
  957. /*
  958. * This command causes the display module to invert the image data only on
  959. * the display device. The frame memory contents remain unchanged.
  960. * No status bits are changed.
  961. */
  962. #define set_gamma_curve 0x26
  963. /*
  964. * This command selects the desired gamma curve for the display device.
  965. * Four fixed gamma curves are defined in section DCS spec.
  966. */
  967. #define set_display_off 0x28
  968. /* ************************************************************************* *\
  969. This command causes the display module to stop displaying the image data
  970. on the display device. The frame memory contents remain unchanged.
  971. No status bits are changed.
  972. \* ************************************************************************* */
  973. #define set_display_on 0x29
  974. /* ************************************************************************* *\
  975. This command causes the display module to start displaying the image data
  976. on the display device. The frame memory contents remain unchanged.
  977. No status bits are changed.
  978. \* ************************************************************************* */
  979. #define set_column_address 0x2a
  980. /*
  981. * This command defines the column extent of the frame memory accessed by
  982. * the hostprocessor with the read_memory_continue and
  983. * write_memory_continue commands.
  984. * No status bits are changed.
  985. */
  986. #define set_page_addr 0x2b
  987. /*
  988. * This command defines the page extent of the frame memory accessed by
  989. * the host processor with the write_memory_continue and
  990. * read_memory_continue command.
  991. * No status bits are changed.
  992. */
  993. #define write_mem_start 0x2c
  994. /*
  995. * This command transfers image data from the host processor to the
  996. * display modules frame memory starting at the pixel location specified
  997. * by preceding set_column_address and set_page_address commands.
  998. */
  999. #define set_partial_area 0x30
  1000. /*
  1001. * This command defines the Partial Display mode s display area.
  1002. * There are two parameters associated with this command, the first
  1003. * defines the Start Row (SR) and the second the End Row (ER). SR and ER
  1004. * refer to the Frame Memory Line Pointer.
  1005. */
  1006. #define set_scroll_area 0x33
  1007. /*
  1008. * This command defines the display modules Vertical Scrolling Area.
  1009. */
  1010. #define set_tear_off 0x34
  1011. /*
  1012. * This command turns off the display modules Tearing Effect output
  1013. * signal on the TE signal line.
  1014. */
  1015. #define set_tear_on 0x35
  1016. /*
  1017. * This command turns on the display modules Tearing Effect output signal
  1018. * on the TE signal line.
  1019. */
  1020. #define set_address_mode 0x36
  1021. /*
  1022. * This command sets the data order for transfers from the host processor
  1023. * to display modules frame memory,bits B[7:5] and B3, and from the
  1024. * display modules frame memory to the display device, bits B[2:0] and B4.
  1025. */
  1026. #define set_scroll_start 0x37
  1027. /*
  1028. * This command sets the start of the vertical scrolling area in the frame
  1029. * memory. The vertical scrolling area is fully defined when this command
  1030. * is used with the set_scroll_area command The set_scroll_start command
  1031. * has one parameter, the Vertical Scroll Pointer. The VSP defines the
  1032. * line in the frame memory that is written to the display device as the
  1033. * first line of the vertical scroll area.
  1034. */
  1035. #define exit_idle_mode 0x38
  1036. /*
  1037. * This command causes the display module to exit Idle mode.
  1038. */
  1039. #define enter_idle_mode 0x39
  1040. /*
  1041. * This command causes the display module to enter Idle Mode.
  1042. * In Idle Mode, color expression is reduced. Colors are shown on the
  1043. * display device using the MSB of each of the R, G and B color
  1044. * components in the frame memory
  1045. */
  1046. #define set_pixel_format 0x3a
  1047. /*
  1048. * This command sets the pixel format for the RGB image data used by the
  1049. * interface.
  1050. * Bits D[6:4] DPI Pixel Format Definition
  1051. * Bits D[2:0] DBI Pixel Format Definition
  1052. * Bits D7 and D3 are not used.
  1053. */
  1054. #define DCS_PIXEL_FORMAT_3bpp 0x1
  1055. #define DCS_PIXEL_FORMAT_8bpp 0x2
  1056. #define DCS_PIXEL_FORMAT_12bpp 0x3
  1057. #define DCS_PIXEL_FORMAT_16bpp 0x5
  1058. #define DCS_PIXEL_FORMAT_18bpp 0x6
  1059. #define DCS_PIXEL_FORMAT_24bpp 0x7
  1060. #define write_mem_cont 0x3c
  1061. /*
  1062. * This command transfers image data from the host processor to the
  1063. * display module's frame memory continuing from the pixel location
  1064. * following the previous write_memory_continue or write_memory_start
  1065. * command.
  1066. */
  1067. #define set_tear_scanline 0x44
  1068. /*
  1069. * This command turns on the display modules Tearing Effect output signal
  1070. * on the TE signal line when the display module reaches line N.
  1071. */
  1072. #define get_scanline 0x45
  1073. /*
  1074. * The display module returns the current scanline, N, used to update the
  1075. * display device. The total number of scanlines on a display device is
  1076. * defined as VSYNC + VBP + VACT + VFP.The first scanline is defined as
  1077. * the first line of V Sync and is denoted as Line 0.
  1078. * When in Sleep Mode, the value returned by get_scanline is undefined.
  1079. */
  1080. /* MCS or Generic COMMANDS */
  1081. /* MCS/generic data type */
  1082. #define GEN_SHORT_WRITE_0 0x03 /* generic short write, no parameters */
  1083. #define GEN_SHORT_WRITE_1 0x13 /* generic short write, 1 parameters */
  1084. #define GEN_SHORT_WRITE_2 0x23 /* generic short write, 2 parameters */
  1085. #define GEN_READ_0 0x04 /* generic read, no parameters */
  1086. #define GEN_READ_1 0x14 /* generic read, 1 parameters */
  1087. #define GEN_READ_2 0x24 /* generic read, 2 parameters */
  1088. #define GEN_LONG_WRITE 0x29 /* generic long write */
  1089. #define MCS_SHORT_WRITE_0 0x05 /* MCS short write, no parameters */
  1090. #define MCS_SHORT_WRITE_1 0x15 /* MCS short write, 1 parameters */
  1091. #define MCS_READ 0x06 /* MCS read, no parameters */
  1092. #define MCS_LONG_WRITE 0x39 /* MCS long write */
  1093. /* MCS/generic commands */
  1094. /* TPO MCS */
  1095. #define write_display_profile 0x50
  1096. #define write_display_brightness 0x51
  1097. #define write_ctrl_display 0x53
  1098. #define write_ctrl_cabc 0x55
  1099. #define UI_IMAGE 0x01
  1100. #define STILL_IMAGE 0x02
  1101. #define MOVING_IMAGE 0x03
  1102. #define write_hysteresis 0x57
  1103. #define write_gamma_setting 0x58
  1104. #define write_cabc_min_bright 0x5e
  1105. #define write_kbbc_profile 0x60
  1106. /* TMD MCS */
  1107. #define tmd_write_display_brightness 0x8c
  1108. /*
  1109. * This command is used to control ambient light, panel backlight
  1110. * brightness and gamma settings.
  1111. */
  1112. #define BRIGHT_CNTL_BLOCK_ON (1 << 5)
  1113. #define AMBIENT_LIGHT_SENSE_ON (1 << 4)
  1114. #define DISPLAY_DIMMING_ON (1 << 3)
  1115. #define BACKLIGHT_ON (1 << 2)
  1116. #define DISPLAY_BRIGHTNESS_AUTO (1 << 1)
  1117. #define GAMMA_AUTO (1 << 0)
  1118. /* DCS Interface Pixel Formats */
  1119. #define DCS_PIXEL_FORMAT_3BPP 0x1
  1120. #define DCS_PIXEL_FORMAT_8BPP 0x2
  1121. #define DCS_PIXEL_FORMAT_12BPP 0x3
  1122. #define DCS_PIXEL_FORMAT_16BPP 0x5
  1123. #define DCS_PIXEL_FORMAT_18BPP 0x6
  1124. #define DCS_PIXEL_FORMAT_24BPP 0x7
  1125. /* ONE PARAMETER READ DATA */
  1126. #define addr_mode_data 0xfc
  1127. #define diag_res_data 0x00
  1128. #define disp_mode_data 0x23
  1129. #define pxl_fmt_data 0x77
  1130. #define pwr_mode_data 0x74
  1131. #define sig_mode_data 0x00
  1132. /* TWO PARAMETERS READ DATA */
  1133. #define scanline_data1 0xff
  1134. #define scanline_data2 0xff
  1135. #define NON_BURST_MODE_SYNC_PULSE 0x01 /* Non Burst Mode
  1136. * with Sync Pulse
  1137. */
  1138. #define NON_BURST_MODE_SYNC_EVENTS 0x02 /* Non Burst Mode
  1139. * with Sync events
  1140. */
  1141. #define BURST_MODE 0x03 /* Burst Mode */
  1142. #define DBI_COMMAND_BUFFER_SIZE 0x240 /* 0x32 */ /* 0x120 */
  1143. /* Allocate at least
  1144. * 0x100 Byte with 32
  1145. * byte alignment
  1146. */
  1147. #define DBI_DATA_BUFFER_SIZE 0x120 /* Allocate at least
  1148. * 0x100 Byte with 32
  1149. * byte alignment
  1150. */
  1151. #define DBI_CB_TIME_OUT 0xFFFF
  1152. #define GEN_FB_TIME_OUT 2000
  1153. #define SKU_83 0x01
  1154. #define SKU_100 0x02
  1155. #define SKU_100L 0x04
  1156. #define SKU_BYPASS 0x08
  1157. /* Some handy macros for playing with bitfields. */
  1158. #define PSB_MASK(high, low) (((1<<((high)-(low)+1))-1)<<(low))
  1159. #define SET_FIELD(value, field) (((value) << field ## _SHIFT) & field ## _MASK)
  1160. #define GET_FIELD(word, field) (((word) & field ## _MASK) >> field ## _SHIFT)
  1161. #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
  1162. /* PCI config space */
  1163. #define SB_PCKT 0x02100 /* cedarview */
  1164. # define SB_OPCODE_MASK PSB_MASK(31, 16)
  1165. # define SB_OPCODE_SHIFT 16
  1166. # define SB_OPCODE_READ 0
  1167. # define SB_OPCODE_WRITE 1
  1168. # define SB_DEST_MASK PSB_MASK(15, 8)
  1169. # define SB_DEST_SHIFT 8
  1170. # define SB_DEST_DPLL 0x88
  1171. # define SB_BYTE_ENABLE_MASK PSB_MASK(7, 4)
  1172. # define SB_BYTE_ENABLE_SHIFT 4
  1173. # define SB_BUSY (1 << 0)
  1174. #define DSPCLK_GATE_D 0x6200
  1175. # define VRHUNIT_CLOCK_GATE_DISABLE (1 << 28) /* Fixed value on CDV */
  1176. # define DPOUNIT_CLOCK_GATE_DISABLE (1 << 11)
  1177. # define DPIOUNIT_CLOCK_GATE_DISABLE (1 << 6)
  1178. #define RAMCLK_GATE_D 0x6210
  1179. /* 32-bit value read/written from the DPIO reg. */
  1180. #define SB_DATA 0x02104 /* cedarview */
  1181. /* 32-bit address of the DPIO reg to be read/written. */
  1182. #define SB_ADDR 0x02108 /* cedarview */
  1183. #define DPIO_CFG 0x02110 /* cedarview */
  1184. # define DPIO_MODE_SELECT_1 (1 << 3)
  1185. # define DPIO_MODE_SELECT_0 (1 << 2)
  1186. # define DPIO_SFR_BYPASS (1 << 1)
  1187. /* reset is active low */
  1188. # define DPIO_CMN_RESET_N (1 << 0)
  1189. /* Cedarview sideband registers */
  1190. #define _SB_M_A 0x8008
  1191. #define _SB_M_B 0x8028
  1192. #define SB_M(pipe) _PIPE(pipe, _SB_M_A, _SB_M_B)
  1193. # define SB_M_DIVIDER_MASK (0xFF << 24)
  1194. # define SB_M_DIVIDER_SHIFT 24
  1195. #define _SB_N_VCO_A 0x8014
  1196. #define _SB_N_VCO_B 0x8034
  1197. #define SB_N_VCO(pipe) _PIPE(pipe, _SB_N_VCO_A, _SB_N_VCO_B)
  1198. #define SB_N_VCO_SEL_MASK PSB_MASK(31, 30)
  1199. #define SB_N_VCO_SEL_SHIFT 30
  1200. #define SB_N_DIVIDER_MASK PSB_MASK(29, 26)
  1201. #define SB_N_DIVIDER_SHIFT 26
  1202. #define SB_N_CB_TUNE_MASK PSB_MASK(25, 24)
  1203. #define SB_N_CB_TUNE_SHIFT 24
  1204. #define _SB_REF_A 0x8018
  1205. #define _SB_REF_B 0x8038
  1206. #define SB_REF_SFR(pipe) _PIPE(pipe, _SB_REF_A, _SB_REF_B)
  1207. #define _SB_P_A 0x801c
  1208. #define _SB_P_B 0x803c
  1209. #define SB_P(pipe) _PIPE(pipe, _SB_P_A, _SB_P_B)
  1210. #define SB_P2_DIVIDER_MASK PSB_MASK(31, 30)
  1211. #define SB_P2_DIVIDER_SHIFT 30
  1212. #define SB_P2_10 0 /* HDMI, DP, DAC */
  1213. #define SB_P2_5 1 /* DAC */
  1214. #define SB_P2_14 2 /* LVDS single */
  1215. #define SB_P2_7 3 /* LVDS double */
  1216. #define SB_P1_DIVIDER_MASK PSB_MASK(15, 12)
  1217. #define SB_P1_DIVIDER_SHIFT 12
  1218. #define PSB_LANE0 0x120
  1219. #define PSB_LANE1 0x220
  1220. #define PSB_LANE2 0x2320
  1221. #define PSB_LANE3 0x2420
  1222. #define LANE_PLL_MASK (0x7 << 20)
  1223. #define LANE_PLL_ENABLE (0x3 << 20)
  1224. #endif