intel_bios.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. /*
  2. * Copyright © 2006 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. #ifndef _I830_BIOS_H_
  28. #define _I830_BIOS_H_
  29. #include <drm/drmP.h>
  30. struct vbt_header {
  31. u8 signature[20]; /**< Always starts with 'VBT$' */
  32. u16 version; /**< decimal */
  33. u16 header_size; /**< in bytes */
  34. u16 vbt_size; /**< in bytes */
  35. u8 vbt_checksum;
  36. u8 reserved0;
  37. u32 bdb_offset; /**< from beginning of VBT */
  38. u32 aim_offset[4]; /**< from beginning of VBT */
  39. } __packed;
  40. struct bdb_header {
  41. u8 signature[16]; /**< Always 'BIOS_DATA_BLOCK' */
  42. u16 version; /**< decimal */
  43. u16 header_size; /**< in bytes */
  44. u16 bdb_size; /**< in bytes */
  45. };
  46. /* strictly speaking, this is a "skip" block, but it has interesting info */
  47. struct vbios_data {
  48. u8 type; /* 0 == desktop, 1 == mobile */
  49. u8 relstage;
  50. u8 chipset;
  51. u8 lvds_present:1;
  52. u8 tv_present:1;
  53. u8 rsvd2:6; /* finish byte */
  54. u8 rsvd3[4];
  55. u8 signon[155];
  56. u8 copyright[61];
  57. u16 code_segment;
  58. u8 dos_boot_mode;
  59. u8 bandwidth_percent;
  60. u8 rsvd4; /* popup memory size */
  61. u8 resize_pci_bios;
  62. u8 rsvd5; /* is crt already on ddc2 */
  63. } __packed;
  64. /*
  65. * There are several types of BIOS data blocks (BDBs), each block has
  66. * an ID and size in the first 3 bytes (ID in first, size in next 2).
  67. * Known types are listed below.
  68. */
  69. #define BDB_GENERAL_FEATURES 1
  70. #define BDB_GENERAL_DEFINITIONS 2
  71. #define BDB_OLD_TOGGLE_LIST 3
  72. #define BDB_MODE_SUPPORT_LIST 4
  73. #define BDB_GENERIC_MODE_TABLE 5
  74. #define BDB_EXT_MMIO_REGS 6
  75. #define BDB_SWF_IO 7
  76. #define BDB_SWF_MMIO 8
  77. #define BDB_DOT_CLOCK_TABLE 9
  78. #define BDB_MODE_REMOVAL_TABLE 10
  79. #define BDB_CHILD_DEVICE_TABLE 11
  80. #define BDB_DRIVER_FEATURES 12
  81. #define BDB_DRIVER_PERSISTENCE 13
  82. #define BDB_EXT_TABLE_PTRS 14
  83. #define BDB_DOT_CLOCK_OVERRIDE 15
  84. #define BDB_DISPLAY_SELECT 16
  85. /* 17 rsvd */
  86. #define BDB_DRIVER_ROTATION 18
  87. #define BDB_DISPLAY_REMOVE 19
  88. #define BDB_OEM_CUSTOM 20
  89. #define BDB_EFP_LIST 21 /* workarounds for VGA hsync/vsync */
  90. #define BDB_SDVO_LVDS_OPTIONS 22
  91. #define BDB_SDVO_PANEL_DTDS 23
  92. #define BDB_SDVO_LVDS_PNP_IDS 24
  93. #define BDB_SDVO_LVDS_POWER_SEQ 25
  94. #define BDB_TV_OPTIONS 26
  95. #define BDB_EDP 27
  96. #define BDB_LVDS_OPTIONS 40
  97. #define BDB_LVDS_LFP_DATA_PTRS 41
  98. #define BDB_LVDS_LFP_DATA 42
  99. #define BDB_LVDS_BACKLIGHT 43
  100. #define BDB_LVDS_POWER 44
  101. #define BDB_MIPI_CONFIG 52
  102. #define BDB_MIPI_SEQUENCE 53
  103. #define BDB_SKIP 254 /* VBIOS private block, ignore */
  104. struct bdb_general_features {
  105. /* bits 1 */
  106. u8 panel_fitting:2;
  107. u8 flexaim:1;
  108. u8 msg_enable:1;
  109. u8 clear_screen:3;
  110. u8 color_flip:1;
  111. /* bits 2 */
  112. u8 download_ext_vbt:1;
  113. u8 enable_ssc:1;
  114. u8 ssc_freq:1;
  115. u8 enable_lfp_on_override:1;
  116. u8 disable_ssc_ddt:1;
  117. u8 rsvd7:1;
  118. u8 display_clock_mode:1;
  119. u8 rsvd8:1; /* finish byte */
  120. /* bits 3 */
  121. u8 disable_smooth_vision:1;
  122. u8 single_dvi:1;
  123. u8 rsvd9:1;
  124. u8 fdi_rx_polarity_inverted:1;
  125. u8 rsvd10:4; /* finish byte */
  126. /* bits 4 */
  127. u8 legacy_monitor_detect;
  128. /* bits 5 */
  129. u8 int_crt_support:1;
  130. u8 int_tv_support:1;
  131. u8 int_efp_support:1;
  132. u8 dp_ssc_enb:1; /* PCH attached eDP supports SSC */
  133. u8 dp_ssc_freq:1; /* SSC freq for PCH attached eDP */
  134. u8 rsvd11:3; /* finish byte */
  135. } __packed;
  136. /* pre-915 */
  137. #define GPIO_PIN_DVI_LVDS 0x03 /* "DVI/LVDS DDC GPIO pins" */
  138. #define GPIO_PIN_ADD_I2C 0x05 /* "ADDCARD I2C GPIO pins" */
  139. #define GPIO_PIN_ADD_DDC 0x04 /* "ADDCARD DDC GPIO pins" */
  140. #define GPIO_PIN_ADD_DDC_I2C 0x06 /* "ADDCARD DDC/I2C GPIO pins" */
  141. /* Pre 915 */
  142. #define DEVICE_TYPE_NONE 0x00
  143. #define DEVICE_TYPE_CRT 0x01
  144. #define DEVICE_TYPE_TV 0x09
  145. #define DEVICE_TYPE_EFP 0x12
  146. #define DEVICE_TYPE_LFP 0x22
  147. /* On 915+ */
  148. #define DEVICE_TYPE_CRT_DPMS 0x6001
  149. #define DEVICE_TYPE_CRT_DPMS_HOTPLUG 0x4001
  150. #define DEVICE_TYPE_TV_COMPOSITE 0x0209
  151. #define DEVICE_TYPE_TV_MACROVISION 0x0289
  152. #define DEVICE_TYPE_TV_RF_COMPOSITE 0x020c
  153. #define DEVICE_TYPE_TV_SVIDEO_COMPOSITE 0x0609
  154. #define DEVICE_TYPE_TV_SCART 0x0209
  155. #define DEVICE_TYPE_TV_CODEC_HOTPLUG_PWR 0x6009
  156. #define DEVICE_TYPE_EFP_HOTPLUG_PWR 0x6012
  157. #define DEVICE_TYPE_EFP_DVI_HOTPLUG_PWR 0x6052
  158. #define DEVICE_TYPE_EFP_DVI_I 0x6053
  159. #define DEVICE_TYPE_EFP_DVI_D_DUAL 0x6152
  160. #define DEVICE_TYPE_EFP_DVI_D_HDCP 0x60d2
  161. #define DEVICE_TYPE_OPENLDI_HOTPLUG_PWR 0x6062
  162. #define DEVICE_TYPE_OPENLDI_DUALPIX 0x6162
  163. #define DEVICE_TYPE_LFP_PANELLINK 0x5012
  164. #define DEVICE_TYPE_LFP_CMOS_PWR 0x5042
  165. #define DEVICE_TYPE_LFP_LVDS_PWR 0x5062
  166. #define DEVICE_TYPE_LFP_LVDS_DUAL 0x5162
  167. #define DEVICE_TYPE_LFP_LVDS_DUAL_HDCP 0x51e2
  168. #define DEVICE_CFG_NONE 0x00
  169. #define DEVICE_CFG_12BIT_DVOB 0x01
  170. #define DEVICE_CFG_12BIT_DVOC 0x02
  171. #define DEVICE_CFG_24BIT_DVOBC 0x09
  172. #define DEVICE_CFG_24BIT_DVOCB 0x0a
  173. #define DEVICE_CFG_DUAL_DVOB 0x11
  174. #define DEVICE_CFG_DUAL_DVOC 0x12
  175. #define DEVICE_CFG_DUAL_DVOBC 0x13
  176. #define DEVICE_CFG_DUAL_LINK_DVOBC 0x19
  177. #define DEVICE_CFG_DUAL_LINK_DVOCB 0x1a
  178. #define DEVICE_WIRE_NONE 0x00
  179. #define DEVICE_WIRE_DVOB 0x01
  180. #define DEVICE_WIRE_DVOC 0x02
  181. #define DEVICE_WIRE_DVOBC 0x03
  182. #define DEVICE_WIRE_DVOBB 0x05
  183. #define DEVICE_WIRE_DVOCC 0x06
  184. #define DEVICE_WIRE_DVOB_MASTER 0x0d
  185. #define DEVICE_WIRE_DVOC_MASTER 0x0e
  186. #define DEVICE_PORT_DVOA 0x00 /* none on 845+ */
  187. #define DEVICE_PORT_DVOB 0x01
  188. #define DEVICE_PORT_DVOC 0x02
  189. /* We used to keep this struct but without any version control. We should avoid
  190. * using it in the future, but it should be safe to keep using it in the old
  191. * code. */
  192. struct old_child_dev_config {
  193. u16 handle;
  194. u16 device_type;
  195. u8 device_id[10]; /* ascii string */
  196. u16 addin_offset;
  197. u8 dvo_port; /* See Device_PORT_* above */
  198. u8 i2c_pin;
  199. u8 slave_addr;
  200. u8 ddc_pin;
  201. u16 edid_ptr;
  202. u8 dvo_cfg; /* See DEVICE_CFG_* above */
  203. u8 dvo2_port;
  204. u8 i2c2_pin;
  205. u8 slave2_addr;
  206. u8 ddc2_pin;
  207. u8 capabilities;
  208. u8 dvo_wiring;/* See DEVICE_WIRE_* above */
  209. u8 dvo2_wiring;
  210. u16 extended_type;
  211. u8 dvo_function;
  212. } __packed;
  213. /* This one contains field offsets that are known to be common for all BDB
  214. * versions. Notice that the meaning of the contents contents may still change,
  215. * but at least the offsets are consistent. */
  216. struct common_child_dev_config {
  217. u16 handle;
  218. u16 device_type;
  219. u8 not_common1[12];
  220. u8 dvo_port;
  221. u8 not_common2[2];
  222. u8 ddc_pin;
  223. u16 edid_ptr;
  224. } __packed;
  225. /* This field changes depending on the BDB version, so the most reliable way to
  226. * read it is by checking the BDB version and reading the raw pointer. */
  227. union child_device_config {
  228. /* This one is safe to be used anywhere, but the code should still check
  229. * the BDB version. */
  230. u8 raw[33];
  231. /* This one should only be kept for legacy code. */
  232. struct old_child_dev_config old;
  233. /* This one should also be safe to use anywhere, even without version
  234. * checks. */
  235. struct common_child_dev_config common;
  236. };
  237. struct bdb_general_definitions {
  238. /* DDC GPIO */
  239. u8 crt_ddc_gmbus_pin;
  240. /* DPMS bits */
  241. u8 dpms_acpi:1;
  242. u8 skip_boot_crt_detect:1;
  243. u8 dpms_aim:1;
  244. u8 rsvd1:5; /* finish byte */
  245. /* boot device bits */
  246. u8 boot_display[2];
  247. u8 child_dev_size;
  248. /*
  249. * Device info:
  250. * If TV is present, it'll be at devices[0].
  251. * LVDS will be next, either devices[0] or [1], if present.
  252. * On some platforms the number of device is 6. But could be as few as
  253. * 4 if both TV and LVDS are missing.
  254. * And the device num is related with the size of general definition
  255. * block. It is obtained by using the following formula:
  256. * number = (block_size - sizeof(bdb_general_definitions))/
  257. * sizeof(child_device_config);
  258. */
  259. union child_device_config devices[0];
  260. } __packed;
  261. /* Mask for DRRS / Panel Channel / SSC / BLT control bits extraction */
  262. #define MODE_MASK 0x3
  263. struct bdb_lvds_options {
  264. u8 panel_type;
  265. u8 rsvd1;
  266. /* LVDS capabilities, stored in a dword */
  267. u8 pfit_mode:2;
  268. u8 pfit_text_mode_enhanced:1;
  269. u8 pfit_gfx_mode_enhanced:1;
  270. u8 pfit_ratio_auto:1;
  271. u8 pixel_dither:1;
  272. u8 lvds_edid:1;
  273. u8 rsvd2:1;
  274. u8 rsvd4;
  275. /* LVDS Panel channel bits stored here */
  276. u32 lvds_panel_channel_bits;
  277. /* LVDS SSC (Spread Spectrum Clock) bits stored here. */
  278. u16 ssc_bits;
  279. u16 ssc_freq;
  280. u16 ssc_ddt;
  281. /* Panel color depth defined here */
  282. u16 panel_color_depth;
  283. /* LVDS panel type bits stored here */
  284. u32 dps_panel_type_bits;
  285. /* LVDS backlight control type bits stored here */
  286. u32 blt_control_type_bits;
  287. } __packed;
  288. /* LFP pointer table contains entries to the struct below */
  289. struct bdb_lvds_lfp_data_ptr {
  290. u16 fp_timing_offset; /* offsets are from start of bdb */
  291. u8 fp_table_size;
  292. u16 dvo_timing_offset;
  293. u8 dvo_table_size;
  294. u16 panel_pnp_id_offset;
  295. u8 pnp_table_size;
  296. } __packed;
  297. struct bdb_lvds_lfp_data_ptrs {
  298. u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
  299. struct bdb_lvds_lfp_data_ptr ptr[16];
  300. } __packed;
  301. /* LFP data has 3 blocks per entry */
  302. struct lvds_fp_timing {
  303. u16 x_res;
  304. u16 y_res;
  305. u32 lvds_reg;
  306. u32 lvds_reg_val;
  307. u32 pp_on_reg;
  308. u32 pp_on_reg_val;
  309. u32 pp_off_reg;
  310. u32 pp_off_reg_val;
  311. u32 pp_cycle_reg;
  312. u32 pp_cycle_reg_val;
  313. u32 pfit_reg;
  314. u32 pfit_reg_val;
  315. u16 terminator;
  316. } __packed;
  317. struct lvds_dvo_timing {
  318. u16 clock; /**< In 10khz */
  319. u8 hactive_lo;
  320. u8 hblank_lo;
  321. u8 hblank_hi:4;
  322. u8 hactive_hi:4;
  323. u8 vactive_lo;
  324. u8 vblank_lo;
  325. u8 vblank_hi:4;
  326. u8 vactive_hi:4;
  327. u8 hsync_off_lo;
  328. u8 hsync_pulse_width;
  329. u8 vsync_pulse_width:4;
  330. u8 vsync_off:4;
  331. u8 rsvd0:6;
  332. u8 hsync_off_hi:2;
  333. u8 h_image;
  334. u8 v_image;
  335. u8 max_hv;
  336. u8 h_border;
  337. u8 v_border;
  338. u8 rsvd1:3;
  339. u8 digital:2;
  340. u8 vsync_positive:1;
  341. u8 hsync_positive:1;
  342. u8 rsvd2:1;
  343. } __packed;
  344. struct lvds_pnp_id {
  345. u16 mfg_name;
  346. u16 product_code;
  347. u32 serial;
  348. u8 mfg_week;
  349. u8 mfg_year;
  350. } __packed;
  351. struct bdb_lvds_lfp_data_entry {
  352. struct lvds_fp_timing fp_timing;
  353. struct lvds_dvo_timing dvo_timing;
  354. struct lvds_pnp_id pnp_id;
  355. } __packed;
  356. struct bdb_lvds_lfp_data {
  357. struct bdb_lvds_lfp_data_entry data[16];
  358. } __packed;
  359. #define BDB_BACKLIGHT_TYPE_NONE 0
  360. #define BDB_BACKLIGHT_TYPE_PWM 2
  361. struct bdb_lfp_backlight_data_entry {
  362. u8 type:2;
  363. u8 active_low_pwm:1;
  364. u8 obsolete1:5;
  365. u16 pwm_freq_hz;
  366. u8 min_brightness;
  367. u8 obsolete2;
  368. u8 obsolete3;
  369. } __packed;
  370. struct bdb_lfp_backlight_data {
  371. u8 entry_size;
  372. struct bdb_lfp_backlight_data_entry data[16];
  373. u8 level[16];
  374. } __packed;
  375. struct aimdb_header {
  376. char signature[16];
  377. char oem_device[20];
  378. u16 aimdb_version;
  379. u16 aimdb_header_size;
  380. u16 aimdb_size;
  381. } __packed;
  382. struct aimdb_block {
  383. u8 aimdb_id;
  384. u16 aimdb_size;
  385. } __packed;
  386. struct vch_panel_data {
  387. u16 fp_timing_offset;
  388. u8 fp_timing_size;
  389. u16 dvo_timing_offset;
  390. u8 dvo_timing_size;
  391. u16 text_fitting_offset;
  392. u8 text_fitting_size;
  393. u16 graphics_fitting_offset;
  394. u8 graphics_fitting_size;
  395. } __packed;
  396. struct vch_bdb_22 {
  397. struct aimdb_block aimdb_block;
  398. struct vch_panel_data panels[16];
  399. } __packed;
  400. struct bdb_sdvo_lvds_options {
  401. u8 panel_backlight;
  402. u8 h40_set_panel_type;
  403. u8 panel_type;
  404. u8 ssc_clk_freq;
  405. u16 als_low_trip;
  406. u16 als_high_trip;
  407. u8 sclalarcoeff_tab_row_num;
  408. u8 sclalarcoeff_tab_row_size;
  409. u8 coefficient[8];
  410. u8 panel_misc_bits_1;
  411. u8 panel_misc_bits_2;
  412. u8 panel_misc_bits_3;
  413. u8 panel_misc_bits_4;
  414. } __packed;
  415. #define BDB_DRIVER_FEATURE_NO_LVDS 0
  416. #define BDB_DRIVER_FEATURE_INT_LVDS 1
  417. #define BDB_DRIVER_FEATURE_SDVO_LVDS 2
  418. #define BDB_DRIVER_FEATURE_EDP 3
  419. struct bdb_driver_features {
  420. u8 boot_dev_algorithm:1;
  421. u8 block_display_switch:1;
  422. u8 allow_display_switch:1;
  423. u8 hotplug_dvo:1;
  424. u8 dual_view_zoom:1;
  425. u8 int15h_hook:1;
  426. u8 sprite_in_clone:1;
  427. u8 primary_lfp_id:1;
  428. u16 boot_mode_x;
  429. u16 boot_mode_y;
  430. u8 boot_mode_bpp;
  431. u8 boot_mode_refresh;
  432. u16 enable_lfp_primary:1;
  433. u16 selective_mode_pruning:1;
  434. u16 dual_frequency:1;
  435. u16 render_clock_freq:1; /* 0: high freq; 1: low freq */
  436. u16 nt_clone_support:1;
  437. u16 power_scheme_ui:1; /* 0: CUI; 1: 3rd party */
  438. u16 sprite_display_assign:1; /* 0: secondary; 1: primary */
  439. u16 cui_aspect_scaling:1;
  440. u16 preserve_aspect_ratio:1;
  441. u16 sdvo_device_power_down:1;
  442. u16 crt_hotplug:1;
  443. u16 lvds_config:2;
  444. u16 tv_hotplug:1;
  445. u16 hdmi_config:2;
  446. u8 static_display:1;
  447. u8 reserved2:7;
  448. u16 legacy_crt_max_x;
  449. u16 legacy_crt_max_y;
  450. u8 legacy_crt_max_refresh;
  451. u8 hdmi_termination;
  452. u8 custom_vbt_version;
  453. /* Driver features data block */
  454. u16 rmpm_enabled:1;
  455. u16 s2ddt_enabled:1;
  456. u16 dpst_enabled:1;
  457. u16 bltclt_enabled:1;
  458. u16 adb_enabled:1;
  459. u16 drrs_enabled:1;
  460. u16 grs_enabled:1;
  461. u16 gpmt_enabled:1;
  462. u16 tbt_enabled:1;
  463. u16 psr_enabled:1;
  464. u16 ips_enabled:1;
  465. u16 reserved3:4;
  466. u16 pc_feature_valid:1;
  467. } __packed;
  468. #define EDP_18BPP 0
  469. #define EDP_24BPP 1
  470. #define EDP_30BPP 2
  471. #define EDP_RATE_1_62 0
  472. #define EDP_RATE_2_7 1
  473. #define EDP_LANE_1 0
  474. #define EDP_LANE_2 1
  475. #define EDP_LANE_4 3
  476. #define EDP_PREEMPHASIS_NONE 0
  477. #define EDP_PREEMPHASIS_3_5dB 1
  478. #define EDP_PREEMPHASIS_6dB 2
  479. #define EDP_PREEMPHASIS_9_5dB 3
  480. #define EDP_VSWING_0_4V 0
  481. #define EDP_VSWING_0_6V 1
  482. #define EDP_VSWING_0_8V 2
  483. #define EDP_VSWING_1_2V 3
  484. struct edp_power_seq {
  485. u16 t1_t3;
  486. u16 t8;
  487. u16 t9;
  488. u16 t10;
  489. u16 t11_t12;
  490. } __packed;
  491. struct edp_link_params {
  492. u8 rate:4;
  493. u8 lanes:4;
  494. u8 preemphasis:4;
  495. u8 vswing:4;
  496. } __packed;
  497. struct bdb_edp {
  498. struct edp_power_seq power_seqs[16];
  499. u32 color_depth;
  500. struct edp_link_params link_params[16];
  501. u32 sdrrs_msa_timing_delay;
  502. /* ith bit indicates enabled/disabled for (i+1)th panel */
  503. u16 edp_s3d_feature;
  504. u16 edp_t3_optimization;
  505. } __packed;
  506. void intel_setup_bios(struct drm_device *dev);
  507. int intel_parse_bios(struct drm_device *dev);
  508. /*
  509. * Driver<->VBIOS interaction occurs through scratch bits in
  510. * GR18 & SWF*.
  511. */
  512. /* GR18 bits are set on display switch and hotkey events */
  513. #define GR18_DRIVER_SWITCH_EN (1<<7) /* 0: VBIOS control, 1: driver control */
  514. #define GR18_HOTKEY_MASK 0x78 /* See also SWF4 15:0 */
  515. #define GR18_HK_NONE (0x0<<3)
  516. #define GR18_HK_LFP_STRETCH (0x1<<3)
  517. #define GR18_HK_TOGGLE_DISP (0x2<<3)
  518. #define GR18_HK_DISP_SWITCH (0x4<<3) /* see SWF14 15:0 for what to enable */
  519. #define GR18_HK_POPUP_DISABLED (0x6<<3)
  520. #define GR18_HK_POPUP_ENABLED (0x7<<3)
  521. #define GR18_HK_PFIT (0x8<<3)
  522. #define GR18_HK_APM_CHANGE (0xa<<3)
  523. #define GR18_HK_MULTIPLE (0xc<<3)
  524. #define GR18_USER_INT_EN (1<<2)
  525. #define GR18_A0000_FLUSH_EN (1<<1)
  526. #define GR18_SMM_EN (1<<0)
  527. /* Set by driver, cleared by VBIOS */
  528. #define SWF00_YRES_SHIFT 16
  529. #define SWF00_XRES_SHIFT 0
  530. #define SWF00_RES_MASK 0xffff
  531. /* Set by VBIOS at boot time and driver at runtime */
  532. #define SWF01_TV2_FORMAT_SHIFT 8
  533. #define SWF01_TV1_FORMAT_SHIFT 0
  534. #define SWF01_TV_FORMAT_MASK 0xffff
  535. #define SWF10_VBIOS_BLC_I2C_EN (1<<29)
  536. #define SWF10_GTT_OVERRIDE_EN (1<<28)
  537. #define SWF10_LFP_DPMS_OVR (1<<27) /* override DPMS on display switch */
  538. #define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
  539. #define SWF10_OLD_TOGGLE 0x0
  540. #define SWF10_TOGGLE_LIST_1 0x1
  541. #define SWF10_TOGGLE_LIST_2 0x2
  542. #define SWF10_TOGGLE_LIST_3 0x3
  543. #define SWF10_TOGGLE_LIST_4 0x4
  544. #define SWF10_PANNING_EN (1<<23)
  545. #define SWF10_DRIVER_LOADED (1<<22)
  546. #define SWF10_EXTENDED_DESKTOP (1<<21)
  547. #define SWF10_EXCLUSIVE_MODE (1<<20)
  548. #define SWF10_OVERLAY_EN (1<<19)
  549. #define SWF10_PLANEB_HOLDOFF (1<<18)
  550. #define SWF10_PLANEA_HOLDOFF (1<<17)
  551. #define SWF10_VGA_HOLDOFF (1<<16)
  552. #define SWF10_ACTIVE_DISP_MASK 0xffff
  553. #define SWF10_PIPEB_LFP2 (1<<15)
  554. #define SWF10_PIPEB_EFP2 (1<<14)
  555. #define SWF10_PIPEB_TV2 (1<<13)
  556. #define SWF10_PIPEB_CRT2 (1<<12)
  557. #define SWF10_PIPEB_LFP (1<<11)
  558. #define SWF10_PIPEB_EFP (1<<10)
  559. #define SWF10_PIPEB_TV (1<<9)
  560. #define SWF10_PIPEB_CRT (1<<8)
  561. #define SWF10_PIPEA_LFP2 (1<<7)
  562. #define SWF10_PIPEA_EFP2 (1<<6)
  563. #define SWF10_PIPEA_TV2 (1<<5)
  564. #define SWF10_PIPEA_CRT2 (1<<4)
  565. #define SWF10_PIPEA_LFP (1<<3)
  566. #define SWF10_PIPEA_EFP (1<<2)
  567. #define SWF10_PIPEA_TV (1<<1)
  568. #define SWF10_PIPEA_CRT (1<<0)
  569. #define SWF11_MEMORY_SIZE_SHIFT 16
  570. #define SWF11_SV_TEST_EN (1<<15)
  571. #define SWF11_IS_AGP (1<<14)
  572. #define SWF11_DISPLAY_HOLDOFF (1<<13)
  573. #define SWF11_DPMS_REDUCED (1<<12)
  574. #define SWF11_IS_VBE_MODE (1<<11)
  575. #define SWF11_PIPEB_ACCESS (1<<10) /* 0 here means pipe a */
  576. #define SWF11_DPMS_MASK 0x07
  577. #define SWF11_DPMS_OFF (1<<2)
  578. #define SWF11_DPMS_SUSPEND (1<<1)
  579. #define SWF11_DPMS_STANDBY (1<<0)
  580. #define SWF11_DPMS_ON 0
  581. #define SWF14_GFX_PFIT_EN (1<<31)
  582. #define SWF14_TEXT_PFIT_EN (1<<30)
  583. #define SWF14_LID_STATUS_CLOSED (1<<29) /* 0 here means open */
  584. #define SWF14_POPUP_EN (1<<28)
  585. #define SWF14_DISPLAY_HOLDOFF (1<<27)
  586. #define SWF14_DISP_DETECT_EN (1<<26)
  587. #define SWF14_DOCKING_STATUS_DOCKED (1<<25) /* 0 here means undocked */
  588. #define SWF14_DRIVER_STATUS (1<<24)
  589. #define SWF14_OS_TYPE_WIN9X (1<<23)
  590. #define SWF14_OS_TYPE_WINNT (1<<22)
  591. /* 21:19 rsvd */
  592. #define SWF14_PM_TYPE_MASK 0x00070000
  593. #define SWF14_PM_ACPI_VIDEO (0x4 << 16)
  594. #define SWF14_PM_ACPI (0x3 << 16)
  595. #define SWF14_PM_APM_12 (0x2 << 16)
  596. #define SWF14_PM_APM_11 (0x1 << 16)
  597. #define SWF14_HK_REQUEST_MASK 0x0000ffff /* see GR18 6:3 for event type */
  598. /* if GR18 indicates a display switch */
  599. #define SWF14_DS_PIPEB_LFP2_EN (1<<15)
  600. #define SWF14_DS_PIPEB_EFP2_EN (1<<14)
  601. #define SWF14_DS_PIPEB_TV2_EN (1<<13)
  602. #define SWF14_DS_PIPEB_CRT2_EN (1<<12)
  603. #define SWF14_DS_PIPEB_LFP_EN (1<<11)
  604. #define SWF14_DS_PIPEB_EFP_EN (1<<10)
  605. #define SWF14_DS_PIPEB_TV_EN (1<<9)
  606. #define SWF14_DS_PIPEB_CRT_EN (1<<8)
  607. #define SWF14_DS_PIPEA_LFP2_EN (1<<7)
  608. #define SWF14_DS_PIPEA_EFP2_EN (1<<6)
  609. #define SWF14_DS_PIPEA_TV2_EN (1<<5)
  610. #define SWF14_DS_PIPEA_CRT2_EN (1<<4)
  611. #define SWF14_DS_PIPEA_LFP_EN (1<<3)
  612. #define SWF14_DS_PIPEA_EFP_EN (1<<2)
  613. #define SWF14_DS_PIPEA_TV_EN (1<<1)
  614. #define SWF14_DS_PIPEA_CRT_EN (1<<0)
  615. /* if GR18 indicates a panel fitting request */
  616. #define SWF14_PFIT_EN (1<<0) /* 0 means disable */
  617. /* if GR18 indicates an APM change request */
  618. #define SWF14_APM_HIBERNATE 0x4
  619. #define SWF14_APM_SUSPEND 0x3
  620. #define SWF14_APM_STANDBY 0x1
  621. #define SWF14_APM_RESTORE 0x0
  622. /* Add the device class for LFP, TV, HDMI */
  623. #define DEVICE_TYPE_INT_LFP 0x1022
  624. #define DEVICE_TYPE_INT_TV 0x1009
  625. #define DEVICE_TYPE_HDMI 0x60D2
  626. #define DEVICE_TYPE_DP 0x68C6
  627. #define DEVICE_TYPE_eDP 0x78C6
  628. #define DEVICE_TYPE_CLASS_EXTENSION (1 << 15)
  629. #define DEVICE_TYPE_POWER_MANAGEMENT (1 << 14)
  630. #define DEVICE_TYPE_HOTPLUG_SIGNALING (1 << 13)
  631. #define DEVICE_TYPE_INTERNAL_CONNECTOR (1 << 12)
  632. #define DEVICE_TYPE_NOT_HDMI_OUTPUT (1 << 11)
  633. #define DEVICE_TYPE_MIPI_OUTPUT (1 << 10)
  634. #define DEVICE_TYPE_COMPOSITE_OUTPUT (1 << 9)
  635. #define DEVICE_TYPE_DUAL_CHANNEL (1 << 8)
  636. #define DEVICE_TYPE_HIGH_SPEED_LINK (1 << 6)
  637. #define DEVICE_TYPE_LVDS_SINGALING (1 << 5)
  638. #define DEVICE_TYPE_TMDS_DVI_SIGNALING (1 << 4)
  639. #define DEVICE_TYPE_VIDEO_SIGNALING (1 << 3)
  640. #define DEVICE_TYPE_DISPLAYPORT_OUTPUT (1 << 2)
  641. #define DEVICE_TYPE_DIGITAL_OUTPUT (1 << 1)
  642. #define DEVICE_TYPE_ANALOG_OUTPUT (1 << 0)
  643. /*
  644. * Bits we care about when checking for DEVICE_TYPE_eDP
  645. * Depending on the system, the other bits may or may not
  646. * be set for eDP outputs.
  647. */
  648. #define DEVICE_TYPE_eDP_BITS \
  649. (DEVICE_TYPE_INTERNAL_CONNECTOR | \
  650. DEVICE_TYPE_NOT_HDMI_OUTPUT | \
  651. DEVICE_TYPE_MIPI_OUTPUT | \
  652. DEVICE_TYPE_COMPOSITE_OUTPUT | \
  653. DEVICE_TYPE_DUAL_CHANNEL | \
  654. DEVICE_TYPE_LVDS_SINGALING | \
  655. DEVICE_TYPE_TMDS_DVI_SIGNALING | \
  656. DEVICE_TYPE_VIDEO_SIGNALING | \
  657. DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
  658. DEVICE_TYPE_DIGITAL_OUTPUT | \
  659. DEVICE_TYPE_ANALOG_OUTPUT)
  660. /* define the DVO port for HDMI output type */
  661. #define DVO_B 1
  662. #define DVO_C 2
  663. #define DVO_D 3
  664. /* define the PORT for DP output type */
  665. #define PORT_IDPB 7
  666. #define PORT_IDPC 8
  667. #define PORT_IDPD 9
  668. /* Possible values for the "DVO Port" field for versions >= 155: */
  669. #define DVO_PORT_HDMIA 0
  670. #define DVO_PORT_HDMIB 1
  671. #define DVO_PORT_HDMIC 2
  672. #define DVO_PORT_HDMID 3
  673. #define DVO_PORT_LVDS 4
  674. #define DVO_PORT_TV 5
  675. #define DVO_PORT_CRT 6
  676. #define DVO_PORT_DPB 7
  677. #define DVO_PORT_DPC 8
  678. #define DVO_PORT_DPD 9
  679. #define DVO_PORT_DPA 10
  680. #define DVO_PORT_MIPIA 21
  681. #define DVO_PORT_MIPIB 22
  682. #define DVO_PORT_MIPIC 23
  683. #define DVO_PORT_MIPID 24
  684. /* Block 52 contains MIPI Panel info
  685. * 6 such enteries will there. Index into correct
  686. * entery is based on the panel_index in #40 LFP
  687. */
  688. #define MAX_MIPI_CONFIGURATIONS 6
  689. #define MIPI_DSI_UNDEFINED_PANEL_ID 0
  690. #define MIPI_DSI_GENERIC_PANEL_ID 1
  691. struct mipi_config {
  692. u16 panel_id;
  693. /* General Params */
  694. u32 enable_dithering:1;
  695. u32 rsvd1:1;
  696. u32 is_bridge:1;
  697. u32 panel_arch_type:2;
  698. u32 is_cmd_mode:1;
  699. #define NON_BURST_SYNC_PULSE 0x1
  700. #define NON_BURST_SYNC_EVENTS 0x2
  701. #define BURST_MODE 0x3
  702. u32 video_transfer_mode:2;
  703. u32 cabc_supported:1;
  704. u32 pwm_blc:1;
  705. /* Bit 13:10 */
  706. #define PIXEL_FORMAT_RGB565 0x1
  707. #define PIXEL_FORMAT_RGB666 0x2
  708. #define PIXEL_FORMAT_RGB666_LOOSELY_PACKED 0x3
  709. #define PIXEL_FORMAT_RGB888 0x4
  710. u32 videomode_color_format:4;
  711. /* Bit 15:14 */
  712. #define ENABLE_ROTATION_0 0x0
  713. #define ENABLE_ROTATION_90 0x1
  714. #define ENABLE_ROTATION_180 0x2
  715. #define ENABLE_ROTATION_270 0x3
  716. u32 rotation:2;
  717. u32 bta_enabled:1;
  718. u32 rsvd2:15;
  719. /* 2 byte Port Description */
  720. #define DUAL_LINK_NOT_SUPPORTED 0
  721. #define DUAL_LINK_FRONT_BACK 1
  722. #define DUAL_LINK_PIXEL_ALT 2
  723. u16 dual_link:2;
  724. u16 lane_cnt:2;
  725. u16 rsvd3:12;
  726. u16 rsvd4;
  727. u8 rsvd5[5];
  728. u32 dsi_ddr_clk;
  729. u32 bridge_ref_clk;
  730. #define BYTE_CLK_SEL_20MHZ 0
  731. #define BYTE_CLK_SEL_10MHZ 1
  732. #define BYTE_CLK_SEL_5MHZ 2
  733. u8 byte_clk_sel:2;
  734. u8 rsvd6:6;
  735. /* DPHY Flags */
  736. u16 dphy_param_valid:1;
  737. u16 eot_pkt_disabled:1;
  738. u16 enable_clk_stop:1;
  739. u16 rsvd7:13;
  740. u32 hs_tx_timeout;
  741. u32 lp_rx_timeout;
  742. u32 turn_around_timeout;
  743. u32 device_reset_timer;
  744. u32 master_init_timer;
  745. u32 dbi_bw_timer;
  746. u32 lp_byte_clk_val;
  747. /* 4 byte Dphy Params */
  748. u32 prepare_cnt:6;
  749. u32 rsvd8:2;
  750. u32 clk_zero_cnt:8;
  751. u32 trail_cnt:5;
  752. u32 rsvd9:3;
  753. u32 exit_zero_cnt:6;
  754. u32 rsvd10:2;
  755. u32 clk_lane_switch_cnt;
  756. u32 hl_switch_cnt;
  757. u32 rsvd11[6];
  758. /* timings based on dphy spec */
  759. u8 tclk_miss;
  760. u8 tclk_post;
  761. u8 rsvd12;
  762. u8 tclk_pre;
  763. u8 tclk_prepare;
  764. u8 tclk_settle;
  765. u8 tclk_term_enable;
  766. u8 tclk_trail;
  767. u16 tclk_prepare_clkzero;
  768. u8 rsvd13;
  769. u8 td_term_enable;
  770. u8 teot;
  771. u8 ths_exit;
  772. u8 ths_prepare;
  773. u16 ths_prepare_hszero;
  774. u8 rsvd14;
  775. u8 ths_settle;
  776. u8 ths_skip;
  777. u8 ths_trail;
  778. u8 tinit;
  779. u8 tlpx;
  780. u8 rsvd15[3];
  781. /* GPIOs */
  782. u8 panel_enable;
  783. u8 bl_enable;
  784. u8 pwm_enable;
  785. u8 reset_r_n;
  786. u8 pwr_down_r;
  787. u8 stdby_r_n;
  788. } __packed;
  789. /* Block 52 contains MIPI configuration block
  790. * 6 * bdb_mipi_config, followed by 6 pps data
  791. * block below
  792. *
  793. * all delays has a unit of 100us
  794. */
  795. struct mipi_pps_data {
  796. u16 panel_on_delay;
  797. u16 bl_enable_delay;
  798. u16 bl_disable_delay;
  799. u16 panel_off_delay;
  800. u16 panel_power_cycle_delay;
  801. };
  802. struct bdb_mipi_config {
  803. struct mipi_config config[MAX_MIPI_CONFIGURATIONS];
  804. struct mipi_pps_data pps[MAX_MIPI_CONFIGURATIONS];
  805. };
  806. /* Block 53 contains MIPI sequences as needed by the panel
  807. * for enabling it. This block can be variable in size and
  808. * can be maximum of 6 blocks
  809. */
  810. struct bdb_mipi_sequence {
  811. u8 version;
  812. u8 data[0];
  813. };
  814. /* MIPI Sequnece Block definitions */
  815. enum mipi_seq {
  816. MIPI_SEQ_UNDEFINED = 0,
  817. MIPI_SEQ_ASSERT_RESET,
  818. MIPI_SEQ_INIT_OTP,
  819. MIPI_SEQ_DISPLAY_ON,
  820. MIPI_SEQ_DISPLAY_OFF,
  821. MIPI_SEQ_DEASSERT_RESET,
  822. MIPI_SEQ_MAX
  823. };
  824. enum mipi_seq_element {
  825. MIPI_SEQ_ELEM_UNDEFINED = 0,
  826. MIPI_SEQ_ELEM_SEND_PKT,
  827. MIPI_SEQ_ELEM_DELAY,
  828. MIPI_SEQ_ELEM_GPIO,
  829. MIPI_SEQ_ELEM_STATUS,
  830. MIPI_SEQ_ELEM_MAX
  831. };
  832. enum mipi_gpio_pin_index {
  833. MIPI_GPIO_UNDEFINED = 0,
  834. MIPI_GPIO_PANEL_ENABLE,
  835. MIPI_GPIO_BL_ENABLE,
  836. MIPI_GPIO_PWM_ENABLE,
  837. MIPI_GPIO_RESET_N,
  838. MIPI_GPIO_PWR_DOWN_R,
  839. MIPI_GPIO_STDBY_RST_N,
  840. MIPI_GPIO_MAX
  841. };
  842. #endif /* _I830_BIOS_H_ */