intel_bios.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972
  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. } __packed;
  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_PSR 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. /*
  190. * We used to keep this struct but without any version control. We should avoid
  191. * using it in the future, but it should be safe to keep using it in the old
  192. * code. Do not change; we rely on its size.
  193. */
  194. struct old_child_dev_config {
  195. u16 handle;
  196. u16 device_type;
  197. u8 device_id[10]; /* ascii string */
  198. u16 addin_offset;
  199. u8 dvo_port; /* See Device_PORT_* above */
  200. u8 i2c_pin;
  201. u8 slave_addr;
  202. u8 ddc_pin;
  203. u16 edid_ptr;
  204. u8 dvo_cfg; /* See DEVICE_CFG_* above */
  205. u8 dvo2_port;
  206. u8 i2c2_pin;
  207. u8 slave2_addr;
  208. u8 ddc2_pin;
  209. u8 capabilities;
  210. u8 dvo_wiring;/* See DEVICE_WIRE_* above */
  211. u8 dvo2_wiring;
  212. u16 extended_type;
  213. u8 dvo_function;
  214. } __packed;
  215. /* This one contains field offsets that are known to be common for all BDB
  216. * versions. Notice that the meaning of the contents contents may still change,
  217. * but at least the offsets are consistent. */
  218. /* Definitions for flags_1 */
  219. #define IBOOST_ENABLE (1<<3)
  220. struct common_child_dev_config {
  221. u16 handle;
  222. u16 device_type;
  223. u8 not_common1[12];
  224. u8 dvo_port;
  225. u8 not_common2[2];
  226. u8 ddc_pin;
  227. u16 edid_ptr;
  228. u8 obsolete;
  229. u8 flags_1;
  230. u8 not_common3[13];
  231. u8 iboost_level;
  232. } __packed;
  233. /* This field changes depending on the BDB version, so the most reliable way to
  234. * read it is by checking the BDB version and reading the raw pointer. */
  235. union child_device_config {
  236. /* This one is safe to be used anywhere, but the code should still check
  237. * the BDB version. */
  238. u8 raw[33];
  239. /* This one should only be kept for legacy code. */
  240. struct old_child_dev_config old;
  241. /* This one should also be safe to use anywhere, even without version
  242. * checks. */
  243. struct common_child_dev_config common;
  244. } __packed;
  245. struct bdb_general_definitions {
  246. /* DDC GPIO */
  247. u8 crt_ddc_gmbus_pin;
  248. /* DPMS bits */
  249. u8 dpms_acpi:1;
  250. u8 skip_boot_crt_detect:1;
  251. u8 dpms_aim:1;
  252. u8 rsvd1:5; /* finish byte */
  253. /* boot device bits */
  254. u8 boot_display[2];
  255. u8 child_dev_size;
  256. /*
  257. * Device info:
  258. * If TV is present, it'll be at devices[0].
  259. * LVDS will be next, either devices[0] or [1], if present.
  260. * On some platforms the number of device is 6. But could be as few as
  261. * 4 if both TV and LVDS are missing.
  262. * And the device num is related with the size of general definition
  263. * block. It is obtained by using the following formula:
  264. * number = (block_size - sizeof(bdb_general_definitions))/
  265. * defs->child_dev_size;
  266. */
  267. uint8_t devices[0];
  268. } __packed;
  269. /* Mask for DRRS / Panel Channel / SSC / BLT control bits extraction */
  270. #define MODE_MASK 0x3
  271. struct bdb_lvds_options {
  272. u8 panel_type;
  273. u8 rsvd1;
  274. /* LVDS capabilities, stored in a dword */
  275. u8 pfit_mode:2;
  276. u8 pfit_text_mode_enhanced:1;
  277. u8 pfit_gfx_mode_enhanced:1;
  278. u8 pfit_ratio_auto:1;
  279. u8 pixel_dither:1;
  280. u8 lvds_edid:1;
  281. u8 rsvd2:1;
  282. u8 rsvd4;
  283. /* LVDS Panel channel bits stored here */
  284. u32 lvds_panel_channel_bits;
  285. /* LVDS SSC (Spread Spectrum Clock) bits stored here. */
  286. u16 ssc_bits;
  287. u16 ssc_freq;
  288. u16 ssc_ddt;
  289. /* Panel color depth defined here */
  290. u16 panel_color_depth;
  291. /* LVDS panel type bits stored here */
  292. u32 dps_panel_type_bits;
  293. /* LVDS backlight control type bits stored here */
  294. u32 blt_control_type_bits;
  295. } __packed;
  296. /* LFP pointer table contains entries to the struct below */
  297. struct bdb_lvds_lfp_data_ptr {
  298. u16 fp_timing_offset; /* offsets are from start of bdb */
  299. u8 fp_table_size;
  300. u16 dvo_timing_offset;
  301. u8 dvo_table_size;
  302. u16 panel_pnp_id_offset;
  303. u8 pnp_table_size;
  304. } __packed;
  305. struct bdb_lvds_lfp_data_ptrs {
  306. u8 lvds_entries; /* followed by one or more lvds_data_ptr structs */
  307. struct bdb_lvds_lfp_data_ptr ptr[16];
  308. } __packed;
  309. /* LFP data has 3 blocks per entry */
  310. struct lvds_fp_timing {
  311. u16 x_res;
  312. u16 y_res;
  313. u32 lvds_reg;
  314. u32 lvds_reg_val;
  315. u32 pp_on_reg;
  316. u32 pp_on_reg_val;
  317. u32 pp_off_reg;
  318. u32 pp_off_reg_val;
  319. u32 pp_cycle_reg;
  320. u32 pp_cycle_reg_val;
  321. u32 pfit_reg;
  322. u32 pfit_reg_val;
  323. u16 terminator;
  324. } __packed;
  325. struct lvds_dvo_timing {
  326. u16 clock; /**< In 10khz */
  327. u8 hactive_lo;
  328. u8 hblank_lo;
  329. u8 hblank_hi:4;
  330. u8 hactive_hi:4;
  331. u8 vactive_lo;
  332. u8 vblank_lo;
  333. u8 vblank_hi:4;
  334. u8 vactive_hi:4;
  335. u8 hsync_off_lo;
  336. u8 hsync_pulse_width;
  337. u8 vsync_pulse_width:4;
  338. u8 vsync_off:4;
  339. u8 rsvd0:6;
  340. u8 hsync_off_hi:2;
  341. u8 h_image;
  342. u8 v_image;
  343. u8 max_hv;
  344. u8 h_border;
  345. u8 v_border;
  346. u8 rsvd1:3;
  347. u8 digital:2;
  348. u8 vsync_positive:1;
  349. u8 hsync_positive:1;
  350. u8 rsvd2:1;
  351. } __packed;
  352. struct lvds_pnp_id {
  353. u16 mfg_name;
  354. u16 product_code;
  355. u32 serial;
  356. u8 mfg_week;
  357. u8 mfg_year;
  358. } __packed;
  359. struct bdb_lvds_lfp_data_entry {
  360. struct lvds_fp_timing fp_timing;
  361. struct lvds_dvo_timing dvo_timing;
  362. struct lvds_pnp_id pnp_id;
  363. } __packed;
  364. struct bdb_lvds_lfp_data {
  365. struct bdb_lvds_lfp_data_entry data[16];
  366. } __packed;
  367. #define BDB_BACKLIGHT_TYPE_NONE 0
  368. #define BDB_BACKLIGHT_TYPE_PWM 2
  369. struct bdb_lfp_backlight_data_entry {
  370. u8 type:2;
  371. u8 active_low_pwm:1;
  372. u8 obsolete1:5;
  373. u16 pwm_freq_hz;
  374. u8 min_brightness;
  375. u8 obsolete2;
  376. u8 obsolete3;
  377. } __packed;
  378. struct bdb_lfp_backlight_data {
  379. u8 entry_size;
  380. struct bdb_lfp_backlight_data_entry data[16];
  381. u8 level[16];
  382. } __packed;
  383. struct aimdb_header {
  384. char signature[16];
  385. char oem_device[20];
  386. u16 aimdb_version;
  387. u16 aimdb_header_size;
  388. u16 aimdb_size;
  389. } __packed;
  390. struct aimdb_block {
  391. u8 aimdb_id;
  392. u16 aimdb_size;
  393. } __packed;
  394. struct vch_panel_data {
  395. u16 fp_timing_offset;
  396. u8 fp_timing_size;
  397. u16 dvo_timing_offset;
  398. u8 dvo_timing_size;
  399. u16 text_fitting_offset;
  400. u8 text_fitting_size;
  401. u16 graphics_fitting_offset;
  402. u8 graphics_fitting_size;
  403. } __packed;
  404. struct vch_bdb_22 {
  405. struct aimdb_block aimdb_block;
  406. struct vch_panel_data panels[16];
  407. } __packed;
  408. struct bdb_sdvo_lvds_options {
  409. u8 panel_backlight;
  410. u8 h40_set_panel_type;
  411. u8 panel_type;
  412. u8 ssc_clk_freq;
  413. u16 als_low_trip;
  414. u16 als_high_trip;
  415. u8 sclalarcoeff_tab_row_num;
  416. u8 sclalarcoeff_tab_row_size;
  417. u8 coefficient[8];
  418. u8 panel_misc_bits_1;
  419. u8 panel_misc_bits_2;
  420. u8 panel_misc_bits_3;
  421. u8 panel_misc_bits_4;
  422. } __packed;
  423. #define BDB_DRIVER_FEATURE_NO_LVDS 0
  424. #define BDB_DRIVER_FEATURE_INT_LVDS 1
  425. #define BDB_DRIVER_FEATURE_SDVO_LVDS 2
  426. #define BDB_DRIVER_FEATURE_EDP 3
  427. struct bdb_driver_features {
  428. u8 boot_dev_algorithm:1;
  429. u8 block_display_switch:1;
  430. u8 allow_display_switch:1;
  431. u8 hotplug_dvo:1;
  432. u8 dual_view_zoom:1;
  433. u8 int15h_hook:1;
  434. u8 sprite_in_clone:1;
  435. u8 primary_lfp_id:1;
  436. u16 boot_mode_x;
  437. u16 boot_mode_y;
  438. u8 boot_mode_bpp;
  439. u8 boot_mode_refresh;
  440. u16 enable_lfp_primary:1;
  441. u16 selective_mode_pruning:1;
  442. u16 dual_frequency:1;
  443. u16 render_clock_freq:1; /* 0: high freq; 1: low freq */
  444. u16 nt_clone_support:1;
  445. u16 power_scheme_ui:1; /* 0: CUI; 1: 3rd party */
  446. u16 sprite_display_assign:1; /* 0: secondary; 1: primary */
  447. u16 cui_aspect_scaling:1;
  448. u16 preserve_aspect_ratio:1;
  449. u16 sdvo_device_power_down:1;
  450. u16 crt_hotplug:1;
  451. u16 lvds_config:2;
  452. u16 tv_hotplug:1;
  453. u16 hdmi_config:2;
  454. u8 static_display:1;
  455. u8 reserved2:7;
  456. u16 legacy_crt_max_x;
  457. u16 legacy_crt_max_y;
  458. u8 legacy_crt_max_refresh;
  459. u8 hdmi_termination;
  460. u8 custom_vbt_version;
  461. /* Driver features data block */
  462. u16 rmpm_enabled:1;
  463. u16 s2ddt_enabled:1;
  464. u16 dpst_enabled:1;
  465. u16 bltclt_enabled:1;
  466. u16 adb_enabled:1;
  467. u16 drrs_enabled:1;
  468. u16 grs_enabled:1;
  469. u16 gpmt_enabled:1;
  470. u16 tbt_enabled:1;
  471. u16 psr_enabled:1;
  472. u16 ips_enabled:1;
  473. u16 reserved3:4;
  474. u16 pc_feature_valid:1;
  475. } __packed;
  476. #define EDP_18BPP 0
  477. #define EDP_24BPP 1
  478. #define EDP_30BPP 2
  479. #define EDP_RATE_1_62 0
  480. #define EDP_RATE_2_7 1
  481. #define EDP_LANE_1 0
  482. #define EDP_LANE_2 1
  483. #define EDP_LANE_4 3
  484. #define EDP_PREEMPHASIS_NONE 0
  485. #define EDP_PREEMPHASIS_3_5dB 1
  486. #define EDP_PREEMPHASIS_6dB 2
  487. #define EDP_PREEMPHASIS_9_5dB 3
  488. #define EDP_VSWING_0_4V 0
  489. #define EDP_VSWING_0_6V 1
  490. #define EDP_VSWING_0_8V 2
  491. #define EDP_VSWING_1_2V 3
  492. struct edp_power_seq {
  493. u16 t1_t3;
  494. u16 t8;
  495. u16 t9;
  496. u16 t10;
  497. u16 t11_t12;
  498. } __packed;
  499. struct edp_link_params {
  500. u8 rate:4;
  501. u8 lanes:4;
  502. u8 preemphasis:4;
  503. u8 vswing:4;
  504. } __packed;
  505. struct bdb_edp {
  506. struct edp_power_seq power_seqs[16];
  507. u32 color_depth;
  508. struct edp_link_params link_params[16];
  509. u32 sdrrs_msa_timing_delay;
  510. /* ith bit indicates enabled/disabled for (i+1)th panel */
  511. u16 edp_s3d_feature;
  512. u16 edp_t3_optimization;
  513. u64 edp_vswing_preemph; /* v173 */
  514. } __packed;
  515. struct psr_table {
  516. /* Feature bits */
  517. u8 full_link:1;
  518. u8 require_aux_to_wakeup:1;
  519. u8 feature_bits_rsvd:6;
  520. /* Wait times */
  521. u8 idle_frames:4;
  522. u8 lines_to_wait:3;
  523. u8 wait_times_rsvd:1;
  524. /* TP wake up time in multiple of 100 */
  525. u16 tp1_wakeup_time;
  526. u16 tp2_tp3_wakeup_time;
  527. } __packed;
  528. struct bdb_psr {
  529. struct psr_table psr_table[16];
  530. } __packed;
  531. int intel_parse_bios(struct drm_device *dev);
  532. /*
  533. * Driver<->VBIOS interaction occurs through scratch bits in
  534. * GR18 & SWF*.
  535. */
  536. /* GR18 bits are set on display switch and hotkey events */
  537. #define GR18_DRIVER_SWITCH_EN (1<<7) /* 0: VBIOS control, 1: driver control */
  538. #define GR18_HOTKEY_MASK 0x78 /* See also SWF4 15:0 */
  539. #define GR18_HK_NONE (0x0<<3)
  540. #define GR18_HK_LFP_STRETCH (0x1<<3)
  541. #define GR18_HK_TOGGLE_DISP (0x2<<3)
  542. #define GR18_HK_DISP_SWITCH (0x4<<3) /* see SWF14 15:0 for what to enable */
  543. #define GR18_HK_POPUP_DISABLED (0x6<<3)
  544. #define GR18_HK_POPUP_ENABLED (0x7<<3)
  545. #define GR18_HK_PFIT (0x8<<3)
  546. #define GR18_HK_APM_CHANGE (0xa<<3)
  547. #define GR18_HK_MULTIPLE (0xc<<3)
  548. #define GR18_USER_INT_EN (1<<2)
  549. #define GR18_A0000_FLUSH_EN (1<<1)
  550. #define GR18_SMM_EN (1<<0)
  551. /* Set by driver, cleared by VBIOS */
  552. #define SWF00_YRES_SHIFT 16
  553. #define SWF00_XRES_SHIFT 0
  554. #define SWF00_RES_MASK 0xffff
  555. /* Set by VBIOS at boot time and driver at runtime */
  556. #define SWF01_TV2_FORMAT_SHIFT 8
  557. #define SWF01_TV1_FORMAT_SHIFT 0
  558. #define SWF01_TV_FORMAT_MASK 0xffff
  559. #define SWF10_VBIOS_BLC_I2C_EN (1<<29)
  560. #define SWF10_GTT_OVERRIDE_EN (1<<28)
  561. #define SWF10_LFP_DPMS_OVR (1<<27) /* override DPMS on display switch */
  562. #define SWF10_ACTIVE_TOGGLE_LIST_MASK (7<<24)
  563. #define SWF10_OLD_TOGGLE 0x0
  564. #define SWF10_TOGGLE_LIST_1 0x1
  565. #define SWF10_TOGGLE_LIST_2 0x2
  566. #define SWF10_TOGGLE_LIST_3 0x3
  567. #define SWF10_TOGGLE_LIST_4 0x4
  568. #define SWF10_PANNING_EN (1<<23)
  569. #define SWF10_DRIVER_LOADED (1<<22)
  570. #define SWF10_EXTENDED_DESKTOP (1<<21)
  571. #define SWF10_EXCLUSIVE_MODE (1<<20)
  572. #define SWF10_OVERLAY_EN (1<<19)
  573. #define SWF10_PLANEB_HOLDOFF (1<<18)
  574. #define SWF10_PLANEA_HOLDOFF (1<<17)
  575. #define SWF10_VGA_HOLDOFF (1<<16)
  576. #define SWF10_ACTIVE_DISP_MASK 0xffff
  577. #define SWF10_PIPEB_LFP2 (1<<15)
  578. #define SWF10_PIPEB_EFP2 (1<<14)
  579. #define SWF10_PIPEB_TV2 (1<<13)
  580. #define SWF10_PIPEB_CRT2 (1<<12)
  581. #define SWF10_PIPEB_LFP (1<<11)
  582. #define SWF10_PIPEB_EFP (1<<10)
  583. #define SWF10_PIPEB_TV (1<<9)
  584. #define SWF10_PIPEB_CRT (1<<8)
  585. #define SWF10_PIPEA_LFP2 (1<<7)
  586. #define SWF10_PIPEA_EFP2 (1<<6)
  587. #define SWF10_PIPEA_TV2 (1<<5)
  588. #define SWF10_PIPEA_CRT2 (1<<4)
  589. #define SWF10_PIPEA_LFP (1<<3)
  590. #define SWF10_PIPEA_EFP (1<<2)
  591. #define SWF10_PIPEA_TV (1<<1)
  592. #define SWF10_PIPEA_CRT (1<<0)
  593. #define SWF11_MEMORY_SIZE_SHIFT 16
  594. #define SWF11_SV_TEST_EN (1<<15)
  595. #define SWF11_IS_AGP (1<<14)
  596. #define SWF11_DISPLAY_HOLDOFF (1<<13)
  597. #define SWF11_DPMS_REDUCED (1<<12)
  598. #define SWF11_IS_VBE_MODE (1<<11)
  599. #define SWF11_PIPEB_ACCESS (1<<10) /* 0 here means pipe a */
  600. #define SWF11_DPMS_MASK 0x07
  601. #define SWF11_DPMS_OFF (1<<2)
  602. #define SWF11_DPMS_SUSPEND (1<<1)
  603. #define SWF11_DPMS_STANDBY (1<<0)
  604. #define SWF11_DPMS_ON 0
  605. #define SWF14_GFX_PFIT_EN (1<<31)
  606. #define SWF14_TEXT_PFIT_EN (1<<30)
  607. #define SWF14_LID_STATUS_CLOSED (1<<29) /* 0 here means open */
  608. #define SWF14_POPUP_EN (1<<28)
  609. #define SWF14_DISPLAY_HOLDOFF (1<<27)
  610. #define SWF14_DISP_DETECT_EN (1<<26)
  611. #define SWF14_DOCKING_STATUS_DOCKED (1<<25) /* 0 here means undocked */
  612. #define SWF14_DRIVER_STATUS (1<<24)
  613. #define SWF14_OS_TYPE_WIN9X (1<<23)
  614. #define SWF14_OS_TYPE_WINNT (1<<22)
  615. /* 21:19 rsvd */
  616. #define SWF14_PM_TYPE_MASK 0x00070000
  617. #define SWF14_PM_ACPI_VIDEO (0x4 << 16)
  618. #define SWF14_PM_ACPI (0x3 << 16)
  619. #define SWF14_PM_APM_12 (0x2 << 16)
  620. #define SWF14_PM_APM_11 (0x1 << 16)
  621. #define SWF14_HK_REQUEST_MASK 0x0000ffff /* see GR18 6:3 for event type */
  622. /* if GR18 indicates a display switch */
  623. #define SWF14_DS_PIPEB_LFP2_EN (1<<15)
  624. #define SWF14_DS_PIPEB_EFP2_EN (1<<14)
  625. #define SWF14_DS_PIPEB_TV2_EN (1<<13)
  626. #define SWF14_DS_PIPEB_CRT2_EN (1<<12)
  627. #define SWF14_DS_PIPEB_LFP_EN (1<<11)
  628. #define SWF14_DS_PIPEB_EFP_EN (1<<10)
  629. #define SWF14_DS_PIPEB_TV_EN (1<<9)
  630. #define SWF14_DS_PIPEB_CRT_EN (1<<8)
  631. #define SWF14_DS_PIPEA_LFP2_EN (1<<7)
  632. #define SWF14_DS_PIPEA_EFP2_EN (1<<6)
  633. #define SWF14_DS_PIPEA_TV2_EN (1<<5)
  634. #define SWF14_DS_PIPEA_CRT2_EN (1<<4)
  635. #define SWF14_DS_PIPEA_LFP_EN (1<<3)
  636. #define SWF14_DS_PIPEA_EFP_EN (1<<2)
  637. #define SWF14_DS_PIPEA_TV_EN (1<<1)
  638. #define SWF14_DS_PIPEA_CRT_EN (1<<0)
  639. /* if GR18 indicates a panel fitting request */
  640. #define SWF14_PFIT_EN (1<<0) /* 0 means disable */
  641. /* if GR18 indicates an APM change request */
  642. #define SWF14_APM_HIBERNATE 0x4
  643. #define SWF14_APM_SUSPEND 0x3
  644. #define SWF14_APM_STANDBY 0x1
  645. #define SWF14_APM_RESTORE 0x0
  646. /* Add the device class for LFP, TV, HDMI */
  647. #define DEVICE_TYPE_INT_LFP 0x1022
  648. #define DEVICE_TYPE_INT_TV 0x1009
  649. #define DEVICE_TYPE_HDMI 0x60D2
  650. #define DEVICE_TYPE_DP 0x68C6
  651. #define DEVICE_TYPE_eDP 0x78C6
  652. #define DEVICE_TYPE_CLASS_EXTENSION (1 << 15)
  653. #define DEVICE_TYPE_POWER_MANAGEMENT (1 << 14)
  654. #define DEVICE_TYPE_HOTPLUG_SIGNALING (1 << 13)
  655. #define DEVICE_TYPE_INTERNAL_CONNECTOR (1 << 12)
  656. #define DEVICE_TYPE_NOT_HDMI_OUTPUT (1 << 11)
  657. #define DEVICE_TYPE_MIPI_OUTPUT (1 << 10)
  658. #define DEVICE_TYPE_COMPOSITE_OUTPUT (1 << 9)
  659. #define DEVICE_TYPE_DUAL_CHANNEL (1 << 8)
  660. #define DEVICE_TYPE_HIGH_SPEED_LINK (1 << 6)
  661. #define DEVICE_TYPE_LVDS_SINGALING (1 << 5)
  662. #define DEVICE_TYPE_TMDS_DVI_SIGNALING (1 << 4)
  663. #define DEVICE_TYPE_VIDEO_SIGNALING (1 << 3)
  664. #define DEVICE_TYPE_DISPLAYPORT_OUTPUT (1 << 2)
  665. #define DEVICE_TYPE_DIGITAL_OUTPUT (1 << 1)
  666. #define DEVICE_TYPE_ANALOG_OUTPUT (1 << 0)
  667. /*
  668. * Bits we care about when checking for DEVICE_TYPE_eDP
  669. * Depending on the system, the other bits may or may not
  670. * be set for eDP outputs.
  671. */
  672. #define DEVICE_TYPE_eDP_BITS \
  673. (DEVICE_TYPE_INTERNAL_CONNECTOR | \
  674. DEVICE_TYPE_MIPI_OUTPUT | \
  675. DEVICE_TYPE_COMPOSITE_OUTPUT | \
  676. DEVICE_TYPE_DUAL_CHANNEL | \
  677. DEVICE_TYPE_LVDS_SINGALING | \
  678. DEVICE_TYPE_TMDS_DVI_SIGNALING | \
  679. DEVICE_TYPE_VIDEO_SIGNALING | \
  680. DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
  681. DEVICE_TYPE_ANALOG_OUTPUT)
  682. /* define the DVO port for HDMI output type */
  683. #define DVO_B 1
  684. #define DVO_C 2
  685. #define DVO_D 3
  686. /* Possible values for the "DVO Port" field for versions >= 155: */
  687. #define DVO_PORT_HDMIA 0
  688. #define DVO_PORT_HDMIB 1
  689. #define DVO_PORT_HDMIC 2
  690. #define DVO_PORT_HDMID 3
  691. #define DVO_PORT_LVDS 4
  692. #define DVO_PORT_TV 5
  693. #define DVO_PORT_CRT 6
  694. #define DVO_PORT_DPB 7
  695. #define DVO_PORT_DPC 8
  696. #define DVO_PORT_DPD 9
  697. #define DVO_PORT_DPA 10
  698. #define DVO_PORT_DPE 11
  699. #define DVO_PORT_HDMIE 12
  700. #define DVO_PORT_MIPIA 21
  701. #define DVO_PORT_MIPIB 22
  702. #define DVO_PORT_MIPIC 23
  703. #define DVO_PORT_MIPID 24
  704. /* Block 52 contains MIPI Panel info
  705. * 6 such enteries will there. Index into correct
  706. * entery is based on the panel_index in #40 LFP
  707. */
  708. #define MAX_MIPI_CONFIGURATIONS 6
  709. #define MIPI_DSI_UNDEFINED_PANEL_ID 0
  710. #define MIPI_DSI_GENERIC_PANEL_ID 1
  711. /*
  712. * PMIC vs SoC Backlight support specified in pwm_blc
  713. * field in mipi_config block below.
  714. */
  715. #define PPS_BLC_PMIC 0
  716. #define PPS_BLC_SOC 1
  717. struct mipi_config {
  718. u16 panel_id;
  719. /* General Params */
  720. u32 enable_dithering:1;
  721. u32 rsvd1:1;
  722. u32 is_bridge:1;
  723. u32 panel_arch_type:2;
  724. u32 is_cmd_mode:1;
  725. #define NON_BURST_SYNC_PULSE 0x1
  726. #define NON_BURST_SYNC_EVENTS 0x2
  727. #define BURST_MODE 0x3
  728. u32 video_transfer_mode:2;
  729. u32 cabc_supported:1;
  730. u32 pwm_blc:1;
  731. /* Bit 13:10 */
  732. #define PIXEL_FORMAT_RGB565 0x1
  733. #define PIXEL_FORMAT_RGB666 0x2
  734. #define PIXEL_FORMAT_RGB666_LOOSELY_PACKED 0x3
  735. #define PIXEL_FORMAT_RGB888 0x4
  736. u32 videomode_color_format:4;
  737. /* Bit 15:14 */
  738. #define ENABLE_ROTATION_0 0x0
  739. #define ENABLE_ROTATION_90 0x1
  740. #define ENABLE_ROTATION_180 0x2
  741. #define ENABLE_ROTATION_270 0x3
  742. u32 rotation:2;
  743. u32 bta_enabled:1;
  744. u32 rsvd2:15;
  745. /* 2 byte Port Description */
  746. #define DUAL_LINK_NOT_SUPPORTED 0
  747. #define DUAL_LINK_FRONT_BACK 1
  748. #define DUAL_LINK_PIXEL_ALT 2
  749. u16 dual_link:2;
  750. u16 lane_cnt:2;
  751. u16 pixel_overlap:3;
  752. u16 rsvd3:9;
  753. u16 rsvd4;
  754. u8 rsvd5;
  755. u32 target_burst_mode_freq;
  756. u32 dsi_ddr_clk;
  757. u32 bridge_ref_clk;
  758. #define BYTE_CLK_SEL_20MHZ 0
  759. #define BYTE_CLK_SEL_10MHZ 1
  760. #define BYTE_CLK_SEL_5MHZ 2
  761. u8 byte_clk_sel:2;
  762. u8 rsvd6:6;
  763. /* DPHY Flags */
  764. u16 dphy_param_valid:1;
  765. u16 eot_pkt_disabled:1;
  766. u16 enable_clk_stop:1;
  767. u16 rsvd7:13;
  768. u32 hs_tx_timeout;
  769. u32 lp_rx_timeout;
  770. u32 turn_around_timeout;
  771. u32 device_reset_timer;
  772. u32 master_init_timer;
  773. u32 dbi_bw_timer;
  774. u32 lp_byte_clk_val;
  775. /* 4 byte Dphy Params */
  776. u32 prepare_cnt:6;
  777. u32 rsvd8:2;
  778. u32 clk_zero_cnt:8;
  779. u32 trail_cnt:5;
  780. u32 rsvd9:3;
  781. u32 exit_zero_cnt:6;
  782. u32 rsvd10:2;
  783. u32 clk_lane_switch_cnt;
  784. u32 hl_switch_cnt;
  785. u32 rsvd11[6];
  786. /* timings based on dphy spec */
  787. u8 tclk_miss;
  788. u8 tclk_post;
  789. u8 rsvd12;
  790. u8 tclk_pre;
  791. u8 tclk_prepare;
  792. u8 tclk_settle;
  793. u8 tclk_term_enable;
  794. u8 tclk_trail;
  795. u16 tclk_prepare_clkzero;
  796. u8 rsvd13;
  797. u8 td_term_enable;
  798. u8 teot;
  799. u8 ths_exit;
  800. u8 ths_prepare;
  801. u16 ths_prepare_hszero;
  802. u8 rsvd14;
  803. u8 ths_settle;
  804. u8 ths_skip;
  805. u8 ths_trail;
  806. u8 tinit;
  807. u8 tlpx;
  808. u8 rsvd15[3];
  809. /* GPIOs */
  810. u8 panel_enable;
  811. u8 bl_enable;
  812. u8 pwm_enable;
  813. u8 reset_r_n;
  814. u8 pwr_down_r;
  815. u8 stdby_r_n;
  816. } __packed;
  817. /* Block 52 contains MIPI configuration block
  818. * 6 * bdb_mipi_config, followed by 6 pps data
  819. * block below
  820. *
  821. * all delays has a unit of 100us
  822. */
  823. struct mipi_pps_data {
  824. u16 panel_on_delay;
  825. u16 bl_enable_delay;
  826. u16 bl_disable_delay;
  827. u16 panel_off_delay;
  828. u16 panel_power_cycle_delay;
  829. } __packed;
  830. struct bdb_mipi_config {
  831. struct mipi_config config[MAX_MIPI_CONFIGURATIONS];
  832. struct mipi_pps_data pps[MAX_MIPI_CONFIGURATIONS];
  833. } __packed;
  834. /* Block 53 contains MIPI sequences as needed by the panel
  835. * for enabling it. This block can be variable in size and
  836. * can be maximum of 6 blocks
  837. */
  838. struct bdb_mipi_sequence {
  839. u8 version;
  840. u8 data[0];
  841. } __packed;
  842. /* MIPI Sequnece Block definitions */
  843. enum mipi_seq {
  844. MIPI_SEQ_UNDEFINED = 0,
  845. MIPI_SEQ_ASSERT_RESET,
  846. MIPI_SEQ_INIT_OTP,
  847. MIPI_SEQ_DISPLAY_ON,
  848. MIPI_SEQ_DISPLAY_OFF,
  849. MIPI_SEQ_DEASSERT_RESET,
  850. MIPI_SEQ_MAX
  851. };
  852. enum mipi_seq_element {
  853. MIPI_SEQ_ELEM_UNDEFINED = 0,
  854. MIPI_SEQ_ELEM_SEND_PKT,
  855. MIPI_SEQ_ELEM_DELAY,
  856. MIPI_SEQ_ELEM_GPIO,
  857. MIPI_SEQ_ELEM_STATUS,
  858. MIPI_SEQ_ELEM_MAX
  859. };
  860. enum mipi_gpio_pin_index {
  861. MIPI_GPIO_UNDEFINED = 0,
  862. MIPI_GPIO_PANEL_ENABLE,
  863. MIPI_GPIO_BL_ENABLE,
  864. MIPI_GPIO_PWM_ENABLE,
  865. MIPI_GPIO_RESET_N,
  866. MIPI_GPIO_PWR_DOWN_R,
  867. MIPI_GPIO_STDBY_RST_N,
  868. MIPI_GPIO_MAX
  869. };
  870. #endif /* _I830_BIOS_H_ */