intel_vbt_defs.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  1. /*
  2. * Copyright © 2006-2016 Intel Corporation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. *
  23. * Authors:
  24. * Eric Anholt <eric@anholt.net>
  25. *
  26. */
  27. /*
  28. * This information is private to VBT parsing in intel_bios.c.
  29. *
  30. * Please do NOT include anywhere else.
  31. */
  32. #ifndef _INTEL_BIOS_PRIVATE
  33. #error "intel_vbt_defs.h is private to intel_bios.c"
  34. #endif
  35. #ifndef _INTEL_VBT_DEFS_H_
  36. #define _INTEL_VBT_DEFS_H_
  37. #include "intel_bios.h"
  38. /**
  39. * struct vbt_header - VBT Header structure
  40. * @signature: VBT signature, always starts with "$VBT"
  41. * @version: Version of this structure
  42. * @header_size: Size of this structure
  43. * @vbt_size: Size of VBT (VBT Header, BDB Header and data blocks)
  44. * @vbt_checksum: Checksum
  45. * @reserved0: Reserved
  46. * @bdb_offset: Offset of &struct bdb_header from beginning of VBT
  47. * @aim_offset: Offsets of add-in data blocks from beginning of VBT
  48. */
  49. struct vbt_header {
  50. u8 signature[20];
  51. u16 version;
  52. u16 header_size;
  53. u16 vbt_size;
  54. u8 vbt_checksum;
  55. u8 reserved0;
  56. u32 bdb_offset;
  57. u32 aim_offset[4];
  58. } __packed;
  59. /**
  60. * struct bdb_header - BDB Header structure
  61. * @signature: BDB signature "BIOS_DATA_BLOCK"
  62. * @version: Version of the data block definitions
  63. * @header_size: Size of this structure
  64. * @bdb_size: Size of BDB (BDB Header and data blocks)
  65. */
  66. struct bdb_header {
  67. u8 signature[16];
  68. u16 version;
  69. u16 header_size;
  70. u16 bdb_size;
  71. } __packed;
  72. /* strictly speaking, this is a "skip" block, but it has interesting info */
  73. struct vbios_data {
  74. u8 type; /* 0 == desktop, 1 == mobile */
  75. u8 relstage;
  76. u8 chipset;
  77. u8 lvds_present:1;
  78. u8 tv_present:1;
  79. u8 rsvd2:6; /* finish byte */
  80. u8 rsvd3[4];
  81. u8 signon[155];
  82. u8 copyright[61];
  83. u16 code_segment;
  84. u8 dos_boot_mode;
  85. u8 bandwidth_percent;
  86. u8 rsvd4; /* popup memory size */
  87. u8 resize_pci_bios;
  88. u8 rsvd5; /* is crt already on ddc2 */
  89. } __packed;
  90. /*
  91. * There are several types of BIOS data blocks (BDBs), each block has
  92. * an ID and size in the first 3 bytes (ID in first, size in next 2).
  93. * Known types are listed below.
  94. */
  95. #define BDB_GENERAL_FEATURES 1
  96. #define BDB_GENERAL_DEFINITIONS 2
  97. #define BDB_OLD_TOGGLE_LIST 3
  98. #define BDB_MODE_SUPPORT_LIST 4
  99. #define BDB_GENERIC_MODE_TABLE 5
  100. #define BDB_EXT_MMIO_REGS 6
  101. #define BDB_SWF_IO 7
  102. #define BDB_SWF_MMIO 8
  103. #define BDB_PSR 9
  104. #define BDB_MODE_REMOVAL_TABLE 10
  105. #define BDB_CHILD_DEVICE_TABLE 11
  106. #define BDB_DRIVER_FEATURES 12
  107. #define BDB_DRIVER_PERSISTENCE 13
  108. #define BDB_EXT_TABLE_PTRS 14
  109. #define BDB_DOT_CLOCK_OVERRIDE 15
  110. #define BDB_DISPLAY_SELECT 16
  111. /* 17 rsvd */
  112. #define BDB_DRIVER_ROTATION 18
  113. #define BDB_DISPLAY_REMOVE 19
  114. #define BDB_OEM_CUSTOM 20
  115. #define BDB_EFP_LIST 21 /* workarounds for VGA hsync/vsync */
  116. #define BDB_SDVO_LVDS_OPTIONS 22
  117. #define BDB_SDVO_PANEL_DTDS 23
  118. #define BDB_SDVO_LVDS_PNP_IDS 24
  119. #define BDB_SDVO_LVDS_POWER_SEQ 25
  120. #define BDB_TV_OPTIONS 26
  121. #define BDB_EDP 27
  122. #define BDB_LVDS_OPTIONS 40
  123. #define BDB_LVDS_LFP_DATA_PTRS 41
  124. #define BDB_LVDS_LFP_DATA 42
  125. #define BDB_LVDS_BACKLIGHT 43
  126. #define BDB_LVDS_POWER 44
  127. #define BDB_MIPI_CONFIG 52
  128. #define BDB_MIPI_SEQUENCE 53
  129. #define BDB_SKIP 254 /* VBIOS private block, ignore */
  130. struct bdb_general_features {
  131. /* bits 1 */
  132. u8 panel_fitting:2;
  133. u8 flexaim:1;
  134. u8 msg_enable:1;
  135. u8 clear_screen:3;
  136. u8 color_flip:1;
  137. /* bits 2 */
  138. u8 download_ext_vbt:1;
  139. u8 enable_ssc:1;
  140. u8 ssc_freq:1;
  141. u8 enable_lfp_on_override:1;
  142. u8 disable_ssc_ddt:1;
  143. u8 underscan_vga_timings:1;
  144. u8 display_clock_mode:1;
  145. u8 vbios_hotplug_support:1;
  146. /* bits 3 */
  147. u8 disable_smooth_vision:1;
  148. u8 single_dvi:1;
  149. u8 rotate_180:1; /* 181 */
  150. u8 fdi_rx_polarity_inverted:1;
  151. u8 vbios_extended_mode:1; /* 160 */
  152. u8 copy_ilfp_dtd_to_sdvo_lvds_dtd:1; /* 160 */
  153. u8 panel_best_fit_timing:1; /* 160 */
  154. u8 ignore_strap_state:1; /* 160 */
  155. /* bits 4 */
  156. u8 legacy_monitor_detect;
  157. /* bits 5 */
  158. u8 int_crt_support:1;
  159. u8 int_tv_support:1;
  160. u8 int_efp_support:1;
  161. u8 dp_ssc_enable:1; /* PCH attached eDP supports SSC */
  162. u8 dp_ssc_freq:1; /* SSC freq for PCH attached eDP */
  163. u8 dp_ssc_dongle_supported:1;
  164. u8 rsvd11:2; /* finish byte */
  165. } __packed;
  166. /* pre-915 */
  167. #define GPIO_PIN_DVI_LVDS 0x03 /* "DVI/LVDS DDC GPIO pins" */
  168. #define GPIO_PIN_ADD_I2C 0x05 /* "ADDCARD I2C GPIO pins" */
  169. #define GPIO_PIN_ADD_DDC 0x04 /* "ADDCARD DDC GPIO pins" */
  170. #define GPIO_PIN_ADD_DDC_I2C 0x06 /* "ADDCARD DDC/I2C GPIO pins" */
  171. /* Pre 915 */
  172. #define DEVICE_TYPE_NONE 0x00
  173. #define DEVICE_TYPE_CRT 0x01
  174. #define DEVICE_TYPE_TV 0x09
  175. #define DEVICE_TYPE_EFP 0x12
  176. #define DEVICE_TYPE_LFP 0x22
  177. /* On 915+ */
  178. #define DEVICE_TYPE_CRT_DPMS 0x6001
  179. #define DEVICE_TYPE_CRT_DPMS_HOTPLUG 0x4001
  180. #define DEVICE_TYPE_TV_COMPOSITE 0x0209
  181. #define DEVICE_TYPE_TV_MACROVISION 0x0289
  182. #define DEVICE_TYPE_TV_RF_COMPOSITE 0x020c
  183. #define DEVICE_TYPE_TV_SVIDEO_COMPOSITE 0x0609
  184. #define DEVICE_TYPE_TV_SCART 0x0209
  185. #define DEVICE_TYPE_TV_CODEC_HOTPLUG_PWR 0x6009
  186. #define DEVICE_TYPE_EFP_HOTPLUG_PWR 0x6012
  187. #define DEVICE_TYPE_EFP_DVI_HOTPLUG_PWR 0x6052
  188. #define DEVICE_TYPE_EFP_DVI_I 0x6053
  189. #define DEVICE_TYPE_EFP_DVI_D_DUAL 0x6152
  190. #define DEVICE_TYPE_EFP_DVI_D_HDCP 0x60d2
  191. #define DEVICE_TYPE_OPENLDI_HOTPLUG_PWR 0x6062
  192. #define DEVICE_TYPE_OPENLDI_DUALPIX 0x6162
  193. #define DEVICE_TYPE_LFP_PANELLINK 0x5012
  194. #define DEVICE_TYPE_LFP_CMOS_PWR 0x5042
  195. #define DEVICE_TYPE_LFP_LVDS_PWR 0x5062
  196. #define DEVICE_TYPE_LFP_LVDS_DUAL 0x5162
  197. #define DEVICE_TYPE_LFP_LVDS_DUAL_HDCP 0x51e2
  198. /* Add the device class for LFP, TV, HDMI */
  199. #define DEVICE_TYPE_INT_LFP 0x1022
  200. #define DEVICE_TYPE_INT_TV 0x1009
  201. #define DEVICE_TYPE_HDMI 0x60D2
  202. #define DEVICE_TYPE_DP 0x68C6
  203. #define DEVICE_TYPE_DP_DUAL_MODE 0x60D6
  204. #define DEVICE_TYPE_eDP 0x78C6
  205. #define DEVICE_TYPE_CLASS_EXTENSION (1 << 15)
  206. #define DEVICE_TYPE_POWER_MANAGEMENT (1 << 14)
  207. #define DEVICE_TYPE_HOTPLUG_SIGNALING (1 << 13)
  208. #define DEVICE_TYPE_INTERNAL_CONNECTOR (1 << 12)
  209. #define DEVICE_TYPE_NOT_HDMI_OUTPUT (1 << 11)
  210. #define DEVICE_TYPE_MIPI_OUTPUT (1 << 10)
  211. #define DEVICE_TYPE_COMPOSITE_OUTPUT (1 << 9)
  212. #define DEVICE_TYPE_DUAL_CHANNEL (1 << 8)
  213. #define DEVICE_TYPE_HIGH_SPEED_LINK (1 << 6)
  214. #define DEVICE_TYPE_LVDS_SIGNALING (1 << 5)
  215. #define DEVICE_TYPE_TMDS_DVI_SIGNALING (1 << 4)
  216. #define DEVICE_TYPE_VIDEO_SIGNALING (1 << 3)
  217. #define DEVICE_TYPE_DISPLAYPORT_OUTPUT (1 << 2)
  218. #define DEVICE_TYPE_DIGITAL_OUTPUT (1 << 1)
  219. #define DEVICE_TYPE_ANALOG_OUTPUT (1 << 0)
  220. /*
  221. * Bits we care about when checking for DEVICE_TYPE_eDP. Depending on the
  222. * system, the other bits may or may not be set for eDP outputs.
  223. */
  224. #define DEVICE_TYPE_eDP_BITS \
  225. (DEVICE_TYPE_INTERNAL_CONNECTOR | \
  226. DEVICE_TYPE_MIPI_OUTPUT | \
  227. DEVICE_TYPE_COMPOSITE_OUTPUT | \
  228. DEVICE_TYPE_DUAL_CHANNEL | \
  229. DEVICE_TYPE_LVDS_SIGNALING | \
  230. DEVICE_TYPE_TMDS_DVI_SIGNALING | \
  231. DEVICE_TYPE_VIDEO_SIGNALING | \
  232. DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
  233. DEVICE_TYPE_ANALOG_OUTPUT)
  234. #define DEVICE_TYPE_DP_DUAL_MODE_BITS \
  235. (DEVICE_TYPE_INTERNAL_CONNECTOR | \
  236. DEVICE_TYPE_MIPI_OUTPUT | \
  237. DEVICE_TYPE_COMPOSITE_OUTPUT | \
  238. DEVICE_TYPE_LVDS_SIGNALING | \
  239. DEVICE_TYPE_TMDS_DVI_SIGNALING | \
  240. DEVICE_TYPE_VIDEO_SIGNALING | \
  241. DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
  242. DEVICE_TYPE_DIGITAL_OUTPUT | \
  243. DEVICE_TYPE_ANALOG_OUTPUT)
  244. #define DEVICE_CFG_NONE 0x00
  245. #define DEVICE_CFG_12BIT_DVOB 0x01
  246. #define DEVICE_CFG_12BIT_DVOC 0x02
  247. #define DEVICE_CFG_24BIT_DVOBC 0x09
  248. #define DEVICE_CFG_24BIT_DVOCB 0x0a
  249. #define DEVICE_CFG_DUAL_DVOB 0x11
  250. #define DEVICE_CFG_DUAL_DVOC 0x12
  251. #define DEVICE_CFG_DUAL_DVOBC 0x13
  252. #define DEVICE_CFG_DUAL_LINK_DVOBC 0x19
  253. #define DEVICE_CFG_DUAL_LINK_DVOCB 0x1a
  254. #define DEVICE_WIRE_NONE 0x00
  255. #define DEVICE_WIRE_DVOB 0x01
  256. #define DEVICE_WIRE_DVOC 0x02
  257. #define DEVICE_WIRE_DVOBC 0x03
  258. #define DEVICE_WIRE_DVOBB 0x05
  259. #define DEVICE_WIRE_DVOCC 0x06
  260. #define DEVICE_WIRE_DVOB_MASTER 0x0d
  261. #define DEVICE_WIRE_DVOC_MASTER 0x0e
  262. /* dvo_port pre BDB 155 */
  263. #define DEVICE_PORT_DVOA 0x00 /* none on 845+ */
  264. #define DEVICE_PORT_DVOB 0x01
  265. #define DEVICE_PORT_DVOC 0x02
  266. /* dvo_port BDB 155+ */
  267. #define DVO_PORT_HDMIA 0
  268. #define DVO_PORT_HDMIB 1
  269. #define DVO_PORT_HDMIC 2
  270. #define DVO_PORT_HDMID 3
  271. #define DVO_PORT_LVDS 4
  272. #define DVO_PORT_TV 5
  273. #define DVO_PORT_CRT 6
  274. #define DVO_PORT_DPB 7
  275. #define DVO_PORT_DPC 8
  276. #define DVO_PORT_DPD 9
  277. #define DVO_PORT_DPA 10
  278. #define DVO_PORT_DPE 11 /* 193 */
  279. #define DVO_PORT_HDMIE 12 /* 193 */
  280. #define DVO_PORT_DPF 13 /* N/A */
  281. #define DVO_PORT_HDMIF 14 /* N/A */
  282. #define DVO_PORT_MIPIA 21 /* 171 */
  283. #define DVO_PORT_MIPIB 22 /* 171 */
  284. #define DVO_PORT_MIPIC 23 /* 171 */
  285. #define DVO_PORT_MIPID 24 /* 171 */
  286. #define HDMI_MAX_DATA_RATE_PLATFORM 0 /* 204 */
  287. #define HDMI_MAX_DATA_RATE_297 1 /* 204 */
  288. #define HDMI_MAX_DATA_RATE_165 2 /* 204 */
  289. #define LEGACY_CHILD_DEVICE_CONFIG_SIZE 33
  290. /* DDC Bus DDI Type 155+ */
  291. enum vbt_gmbus_ddi {
  292. DDC_BUS_DDI_B = 0x1,
  293. DDC_BUS_DDI_C,
  294. DDC_BUS_DDI_D,
  295. DDC_BUS_DDI_F,
  296. };
  297. #define VBT_DP_MAX_LINK_RATE_HBR3 0
  298. #define VBT_DP_MAX_LINK_RATE_HBR2 1
  299. #define VBT_DP_MAX_LINK_RATE_HBR 2
  300. #define VBT_DP_MAX_LINK_RATE_LBR 3
  301. /*
  302. * The child device config, aka the display device data structure, provides a
  303. * description of a port and its configuration on the platform.
  304. *
  305. * The child device config size has been increased, and fields have been added
  306. * and their meaning has changed over time. Care must be taken when accessing
  307. * basically any of the fields to ensure the correct interpretation for the BDB
  308. * version in question.
  309. *
  310. * When we copy the child device configs to dev_priv->vbt.child_dev, we reserve
  311. * space for the full structure below, and initialize the tail not actually
  312. * present in VBT to zeros. Accessing those fields is fine, as long as the
  313. * default zero is taken into account, again according to the BDB version.
  314. *
  315. * BDB versions 155 and below are considered legacy, and version 155 seems to be
  316. * a baseline for some of the VBT documentation. When adding new fields, please
  317. * include the BDB version when the field was added, if it's above that.
  318. */
  319. struct child_device_config {
  320. u16 handle;
  321. u16 device_type; /* See DEVICE_TYPE_* above */
  322. union {
  323. u8 device_id[10]; /* ascii string */
  324. struct {
  325. u8 i2c_speed;
  326. u8 dp_onboard_redriver; /* 158 */
  327. u8 dp_ondock_redriver; /* 158 */
  328. u8 hdmi_level_shifter_value:5; /* 169 */
  329. u8 hdmi_max_data_rate:3; /* 204 */
  330. u16 dtd_buf_ptr; /* 161 */
  331. u8 edidless_efp:1; /* 161 */
  332. u8 compression_enable:1; /* 198 */
  333. u8 compression_method:1; /* 198 */
  334. u8 ganged_edp:1; /* 202 */
  335. u8 reserved0:4;
  336. u8 compression_structure_index:4; /* 198 */
  337. u8 reserved1:4;
  338. u8 slave_port; /* 202 */
  339. u8 reserved2;
  340. } __packed;
  341. } __packed;
  342. u16 addin_offset;
  343. u8 dvo_port; /* See DEVICE_PORT_* and DVO_PORT_* above */
  344. u8 i2c_pin;
  345. u8 slave_addr;
  346. u8 ddc_pin;
  347. u16 edid_ptr;
  348. u8 dvo_cfg; /* See DEVICE_CFG_* above */
  349. union {
  350. struct {
  351. u8 dvo2_port;
  352. u8 i2c2_pin;
  353. u8 slave2_addr;
  354. u8 ddc2_pin;
  355. } __packed;
  356. struct {
  357. u8 efp_routed:1; /* 158 */
  358. u8 lane_reversal:1; /* 184 */
  359. u8 lspcon:1; /* 192 */
  360. u8 iboost:1; /* 196 */
  361. u8 hpd_invert:1; /* 196 */
  362. u8 flag_reserved:3;
  363. u8 hdmi_support:1; /* 158 */
  364. u8 dp_support:1; /* 158 */
  365. u8 tmds_support:1; /* 158 */
  366. u8 support_reserved:5;
  367. u8 aux_channel;
  368. u8 dongle_detect;
  369. } __packed;
  370. } __packed;
  371. u8 pipe_cap:2;
  372. u8 sdvo_stall:1; /* 158 */
  373. u8 hpd_status:2;
  374. u8 integrated_encoder:1;
  375. u8 capabilities_reserved:2;
  376. u8 dvo_wiring; /* See DEVICE_WIRE_* above */
  377. union {
  378. u8 dvo2_wiring;
  379. u8 mipi_bridge_type; /* 171 */
  380. } __packed;
  381. u16 extended_type;
  382. u8 dvo_function;
  383. u8 dp_usb_type_c:1; /* 195 */
  384. u8 flags2_reserved:7; /* 195 */
  385. u8 dp_gpio_index; /* 195 */
  386. u16 dp_gpio_pin_num; /* 195 */
  387. u8 dp_iboost_level:4; /* 196 */
  388. u8 hdmi_iboost_level:4; /* 196 */
  389. u8 dp_max_link_rate:2; /* 216 CNL+ */
  390. u8 dp_max_link_rate_reserved:6; /* 216 */
  391. } __packed;
  392. struct bdb_general_definitions {
  393. /* DDC GPIO */
  394. u8 crt_ddc_gmbus_pin;
  395. /* DPMS bits */
  396. u8 dpms_acpi:1;
  397. u8 skip_boot_crt_detect:1;
  398. u8 dpms_aim:1;
  399. u8 rsvd1:5; /* finish byte */
  400. /* boot device bits */
  401. u8 boot_display[2];
  402. u8 child_dev_size;
  403. /*
  404. * Device info:
  405. * If TV is present, it'll be at devices[0].
  406. * LVDS will be next, either devices[0] or [1], if present.
  407. * On some platforms the number of device is 6. But could be as few as
  408. * 4 if both TV and LVDS are missing.
  409. * And the device num is related with the size of general definition
  410. * block. It is obtained by using the following formula:
  411. * number = (block_size - sizeof(bdb_general_definitions))/
  412. * defs->child_dev_size;
  413. */
  414. uint8_t devices[0];
  415. } __packed;
  416. /* Mask for DRRS / Panel Channel / SSC / BLT control bits extraction */
  417. #define MODE_MASK 0x3
  418. struct bdb_lvds_options {
  419. u8 panel_type;
  420. u8 rsvd1;
  421. /* LVDS capabilities, stored in a dword */
  422. u8 pfit_mode:2;
  423. u8 pfit_text_mode_enhanced:1;
  424. u8 pfit_gfx_mode_enhanced:1;
  425. u8 pfit_ratio_auto:1;
  426. u8 pixel_dither:1;
  427. u8 lvds_edid:1;
  428. u8 rsvd2:1;
  429. u8 rsvd4;
  430. /* LVDS Panel channel bits stored here */
  431. u32 lvds_panel_channel_bits;
  432. /* LVDS SSC (Spread Spectrum Clock) bits stored here. */
  433. u16 ssc_bits;
  434. u16 ssc_freq;
  435. u16 ssc_ddt;
  436. /* Panel color depth defined here */
  437. u16 panel_color_depth;
  438. /* LVDS panel type bits stored here */
  439. u32 dps_panel_type_bits;
  440. /* LVDS backlight control type bits stored here */
  441. u32 blt_control_type_bits;
  442. } __packed;
  443. /* LFP pointer table contains entries to the struct below */
  444. struct bdb_lvds_lfp_data_ptr {
  445. u16 fp_timing_offset; /* offsets are from start of bdb */
  446. u8 fp_table_size;
  447. u16 dvo_timing_offset;
  448. u8 dvo_table_size;
  449. u16 panel_pnp_id_offset;
  450. u8 pnp_table_size;
  451. } __packed;
  452. struct bdb_lvds_lfp_data_ptrs {
  453. u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
  454. struct bdb_lvds_lfp_data_ptr ptr[16];
  455. } __packed;
  456. /* LFP data has 3 blocks per entry */
  457. struct lvds_fp_timing {
  458. u16 x_res;
  459. u16 y_res;
  460. u32 lvds_reg;
  461. u32 lvds_reg_val;
  462. u32 pp_on_reg;
  463. u32 pp_on_reg_val;
  464. u32 pp_off_reg;
  465. u32 pp_off_reg_val;
  466. u32 pp_cycle_reg;
  467. u32 pp_cycle_reg_val;
  468. u32 pfit_reg;
  469. u32 pfit_reg_val;
  470. u16 terminator;
  471. } __packed;
  472. struct lvds_dvo_timing {
  473. u16 clock; /**< In 10khz */
  474. u8 hactive_lo;
  475. u8 hblank_lo;
  476. u8 hblank_hi:4;
  477. u8 hactive_hi:4;
  478. u8 vactive_lo;
  479. u8 vblank_lo;
  480. u8 vblank_hi:4;
  481. u8 vactive_hi:4;
  482. u8 hsync_off_lo;
  483. u8 hsync_pulse_width_lo;
  484. u8 vsync_pulse_width_lo:4;
  485. u8 vsync_off_lo:4;
  486. u8 vsync_pulse_width_hi:2;
  487. u8 vsync_off_hi:2;
  488. u8 hsync_pulse_width_hi:2;
  489. u8 hsync_off_hi:2;
  490. u8 himage_lo;
  491. u8 vimage_lo;
  492. u8 vimage_hi:4;
  493. u8 himage_hi:4;
  494. u8 h_border;
  495. u8 v_border;
  496. u8 rsvd1:3;
  497. u8 digital:2;
  498. u8 vsync_positive:1;
  499. u8 hsync_positive:1;
  500. u8 non_interlaced:1;
  501. } __packed;
  502. struct lvds_pnp_id {
  503. u16 mfg_name;
  504. u16 product_code;
  505. u32 serial;
  506. u8 mfg_week;
  507. u8 mfg_year;
  508. } __packed;
  509. struct bdb_lvds_lfp_data_entry {
  510. struct lvds_fp_timing fp_timing;
  511. struct lvds_dvo_timing dvo_timing;
  512. struct lvds_pnp_id pnp_id;
  513. } __packed;
  514. struct bdb_lvds_lfp_data {
  515. struct bdb_lvds_lfp_data_entry data[16];
  516. } __packed;
  517. #define BDB_BACKLIGHT_TYPE_NONE 0
  518. #define BDB_BACKLIGHT_TYPE_PWM 2
  519. struct bdb_lfp_backlight_data_entry {
  520. u8 type:2;
  521. u8 active_low_pwm:1;
  522. u8 obsolete1:5;
  523. u16 pwm_freq_hz;
  524. u8 min_brightness;
  525. u8 obsolete2;
  526. u8 obsolete3;
  527. } __packed;
  528. struct bdb_lfp_backlight_control_method {
  529. u8 type:4;
  530. u8 controller:4;
  531. } __packed;
  532. struct bdb_lfp_backlight_data {
  533. u8 entry_size;
  534. struct bdb_lfp_backlight_data_entry data[16];
  535. u8 level[16];
  536. struct bdb_lfp_backlight_control_method backlight_control[16];
  537. } __packed;
  538. struct aimdb_header {
  539. char signature[16];
  540. char oem_device[20];
  541. u16 aimdb_version;
  542. u16 aimdb_header_size;
  543. u16 aimdb_size;
  544. } __packed;
  545. struct aimdb_block {
  546. u8 aimdb_id;
  547. u16 aimdb_size;
  548. } __packed;
  549. struct vch_panel_data {
  550. u16 fp_timing_offset;
  551. u8 fp_timing_size;
  552. u16 dvo_timing_offset;
  553. u8 dvo_timing_size;
  554. u16 text_fitting_offset;
  555. u8 text_fitting_size;
  556. u16 graphics_fitting_offset;
  557. u8 graphics_fitting_size;
  558. } __packed;
  559. struct vch_bdb_22 {
  560. struct aimdb_block aimdb_block;
  561. struct vch_panel_data panels[16];
  562. } __packed;
  563. struct bdb_sdvo_lvds_options {
  564. u8 panel_backlight;
  565. u8 h40_set_panel_type;
  566. u8 panel_type;
  567. u8 ssc_clk_freq;
  568. u16 als_low_trip;
  569. u16 als_high_trip;
  570. u8 sclalarcoeff_tab_row_num;
  571. u8 sclalarcoeff_tab_row_size;
  572. u8 coefficient[8];
  573. u8 panel_misc_bits_1;
  574. u8 panel_misc_bits_2;
  575. u8 panel_misc_bits_3;
  576. u8 panel_misc_bits_4;
  577. } __packed;
  578. #define BDB_DRIVER_FEATURE_NO_LVDS 0
  579. #define BDB_DRIVER_FEATURE_INT_LVDS 1
  580. #define BDB_DRIVER_FEATURE_SDVO_LVDS 2
  581. #define BDB_DRIVER_FEATURE_EDP 3
  582. struct bdb_driver_features {
  583. u8 boot_dev_algorithm:1;
  584. u8 block_display_switch:1;
  585. u8 allow_display_switch:1;
  586. u8 hotplug_dvo:1;
  587. u8 dual_view_zoom:1;
  588. u8 int15h_hook:1;
  589. u8 sprite_in_clone:1;
  590. u8 primary_lfp_id:1;
  591. u16 boot_mode_x;
  592. u16 boot_mode_y;
  593. u8 boot_mode_bpp;
  594. u8 boot_mode_refresh;
  595. u16 enable_lfp_primary:1;
  596. u16 selective_mode_pruning:1;
  597. u16 dual_frequency:1;
  598. u16 render_clock_freq:1; /* 0: high freq; 1: low freq */
  599. u16 nt_clone_support:1;
  600. u16 power_scheme_ui:1; /* 0: CUI; 1: 3rd party */
  601. u16 sprite_display_assign:1; /* 0: secondary; 1: primary */
  602. u16 cui_aspect_scaling:1;
  603. u16 preserve_aspect_ratio:1;
  604. u16 sdvo_device_power_down:1;
  605. u16 crt_hotplug:1;
  606. u16 lvds_config:2;
  607. u16 tv_hotplug:1;
  608. u16 hdmi_config:2;
  609. u8 static_display:1;
  610. u8 reserved2:7;
  611. u16 legacy_crt_max_x;
  612. u16 legacy_crt_max_y;
  613. u8 legacy_crt_max_refresh;
  614. u8 hdmi_termination;
  615. u8 custom_vbt_version;
  616. /* Driver features data block */
  617. u16 rmpm_enabled:1;
  618. u16 s2ddt_enabled:1;
  619. u16 dpst_enabled:1;
  620. u16 bltclt_enabled:1;
  621. u16 adb_enabled:1;
  622. u16 drrs_enabled:1;
  623. u16 grs_enabled:1;
  624. u16 gpmt_enabled:1;
  625. u16 tbt_enabled:1;
  626. u16 psr_enabled:1;
  627. u16 ips_enabled:1;
  628. u16 reserved3:4;
  629. u16 pc_feature_valid:1;
  630. } __packed;
  631. #define EDP_18BPP 0
  632. #define EDP_24BPP 1
  633. #define EDP_30BPP 2
  634. #define EDP_RATE_1_62 0
  635. #define EDP_RATE_2_7 1
  636. #define EDP_LANE_1 0
  637. #define EDP_LANE_2 1
  638. #define EDP_LANE_4 3
  639. #define EDP_PREEMPHASIS_NONE 0
  640. #define EDP_PREEMPHASIS_3_5dB 1
  641. #define EDP_PREEMPHASIS_6dB 2
  642. #define EDP_PREEMPHASIS_9_5dB 3
  643. #define EDP_VSWING_0_4V 0
  644. #define EDP_VSWING_0_6V 1
  645. #define EDP_VSWING_0_8V 2
  646. #define EDP_VSWING_1_2V 3
  647. struct edp_fast_link_params {
  648. u8 rate:4;
  649. u8 lanes:4;
  650. u8 preemphasis:4;
  651. u8 vswing:4;
  652. } __packed;
  653. struct edp_pwm_delays {
  654. u16 pwm_on_to_backlight_enable;
  655. u16 backlight_disable_to_pwm_off;
  656. } __packed;
  657. struct edp_full_link_params {
  658. u8 preemphasis:4;
  659. u8 vswing:4;
  660. } __packed;
  661. struct bdb_edp {
  662. struct edp_power_seq power_seqs[16];
  663. u32 color_depth;
  664. struct edp_fast_link_params fast_link_params[16];
  665. u32 sdrrs_msa_timing_delay;
  666. /* ith bit indicates enabled/disabled for (i+1)th panel */
  667. u16 edp_s3d_feature; /* 162 */
  668. u16 edp_t3_optimization; /* 165 */
  669. u64 edp_vswing_preemph; /* 173 */
  670. u16 fast_link_training; /* 182 */
  671. u16 dpcd_600h_write_required; /* 185 */
  672. struct edp_pwm_delays pwm_delays[16]; /* 186 */
  673. u16 full_link_params_provided; /* 199 */
  674. struct edp_full_link_params full_link_params[16]; /* 199 */
  675. } __packed;
  676. struct psr_table {
  677. /* Feature bits */
  678. u8 full_link:1;
  679. u8 require_aux_to_wakeup:1;
  680. u8 feature_bits_rsvd:6;
  681. /* Wait times */
  682. u8 idle_frames:4;
  683. u8 lines_to_wait:3;
  684. u8 wait_times_rsvd:1;
  685. /* TP wake up time in multiple of 100 */
  686. u16 tp1_wakeup_time;
  687. u16 tp2_tp3_wakeup_time;
  688. } __packed;
  689. struct bdb_psr {
  690. struct psr_table psr_table[16];
  691. } __packed;
  692. /*
  693. * Driver<->VBIOS interaction occurs through scratch bits in
  694. * GR18 & SWF*.
  695. */
  696. /* GR18 bits are set on display switch and hotkey events */
  697. #define GR18_DRIVER_SWITCH_EN (1<<7) /* 0: VBIOS control, 1: driver control */
  698. #define GR18_HOTKEY_MASK 0x78 /* See also SWF4 15:0 */
  699. #define GR18_HK_NONE (0x0<<3)
  700. #define GR18_HK_LFP_STRETCH (0x1<<3)
  701. #define GR18_HK_TOGGLE_DISP (0x2<<3)
  702. #define GR18_HK_DISP_SWITCH (0x4<<3) /* see SWF14 15:0 for what to enable */
  703. #define GR18_HK_POPUP_DISABLED (0x6<<3)
  704. #define GR18_HK_POPUP_ENABLED (0x7<<3)
  705. #define GR18_HK_PFIT (0x8<<3)
  706. #define GR18_HK_APM_CHANGE (0xa<<3)
  707. #define GR18_HK_MULTIPLE (0xc<<3)
  708. #define GR18_USER_INT_EN (1<<2)
  709. #define GR18_A0000_FLUSH_EN (1<<1)
  710. #define GR18_SMM_EN (1<<0)
  711. /* Set by driver, cleared by VBIOS */
  712. #define SWF00_YRES_SHIFT 16
  713. #define SWF00_XRES_SHIFT 0
  714. #define SWF00_RES_MASK 0xffff
  715. /* Set by VBIOS at boot time and driver at runtime */
  716. #define SWF01_TV2_FORMAT_SHIFT 8
  717. #define SWF01_TV1_FORMAT_SHIFT 0
  718. #define SWF01_TV_FORMAT_MASK 0xffff
  719. #define SWF10_VBIOS_BLC_I2C_EN (1<<29)
  720. #define SWF10_GTT_OVERRIDE_EN (1<<28)
  721. #define SWF10_LFP_DPMS_OVR (1<<27) /* override DPMS on display switch */
  722. #define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
  723. #define SWF10_OLD_TOGGLE 0x0
  724. #define SWF10_TOGGLE_LIST_1 0x1
  725. #define SWF10_TOGGLE_LIST_2 0x2
  726. #define SWF10_TOGGLE_LIST_3 0x3
  727. #define SWF10_TOGGLE_LIST_4 0x4
  728. #define SWF10_PANNING_EN (1<<23)
  729. #define SWF10_DRIVER_LOADED (1<<22)
  730. #define SWF10_EXTENDED_DESKTOP (1<<21)
  731. #define SWF10_EXCLUSIVE_MODE (1<<20)
  732. #define SWF10_OVERLAY_EN (1<<19)
  733. #define SWF10_PLANEB_HOLDOFF (1<<18)
  734. #define SWF10_PLANEA_HOLDOFF (1<<17)
  735. #define SWF10_VGA_HOLDOFF (1<<16)
  736. #define SWF10_ACTIVE_DISP_MASK 0xffff
  737. #define SWF10_PIPEB_LFP2 (1<<15)
  738. #define SWF10_PIPEB_EFP2 (1<<14)
  739. #define SWF10_PIPEB_TV2 (1<<13)
  740. #define SWF10_PIPEB_CRT2 (1<<12)
  741. #define SWF10_PIPEB_LFP (1<<11)
  742. #define SWF10_PIPEB_EFP (1<<10)
  743. #define SWF10_PIPEB_TV (1<<9)
  744. #define SWF10_PIPEB_CRT (1<<8)
  745. #define SWF10_PIPEA_LFP2 (1<<7)
  746. #define SWF10_PIPEA_EFP2 (1<<6)
  747. #define SWF10_PIPEA_TV2 (1<<5)
  748. #define SWF10_PIPEA_CRT2 (1<<4)
  749. #define SWF10_PIPEA_LFP (1<<3)
  750. #define SWF10_PIPEA_EFP (1<<2)
  751. #define SWF10_PIPEA_TV (1<<1)
  752. #define SWF10_PIPEA_CRT (1<<0)
  753. #define SWF11_MEMORY_SIZE_SHIFT 16
  754. #define SWF11_SV_TEST_EN (1<<15)
  755. #define SWF11_IS_AGP (1<<14)
  756. #define SWF11_DISPLAY_HOLDOFF (1<<13)
  757. #define SWF11_DPMS_REDUCED (1<<12)
  758. #define SWF11_IS_VBE_MODE (1<<11)
  759. #define SWF11_PIPEB_ACCESS (1<<10) /* 0 here means pipe a */
  760. #define SWF11_DPMS_MASK 0x07
  761. #define SWF11_DPMS_OFF (1<<2)
  762. #define SWF11_DPMS_SUSPEND (1<<1)
  763. #define SWF11_DPMS_STANDBY (1<<0)
  764. #define SWF11_DPMS_ON 0
  765. #define SWF14_GFX_PFIT_EN (1<<31)
  766. #define SWF14_TEXT_PFIT_EN (1<<30)
  767. #define SWF14_LID_STATUS_CLOSED (1<<29) /* 0 here means open */
  768. #define SWF14_POPUP_EN (1<<28)
  769. #define SWF14_DISPLAY_HOLDOFF (1<<27)
  770. #define SWF14_DISP_DETECT_EN (1<<26)
  771. #define SWF14_DOCKING_STATUS_DOCKED (1<<25) /* 0 here means undocked */
  772. #define SWF14_DRIVER_STATUS (1<<24)
  773. #define SWF14_OS_TYPE_WIN9X (1<<23)
  774. #define SWF14_OS_TYPE_WINNT (1<<22)
  775. /* 21:19 rsvd */
  776. #define SWF14_PM_TYPE_MASK 0x00070000
  777. #define SWF14_PM_ACPI_VIDEO (0x4 << 16)
  778. #define SWF14_PM_ACPI (0x3 << 16)
  779. #define SWF14_PM_APM_12 (0x2 << 16)
  780. #define SWF14_PM_APM_11 (0x1 << 16)
  781. #define SWF14_HK_REQUEST_MASK 0x0000ffff /* see GR18 6:3 for event type */
  782. /* if GR18 indicates a display switch */
  783. #define SWF14_DS_PIPEB_LFP2_EN (1<<15)
  784. #define SWF14_DS_PIPEB_EFP2_EN (1<<14)
  785. #define SWF14_DS_PIPEB_TV2_EN (1<<13)
  786. #define SWF14_DS_PIPEB_CRT2_EN (1<<12)
  787. #define SWF14_DS_PIPEB_LFP_EN (1<<11)
  788. #define SWF14_DS_PIPEB_EFP_EN (1<<10)
  789. #define SWF14_DS_PIPEB_TV_EN (1<<9)
  790. #define SWF14_DS_PIPEB_CRT_EN (1<<8)
  791. #define SWF14_DS_PIPEA_LFP2_EN (1<<7)
  792. #define SWF14_DS_PIPEA_EFP2_EN (1<<6)
  793. #define SWF14_DS_PIPEA_TV2_EN (1<<5)
  794. #define SWF14_DS_PIPEA_CRT2_EN (1<<4)
  795. #define SWF14_DS_PIPEA_LFP_EN (1<<3)
  796. #define SWF14_DS_PIPEA_EFP_EN (1<<2)
  797. #define SWF14_DS_PIPEA_TV_EN (1<<1)
  798. #define SWF14_DS_PIPEA_CRT_EN (1<<0)
  799. /* if GR18 indicates a panel fitting request */
  800. #define SWF14_PFIT_EN (1<<0) /* 0 means disable */
  801. /* if GR18 indicates an APM change request */
  802. #define SWF14_APM_HIBERNATE 0x4
  803. #define SWF14_APM_SUSPEND 0x3
  804. #define SWF14_APM_STANDBY 0x1
  805. #define SWF14_APM_RESTORE 0x0
  806. /* Block 52 contains MIPI configuration block
  807. * 6 * bdb_mipi_config, followed by 6 pps data block
  808. * block below
  809. */
  810. #define MAX_MIPI_CONFIGURATIONS 6
  811. struct bdb_mipi_config {
  812. struct mipi_config config[MAX_MIPI_CONFIGURATIONS];
  813. struct mipi_pps_data pps[MAX_MIPI_CONFIGURATIONS];
  814. } __packed;
  815. /* Block 53 contains MIPI sequences as needed by the panel
  816. * for enabling it. This block can be variable in size and
  817. * can be maximum of 6 blocks
  818. */
  819. struct bdb_mipi_sequence {
  820. u8 version;
  821. u8 data[0];
  822. } __packed;
  823. enum mipi_gpio_pin_index {
  824. MIPI_GPIO_UNDEFINED = 0,
  825. MIPI_GPIO_PANEL_ENABLE,
  826. MIPI_GPIO_BL_ENABLE,
  827. MIPI_GPIO_PWM_ENABLE,
  828. MIPI_GPIO_RESET_N,
  829. MIPI_GPIO_PWR_DOWN_R,
  830. MIPI_GPIO_STDBY_RST_N,
  831. MIPI_GPIO_MAX
  832. };
  833. #endif /* _INTEL_VBT_DEFS_H_ */