intel_vbt_defs.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  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 rsvd7:1;
  144. u8 display_clock_mode:1;
  145. u8 rsvd8:1; /* finish byte */
  146. /* bits 3 */
  147. u8 disable_smooth_vision:1;
  148. u8 single_dvi:1;
  149. u8 rsvd9:1;
  150. u8 fdi_rx_polarity_inverted:1;
  151. u8 rsvd10:4; /* finish byte */
  152. /* bits 4 */
  153. u8 legacy_monitor_detect;
  154. /* bits 5 */
  155. u8 int_crt_support:1;
  156. u8 int_tv_support:1;
  157. u8 int_efp_support:1;
  158. u8 dp_ssc_enb:1; /* PCH attached eDP supports SSC */
  159. u8 dp_ssc_freq:1; /* SSC freq for PCH attached eDP */
  160. u8 rsvd11:3; /* finish byte */
  161. } __packed;
  162. /* pre-915 */
  163. #define GPIO_PIN_DVI_LVDS 0x03 /* "DVI/LVDS DDC GPIO pins" */
  164. #define GPIO_PIN_ADD_I2C 0x05 /* "ADDCARD I2C GPIO pins" */
  165. #define GPIO_PIN_ADD_DDC 0x04 /* "ADDCARD DDC GPIO pins" */
  166. #define GPIO_PIN_ADD_DDC_I2C 0x06 /* "ADDCARD DDC/I2C GPIO pins" */
  167. /* Pre 915 */
  168. #define DEVICE_TYPE_NONE 0x00
  169. #define DEVICE_TYPE_CRT 0x01
  170. #define DEVICE_TYPE_TV 0x09
  171. #define DEVICE_TYPE_EFP 0x12
  172. #define DEVICE_TYPE_LFP 0x22
  173. /* On 915+ */
  174. #define DEVICE_TYPE_CRT_DPMS 0x6001
  175. #define DEVICE_TYPE_CRT_DPMS_HOTPLUG 0x4001
  176. #define DEVICE_TYPE_TV_COMPOSITE 0x0209
  177. #define DEVICE_TYPE_TV_MACROVISION 0x0289
  178. #define DEVICE_TYPE_TV_RF_COMPOSITE 0x020c
  179. #define DEVICE_TYPE_TV_SVIDEO_COMPOSITE 0x0609
  180. #define DEVICE_TYPE_TV_SCART 0x0209
  181. #define DEVICE_TYPE_TV_CODEC_HOTPLUG_PWR 0x6009
  182. #define DEVICE_TYPE_EFP_HOTPLUG_PWR 0x6012
  183. #define DEVICE_TYPE_EFP_DVI_HOTPLUG_PWR 0x6052
  184. #define DEVICE_TYPE_EFP_DVI_I 0x6053
  185. #define DEVICE_TYPE_EFP_DVI_D_DUAL 0x6152
  186. #define DEVICE_TYPE_EFP_DVI_D_HDCP 0x60d2
  187. #define DEVICE_TYPE_OPENLDI_HOTPLUG_PWR 0x6062
  188. #define DEVICE_TYPE_OPENLDI_DUALPIX 0x6162
  189. #define DEVICE_TYPE_LFP_PANELLINK 0x5012
  190. #define DEVICE_TYPE_LFP_CMOS_PWR 0x5042
  191. #define DEVICE_TYPE_LFP_LVDS_PWR 0x5062
  192. #define DEVICE_TYPE_LFP_LVDS_DUAL 0x5162
  193. #define DEVICE_TYPE_LFP_LVDS_DUAL_HDCP 0x51e2
  194. #define DEVICE_CFG_NONE 0x00
  195. #define DEVICE_CFG_12BIT_DVOB 0x01
  196. #define DEVICE_CFG_12BIT_DVOC 0x02
  197. #define DEVICE_CFG_24BIT_DVOBC 0x09
  198. #define DEVICE_CFG_24BIT_DVOCB 0x0a
  199. #define DEVICE_CFG_DUAL_DVOB 0x11
  200. #define DEVICE_CFG_DUAL_DVOC 0x12
  201. #define DEVICE_CFG_DUAL_DVOBC 0x13
  202. #define DEVICE_CFG_DUAL_LINK_DVOBC 0x19
  203. #define DEVICE_CFG_DUAL_LINK_DVOCB 0x1a
  204. #define DEVICE_WIRE_NONE 0x00
  205. #define DEVICE_WIRE_DVOB 0x01
  206. #define DEVICE_WIRE_DVOC 0x02
  207. #define DEVICE_WIRE_DVOBC 0x03
  208. #define DEVICE_WIRE_DVOBB 0x05
  209. #define DEVICE_WIRE_DVOCC 0x06
  210. #define DEVICE_WIRE_DVOB_MASTER 0x0d
  211. #define DEVICE_WIRE_DVOC_MASTER 0x0e
  212. #define DEVICE_PORT_DVOA 0x00 /* none on 845+ */
  213. #define DEVICE_PORT_DVOB 0x01
  214. #define DEVICE_PORT_DVOC 0x02
  215. /*
  216. * We used to keep this struct but without any version control. We should avoid
  217. * using it in the future, but it should be safe to keep using it in the old
  218. * code. Do not change; we rely on its size.
  219. */
  220. struct old_child_dev_config {
  221. u16 handle;
  222. u16 device_type;
  223. u8 device_id[10]; /* ascii string */
  224. u16 addin_offset;
  225. u8 dvo_port; /* See Device_PORT_* above */
  226. u8 i2c_pin;
  227. u8 slave_addr;
  228. u8 ddc_pin;
  229. u16 edid_ptr;
  230. u8 dvo_cfg; /* See DEVICE_CFG_* above */
  231. u8 dvo2_port;
  232. u8 i2c2_pin;
  233. u8 slave2_addr;
  234. u8 ddc2_pin;
  235. u8 capabilities;
  236. u8 dvo_wiring;/* See DEVICE_WIRE_* above */
  237. u8 dvo2_wiring;
  238. u16 extended_type;
  239. u8 dvo_function;
  240. } __packed;
  241. /* This one contains field offsets that are known to be common for all BDB
  242. * versions. Notice that the meaning of the contents contents may still change,
  243. * but at least the offsets are consistent. */
  244. struct common_child_dev_config {
  245. u16 handle;
  246. u16 device_type;
  247. u8 not_common1[12];
  248. u8 dvo_port;
  249. u8 not_common2[2];
  250. u8 ddc_pin;
  251. u16 edid_ptr;
  252. u8 dvo_cfg; /* See DEVICE_CFG_* above */
  253. u8 efp_routed:1;
  254. u8 lane_reversal:1;
  255. u8 lspcon:1;
  256. u8 iboost:1;
  257. u8 hpd_invert:1;
  258. u8 flag_reserved:3;
  259. u8 hdmi_support:1;
  260. u8 dp_support:1;
  261. u8 tmds_support:1;
  262. u8 support_reserved:5;
  263. u8 aux_channel;
  264. u8 not_common3[11];
  265. u8 iboost_level;
  266. } __packed;
  267. /* This field changes depending on the BDB version, so the most reliable way to
  268. * read it is by checking the BDB version and reading the raw pointer. */
  269. union child_device_config {
  270. /* This one is safe to be used anywhere, but the code should still check
  271. * the BDB version. */
  272. u8 raw[33];
  273. /* This one should only be kept for legacy code. */
  274. struct old_child_dev_config old;
  275. /* This one should also be safe to use anywhere, even without version
  276. * checks. */
  277. struct common_child_dev_config common;
  278. } __packed;
  279. struct bdb_general_definitions {
  280. /* DDC GPIO */
  281. u8 crt_ddc_gmbus_pin;
  282. /* DPMS bits */
  283. u8 dpms_acpi:1;
  284. u8 skip_boot_crt_detect:1;
  285. u8 dpms_aim:1;
  286. u8 rsvd1:5; /* finish byte */
  287. /* boot device bits */
  288. u8 boot_display[2];
  289. u8 child_dev_size;
  290. /*
  291. * Device info:
  292. * If TV is present, it'll be at devices[0].
  293. * LVDS will be next, either devices[0] or [1], if present.
  294. * On some platforms the number of device is 6. But could be as few as
  295. * 4 if both TV and LVDS are missing.
  296. * And the device num is related with the size of general definition
  297. * block. It is obtained by using the following formula:
  298. * number = (block_size - sizeof(bdb_general_definitions))/
  299. * defs->child_dev_size;
  300. */
  301. uint8_t devices[0];
  302. } __packed;
  303. /* Mask for DRRS / Panel Channel / SSC / BLT control bits extraction */
  304. #define MODE_MASK 0x3
  305. struct bdb_lvds_options {
  306. u8 panel_type;
  307. u8 rsvd1;
  308. /* LVDS capabilities, stored in a dword */
  309. u8 pfit_mode:2;
  310. u8 pfit_text_mode_enhanced:1;
  311. u8 pfit_gfx_mode_enhanced:1;
  312. u8 pfit_ratio_auto:1;
  313. u8 pixel_dither:1;
  314. u8 lvds_edid:1;
  315. u8 rsvd2:1;
  316. u8 rsvd4;
  317. /* LVDS Panel channel bits stored here */
  318. u32 lvds_panel_channel_bits;
  319. /* LVDS SSC (Spread Spectrum Clock) bits stored here. */
  320. u16 ssc_bits;
  321. u16 ssc_freq;
  322. u16 ssc_ddt;
  323. /* Panel color depth defined here */
  324. u16 panel_color_depth;
  325. /* LVDS panel type bits stored here */
  326. u32 dps_panel_type_bits;
  327. /* LVDS backlight control type bits stored here */
  328. u32 blt_control_type_bits;
  329. } __packed;
  330. /* LFP pointer table contains entries to the struct below */
  331. struct bdb_lvds_lfp_data_ptr {
  332. u16 fp_timing_offset; /* offsets are from start of bdb */
  333. u8 fp_table_size;
  334. u16 dvo_timing_offset;
  335. u8 dvo_table_size;
  336. u16 panel_pnp_id_offset;
  337. u8 pnp_table_size;
  338. } __packed;
  339. struct bdb_lvds_lfp_data_ptrs {
  340. u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
  341. struct bdb_lvds_lfp_data_ptr ptr[16];
  342. } __packed;
  343. /* LFP data has 3 blocks per entry */
  344. struct lvds_fp_timing {
  345. u16 x_res;
  346. u16 y_res;
  347. u32 lvds_reg;
  348. u32 lvds_reg_val;
  349. u32 pp_on_reg;
  350. u32 pp_on_reg_val;
  351. u32 pp_off_reg;
  352. u32 pp_off_reg_val;
  353. u32 pp_cycle_reg;
  354. u32 pp_cycle_reg_val;
  355. u32 pfit_reg;
  356. u32 pfit_reg_val;
  357. u16 terminator;
  358. } __packed;
  359. struct lvds_dvo_timing {
  360. u16 clock; /**< In 10khz */
  361. u8 hactive_lo;
  362. u8 hblank_lo;
  363. u8 hblank_hi:4;
  364. u8 hactive_hi:4;
  365. u8 vactive_lo;
  366. u8 vblank_lo;
  367. u8 vblank_hi:4;
  368. u8 vactive_hi:4;
  369. u8 hsync_off_lo;
  370. u8 hsync_pulse_width;
  371. u8 vsync_pulse_width:4;
  372. u8 vsync_off:4;
  373. u8 rsvd0:6;
  374. u8 hsync_off_hi:2;
  375. u8 himage_lo;
  376. u8 vimage_lo;
  377. u8 vimage_hi:4;
  378. u8 himage_hi:4;
  379. u8 h_border;
  380. u8 v_border;
  381. u8 rsvd1:3;
  382. u8 digital:2;
  383. u8 vsync_positive:1;
  384. u8 hsync_positive:1;
  385. u8 rsvd2:1;
  386. } __packed;
  387. struct lvds_pnp_id {
  388. u16 mfg_name;
  389. u16 product_code;
  390. u32 serial;
  391. u8 mfg_week;
  392. u8 mfg_year;
  393. } __packed;
  394. struct bdb_lvds_lfp_data_entry {
  395. struct lvds_fp_timing fp_timing;
  396. struct lvds_dvo_timing dvo_timing;
  397. struct lvds_pnp_id pnp_id;
  398. } __packed;
  399. struct bdb_lvds_lfp_data {
  400. struct bdb_lvds_lfp_data_entry data[16];
  401. } __packed;
  402. #define BDB_BACKLIGHT_TYPE_NONE 0
  403. #define BDB_BACKLIGHT_TYPE_PWM 2
  404. struct bdb_lfp_backlight_data_entry {
  405. u8 type:2;
  406. u8 active_low_pwm:1;
  407. u8 obsolete1:5;
  408. u16 pwm_freq_hz;
  409. u8 min_brightness;
  410. u8 obsolete2;
  411. u8 obsolete3;
  412. } __packed;
  413. struct bdb_lfp_backlight_control_method {
  414. u8 type:4;
  415. u8 controller:4;
  416. } __packed;
  417. struct bdb_lfp_backlight_data {
  418. u8 entry_size;
  419. struct bdb_lfp_backlight_data_entry data[16];
  420. u8 level[16];
  421. struct bdb_lfp_backlight_control_method backlight_control[16];
  422. } __packed;
  423. struct aimdb_header {
  424. char signature[16];
  425. char oem_device[20];
  426. u16 aimdb_version;
  427. u16 aimdb_header_size;
  428. u16 aimdb_size;
  429. } __packed;
  430. struct aimdb_block {
  431. u8 aimdb_id;
  432. u16 aimdb_size;
  433. } __packed;
  434. struct vch_panel_data {
  435. u16 fp_timing_offset;
  436. u8 fp_timing_size;
  437. u16 dvo_timing_offset;
  438. u8 dvo_timing_size;
  439. u16 text_fitting_offset;
  440. u8 text_fitting_size;
  441. u16 graphics_fitting_offset;
  442. u8 graphics_fitting_size;
  443. } __packed;
  444. struct vch_bdb_22 {
  445. struct aimdb_block aimdb_block;
  446. struct vch_panel_data panels[16];
  447. } __packed;
  448. struct bdb_sdvo_lvds_options {
  449. u8 panel_backlight;
  450. u8 h40_set_panel_type;
  451. u8 panel_type;
  452. u8 ssc_clk_freq;
  453. u16 als_low_trip;
  454. u16 als_high_trip;
  455. u8 sclalarcoeff_tab_row_num;
  456. u8 sclalarcoeff_tab_row_size;
  457. u8 coefficient[8];
  458. u8 panel_misc_bits_1;
  459. u8 panel_misc_bits_2;
  460. u8 panel_misc_bits_3;
  461. u8 panel_misc_bits_4;
  462. } __packed;
  463. #define BDB_DRIVER_FEATURE_NO_LVDS 0
  464. #define BDB_DRIVER_FEATURE_INT_LVDS 1
  465. #define BDB_DRIVER_FEATURE_SDVO_LVDS 2
  466. #define BDB_DRIVER_FEATURE_EDP 3
  467. struct bdb_driver_features {
  468. u8 boot_dev_algorithm:1;
  469. u8 block_display_switch:1;
  470. u8 allow_display_switch:1;
  471. u8 hotplug_dvo:1;
  472. u8 dual_view_zoom:1;
  473. u8 int15h_hook:1;
  474. u8 sprite_in_clone:1;
  475. u8 primary_lfp_id:1;
  476. u16 boot_mode_x;
  477. u16 boot_mode_y;
  478. u8 boot_mode_bpp;
  479. u8 boot_mode_refresh;
  480. u16 enable_lfp_primary:1;
  481. u16 selective_mode_pruning:1;
  482. u16 dual_frequency:1;
  483. u16 render_clock_freq:1; /* 0: high freq; 1: low freq */
  484. u16 nt_clone_support:1;
  485. u16 power_scheme_ui:1; /* 0: CUI; 1: 3rd party */
  486. u16 sprite_display_assign:1; /* 0: secondary; 1: primary */
  487. u16 cui_aspect_scaling:1;
  488. u16 preserve_aspect_ratio:1;
  489. u16 sdvo_device_power_down:1;
  490. u16 crt_hotplug:1;
  491. u16 lvds_config:2;
  492. u16 tv_hotplug:1;
  493. u16 hdmi_config:2;
  494. u8 static_display:1;
  495. u8 reserved2:7;
  496. u16 legacy_crt_max_x;
  497. u16 legacy_crt_max_y;
  498. u8 legacy_crt_max_refresh;
  499. u8 hdmi_termination;
  500. u8 custom_vbt_version;
  501. /* Driver features data block */
  502. u16 rmpm_enabled:1;
  503. u16 s2ddt_enabled:1;
  504. u16 dpst_enabled:1;
  505. u16 bltclt_enabled:1;
  506. u16 adb_enabled:1;
  507. u16 drrs_enabled:1;
  508. u16 grs_enabled:1;
  509. u16 gpmt_enabled:1;
  510. u16 tbt_enabled:1;
  511. u16 psr_enabled:1;
  512. u16 ips_enabled:1;
  513. u16 reserved3:4;
  514. u16 pc_feature_valid:1;
  515. } __packed;
  516. #define EDP_18BPP 0
  517. #define EDP_24BPP 1
  518. #define EDP_30BPP 2
  519. #define EDP_RATE_1_62 0
  520. #define EDP_RATE_2_7 1
  521. #define EDP_LANE_1 0
  522. #define EDP_LANE_2 1
  523. #define EDP_LANE_4 3
  524. #define EDP_PREEMPHASIS_NONE 0
  525. #define EDP_PREEMPHASIS_3_5dB 1
  526. #define EDP_PREEMPHASIS_6dB 2
  527. #define EDP_PREEMPHASIS_9_5dB 3
  528. #define EDP_VSWING_0_4V 0
  529. #define EDP_VSWING_0_6V 1
  530. #define EDP_VSWING_0_8V 2
  531. #define EDP_VSWING_1_2V 3
  532. struct edp_link_params {
  533. u8 rate:4;
  534. u8 lanes:4;
  535. u8 preemphasis:4;
  536. u8 vswing:4;
  537. } __packed;
  538. struct bdb_edp {
  539. struct edp_power_seq power_seqs[16];
  540. u32 color_depth;
  541. struct edp_link_params link_params[16];
  542. u32 sdrrs_msa_timing_delay;
  543. /* ith bit indicates enabled/disabled for (i+1)th panel */
  544. u16 edp_s3d_feature;
  545. u16 edp_t3_optimization;
  546. u64 edp_vswing_preemph; /* v173 */
  547. } __packed;
  548. struct psr_table {
  549. /* Feature bits */
  550. u8 full_link:1;
  551. u8 require_aux_to_wakeup:1;
  552. u8 feature_bits_rsvd:6;
  553. /* Wait times */
  554. u8 idle_frames:4;
  555. u8 lines_to_wait:3;
  556. u8 wait_times_rsvd:1;
  557. /* TP wake up time in multiple of 100 */
  558. u16 tp1_wakeup_time;
  559. u16 tp2_tp3_wakeup_time;
  560. } __packed;
  561. struct bdb_psr {
  562. struct psr_table psr_table[16];
  563. } __packed;
  564. /*
  565. * Driver<->VBIOS interaction occurs through scratch bits in
  566. * GR18 & SWF*.
  567. */
  568. /* GR18 bits are set on display switch and hotkey events */
  569. #define GR18_DRIVER_SWITCH_EN (1<<7) /* 0: VBIOS control, 1: driver control */
  570. #define GR18_HOTKEY_MASK 0x78 /* See also SWF4 15:0 */
  571. #define GR18_HK_NONE (0x0<<3)
  572. #define GR18_HK_LFP_STRETCH (0x1<<3)
  573. #define GR18_HK_TOGGLE_DISP (0x2<<3)
  574. #define GR18_HK_DISP_SWITCH (0x4<<3) /* see SWF14 15:0 for what to enable */
  575. #define GR18_HK_POPUP_DISABLED (0x6<<3)
  576. #define GR18_HK_POPUP_ENABLED (0x7<<3)
  577. #define GR18_HK_PFIT (0x8<<3)
  578. #define GR18_HK_APM_CHANGE (0xa<<3)
  579. #define GR18_HK_MULTIPLE (0xc<<3)
  580. #define GR18_USER_INT_EN (1<<2)
  581. #define GR18_A0000_FLUSH_EN (1<<1)
  582. #define GR18_SMM_EN (1<<0)
  583. /* Set by driver, cleared by VBIOS */
  584. #define SWF00_YRES_SHIFT 16
  585. #define SWF00_XRES_SHIFT 0
  586. #define SWF00_RES_MASK 0xffff
  587. /* Set by VBIOS at boot time and driver at runtime */
  588. #define SWF01_TV2_FORMAT_SHIFT 8
  589. #define SWF01_TV1_FORMAT_SHIFT 0
  590. #define SWF01_TV_FORMAT_MASK 0xffff
  591. #define SWF10_VBIOS_BLC_I2C_EN (1<<29)
  592. #define SWF10_GTT_OVERRIDE_EN (1<<28)
  593. #define SWF10_LFP_DPMS_OVR (1<<27) /* override DPMS on display switch */
  594. #define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
  595. #define SWF10_OLD_TOGGLE 0x0
  596. #define SWF10_TOGGLE_LIST_1 0x1
  597. #define SWF10_TOGGLE_LIST_2 0x2
  598. #define SWF10_TOGGLE_LIST_3 0x3
  599. #define SWF10_TOGGLE_LIST_4 0x4
  600. #define SWF10_PANNING_EN (1<<23)
  601. #define SWF10_DRIVER_LOADED (1<<22)
  602. #define SWF10_EXTENDED_DESKTOP (1<<21)
  603. #define SWF10_EXCLUSIVE_MODE (1<<20)
  604. #define SWF10_OVERLAY_EN (1<<19)
  605. #define SWF10_PLANEB_HOLDOFF (1<<18)
  606. #define SWF10_PLANEA_HOLDOFF (1<<17)
  607. #define SWF10_VGA_HOLDOFF (1<<16)
  608. #define SWF10_ACTIVE_DISP_MASK 0xffff
  609. #define SWF10_PIPEB_LFP2 (1<<15)
  610. #define SWF10_PIPEB_EFP2 (1<<14)
  611. #define SWF10_PIPEB_TV2 (1<<13)
  612. #define SWF10_PIPEB_CRT2 (1<<12)
  613. #define SWF10_PIPEB_LFP (1<<11)
  614. #define SWF10_PIPEB_EFP (1<<10)
  615. #define SWF10_PIPEB_TV (1<<9)
  616. #define SWF10_PIPEB_CRT (1<<8)
  617. #define SWF10_PIPEA_LFP2 (1<<7)
  618. #define SWF10_PIPEA_EFP2 (1<<6)
  619. #define SWF10_PIPEA_TV2 (1<<5)
  620. #define SWF10_PIPEA_CRT2 (1<<4)
  621. #define SWF10_PIPEA_LFP (1<<3)
  622. #define SWF10_PIPEA_EFP (1<<2)
  623. #define SWF10_PIPEA_TV (1<<1)
  624. #define SWF10_PIPEA_CRT (1<<0)
  625. #define SWF11_MEMORY_SIZE_SHIFT 16
  626. #define SWF11_SV_TEST_EN (1<<15)
  627. #define SWF11_IS_AGP (1<<14)
  628. #define SWF11_DISPLAY_HOLDOFF (1<<13)
  629. #define SWF11_DPMS_REDUCED (1<<12)
  630. #define SWF11_IS_VBE_MODE (1<<11)
  631. #define SWF11_PIPEB_ACCESS (1<<10) /* 0 here means pipe a */
  632. #define SWF11_DPMS_MASK 0x07
  633. #define SWF11_DPMS_OFF (1<<2)
  634. #define SWF11_DPMS_SUSPEND (1<<1)
  635. #define SWF11_DPMS_STANDBY (1<<0)
  636. #define SWF11_DPMS_ON 0
  637. #define SWF14_GFX_PFIT_EN (1<<31)
  638. #define SWF14_TEXT_PFIT_EN (1<<30)
  639. #define SWF14_LID_STATUS_CLOSED (1<<29) /* 0 here means open */
  640. #define SWF14_POPUP_EN (1<<28)
  641. #define SWF14_DISPLAY_HOLDOFF (1<<27)
  642. #define SWF14_DISP_DETECT_EN (1<<26)
  643. #define SWF14_DOCKING_STATUS_DOCKED (1<<25) /* 0 here means undocked */
  644. #define SWF14_DRIVER_STATUS (1<<24)
  645. #define SWF14_OS_TYPE_WIN9X (1<<23)
  646. #define SWF14_OS_TYPE_WINNT (1<<22)
  647. /* 21:19 rsvd */
  648. #define SWF14_PM_TYPE_MASK 0x00070000
  649. #define SWF14_PM_ACPI_VIDEO (0x4 << 16)
  650. #define SWF14_PM_ACPI (0x3 << 16)
  651. #define SWF14_PM_APM_12 (0x2 << 16)
  652. #define SWF14_PM_APM_11 (0x1 << 16)
  653. #define SWF14_HK_REQUEST_MASK 0x0000ffff /* see GR18 6:3 for event type */
  654. /* if GR18 indicates a display switch */
  655. #define SWF14_DS_PIPEB_LFP2_EN (1<<15)
  656. #define SWF14_DS_PIPEB_EFP2_EN (1<<14)
  657. #define SWF14_DS_PIPEB_TV2_EN (1<<13)
  658. #define SWF14_DS_PIPEB_CRT2_EN (1<<12)
  659. #define SWF14_DS_PIPEB_LFP_EN (1<<11)
  660. #define SWF14_DS_PIPEB_EFP_EN (1<<10)
  661. #define SWF14_DS_PIPEB_TV_EN (1<<9)
  662. #define SWF14_DS_PIPEB_CRT_EN (1<<8)
  663. #define SWF14_DS_PIPEA_LFP2_EN (1<<7)
  664. #define SWF14_DS_PIPEA_EFP2_EN (1<<6)
  665. #define SWF14_DS_PIPEA_TV2_EN (1<<5)
  666. #define SWF14_DS_PIPEA_CRT2_EN (1<<4)
  667. #define SWF14_DS_PIPEA_LFP_EN (1<<3)
  668. #define SWF14_DS_PIPEA_EFP_EN (1<<2)
  669. #define SWF14_DS_PIPEA_TV_EN (1<<1)
  670. #define SWF14_DS_PIPEA_CRT_EN (1<<0)
  671. /* if GR18 indicates a panel fitting request */
  672. #define SWF14_PFIT_EN (1<<0) /* 0 means disable */
  673. /* if GR18 indicates an APM change request */
  674. #define SWF14_APM_HIBERNATE 0x4
  675. #define SWF14_APM_SUSPEND 0x3
  676. #define SWF14_APM_STANDBY 0x1
  677. #define SWF14_APM_RESTORE 0x0
  678. /* Add the device class for LFP, TV, HDMI */
  679. #define DEVICE_TYPE_INT_LFP 0x1022
  680. #define DEVICE_TYPE_INT_TV 0x1009
  681. #define DEVICE_TYPE_HDMI 0x60D2
  682. #define DEVICE_TYPE_DP 0x68C6
  683. #define DEVICE_TYPE_DP_DUAL_MODE 0x60D6
  684. #define DEVICE_TYPE_eDP 0x78C6
  685. #define DEVICE_TYPE_CLASS_EXTENSION (1 << 15)
  686. #define DEVICE_TYPE_POWER_MANAGEMENT (1 << 14)
  687. #define DEVICE_TYPE_HOTPLUG_SIGNALING (1 << 13)
  688. #define DEVICE_TYPE_INTERNAL_CONNECTOR (1 << 12)
  689. #define DEVICE_TYPE_NOT_HDMI_OUTPUT (1 << 11)
  690. #define DEVICE_TYPE_MIPI_OUTPUT (1 << 10)
  691. #define DEVICE_TYPE_COMPOSITE_OUTPUT (1 << 9)
  692. #define DEVICE_TYPE_DUAL_CHANNEL (1 << 8)
  693. #define DEVICE_TYPE_HIGH_SPEED_LINK (1 << 6)
  694. #define DEVICE_TYPE_LVDS_SINGALING (1 << 5)
  695. #define DEVICE_TYPE_TMDS_DVI_SIGNALING (1 << 4)
  696. #define DEVICE_TYPE_VIDEO_SIGNALING (1 << 3)
  697. #define DEVICE_TYPE_DISPLAYPORT_OUTPUT (1 << 2)
  698. #define DEVICE_TYPE_DIGITAL_OUTPUT (1 << 1)
  699. #define DEVICE_TYPE_ANALOG_OUTPUT (1 << 0)
  700. /*
  701. * Bits we care about when checking for DEVICE_TYPE_eDP
  702. * Depending on the system, the other bits may or may not
  703. * be set for eDP outputs.
  704. */
  705. #define DEVICE_TYPE_eDP_BITS \
  706. (DEVICE_TYPE_INTERNAL_CONNECTOR | \
  707. DEVICE_TYPE_MIPI_OUTPUT | \
  708. DEVICE_TYPE_COMPOSITE_OUTPUT | \
  709. DEVICE_TYPE_DUAL_CHANNEL | \
  710. DEVICE_TYPE_LVDS_SINGALING | \
  711. DEVICE_TYPE_TMDS_DVI_SIGNALING | \
  712. DEVICE_TYPE_VIDEO_SIGNALING | \
  713. DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
  714. DEVICE_TYPE_ANALOG_OUTPUT)
  715. #define DEVICE_TYPE_DP_DUAL_MODE_BITS \
  716. (DEVICE_TYPE_INTERNAL_CONNECTOR | \
  717. DEVICE_TYPE_MIPI_OUTPUT | \
  718. DEVICE_TYPE_COMPOSITE_OUTPUT | \
  719. DEVICE_TYPE_LVDS_SINGALING | \
  720. DEVICE_TYPE_TMDS_DVI_SIGNALING | \
  721. DEVICE_TYPE_VIDEO_SIGNALING | \
  722. DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
  723. DEVICE_TYPE_DIGITAL_OUTPUT | \
  724. DEVICE_TYPE_ANALOG_OUTPUT)
  725. /* define the DVO port for HDMI output type */
  726. #define DVO_B 1
  727. #define DVO_C 2
  728. #define DVO_D 3
  729. /* Possible values for the "DVO Port" field for versions >= 155: */
  730. #define DVO_PORT_HDMIA 0
  731. #define DVO_PORT_HDMIB 1
  732. #define DVO_PORT_HDMIC 2
  733. #define DVO_PORT_HDMID 3
  734. #define DVO_PORT_LVDS 4
  735. #define DVO_PORT_TV 5
  736. #define DVO_PORT_CRT 6
  737. #define DVO_PORT_DPB 7
  738. #define DVO_PORT_DPC 8
  739. #define DVO_PORT_DPD 9
  740. #define DVO_PORT_DPA 10
  741. #define DVO_PORT_DPE 11
  742. #define DVO_PORT_HDMIE 12
  743. #define DVO_PORT_MIPIA 21
  744. #define DVO_PORT_MIPIB 22
  745. #define DVO_PORT_MIPIC 23
  746. #define DVO_PORT_MIPID 24
  747. /* Block 52 contains MIPI configuration block
  748. * 6 * bdb_mipi_config, followed by 6 pps data block
  749. * block below
  750. */
  751. #define MAX_MIPI_CONFIGURATIONS 6
  752. struct bdb_mipi_config {
  753. struct mipi_config config[MAX_MIPI_CONFIGURATIONS];
  754. struct mipi_pps_data pps[MAX_MIPI_CONFIGURATIONS];
  755. } __packed;
  756. /* Block 53 contains MIPI sequences as needed by the panel
  757. * for enabling it. This block can be variable in size and
  758. * can be maximum of 6 blocks
  759. */
  760. struct bdb_mipi_sequence {
  761. u8 version;
  762. u8 data[0];
  763. } __packed;
  764. enum mipi_gpio_pin_index {
  765. MIPI_GPIO_UNDEFINED = 0,
  766. MIPI_GPIO_PANEL_ENABLE,
  767. MIPI_GPIO_BL_ENABLE,
  768. MIPI_GPIO_PWM_ENABLE,
  769. MIPI_GPIO_RESET_N,
  770. MIPI_GPIO_PWR_DOWN_R,
  771. MIPI_GPIO_STDBY_RST_N,
  772. MIPI_GPIO_MAX
  773. };
  774. #endif /* _INTEL_VBT_DEFS_H_ */