29 #define SLAVE_ADDR1 0x70
30 #define SLAVE_ADDR2 0x72
32 static void *find_section(
struct bdb_header *bdb,
int section_id)
36 u16 total, current_size;
44 while (index < total) {
45 current_id = *(base +
index);
47 current_size = *((
u16 *)(base + index));
49 if (current_id == section_id)
51 index += current_size;
65 edp = find_section(bdb,
BDB_EDP);
67 dev_priv->
edp.bpp = 18;
69 if (dev_priv->
edp.support) {
70 DRM_DEBUG_KMS(
"No eDP BDB found but eDP panel supported, assume %dbpp panel color depth.\n",
77 switch ((edp->
color_depth >> (panel_type * 2)) & 3) {
79 dev_priv->
edp.bpp = 18;
82 dev_priv->
edp.bpp = 24;
85 dev_priv->
edp.bpp = 30;
93 dev_priv->
edp.pps = *edp_pps;
95 DRM_DEBUG_KMS(
"EDP timing in vbt t1_t3 %d t8 %d t9 %d t10 %d t11_t12 %d\n",
96 dev_priv->
edp.pps.t1_t3, dev_priv->
edp.pps.t8,
97 dev_priv->
edp.pps.t9, dev_priv->
edp.pps.t10,
98 dev_priv->
edp.pps.t11_t12);
102 switch (edp_link_params->
lanes) {
104 dev_priv->
edp.lanes = 1;
107 dev_priv->
edp.lanes = 2;
111 dev_priv->
edp.lanes = 4;
114 DRM_DEBUG_KMS(
"VBT reports EDP: Lane_count %d, Lane_rate %d, Bpp %d\n",
115 dev_priv->
edp.lanes, dev_priv->
edp.rate, dev_priv->
edp.bpp);
131 switch (edp_link_params->
vswing) {
145 DRM_DEBUG_KMS(
"VBT reports EDP: VSwing %d, Preemph %d\n",
146 dev_priv->
edp.vswing, dev_priv->
edp.preemphasis);
150 get_blocksize(
void *
p)
154 block_ptr = (
u16 *)((
char *)p - 2);
155 block_size = *block_ptr;
159 static void fill_detail_timing_data(
struct drm_display_mode *panel_fixed_mode,
179 panel_fixed_mode->
clock = dvo_timing->
clock * 10;
207 void *bl_start =
NULL;
221 lvds_bl = kzalloc(
sizeof(*vbt_lvds_bl),
GFP_KERNEL);
223 dev_err(dev_priv->
dev->dev,
"out of memory for backlight data\n");
226 memcpy(lvds_bl, vbt_lvds_bl,
sizeof(*vbt_lvds_bl));
262 panel_fixed_mode = kzalloc(
sizeof(*panel_fixed_mode),
264 if (panel_fixed_mode ==
NULL) {
265 dev_err(dev_priv->
dev->dev,
"out of memory for fixed panel mode\n");
270 fill_detail_timing_data(panel_fixed_mode, dvo_timing);
272 if (panel_fixed_mode->
htotal > 0 && panel_fixed_mode->
vtotal > 0) {
276 dev_dbg(dev_priv->
dev->dev,
"ignoring invalid LVDS VBT\n");
278 kfree(panel_fixed_mode);
294 if (!sdvo_lvds_options)
301 panel_fixed_mode = kzalloc(
sizeof(*panel_fixed_mode),
GFP_KERNEL);
303 if (!panel_fixed_mode)
306 fill_detail_timing_data(panel_fixed_mode,
343 int i, child_device_num,
count;
348 DRM_DEBUG_KMS(
"No general definition block is found, unable to construct sdvo mapping.\n");
358 DRM_DEBUG_KMS(
"different child size is found. Invalid.\n");
362 block_size = get_blocksize(p_defs);
364 child_device_num = (block_size -
sizeof(*p_defs)) /
367 for (i = 0; i < child_device_num; i++) {
384 DRM_DEBUG_KMS(
"Incorrect SDVO port. Skip it\n");
387 DRM_DEBUG_KMS(
"the SDVO device with slave addr %2x is found on"
400 DRM_DEBUG_KMS(
"SDVO device: dvo=%x, addr=%x, wiring=%d, ddc_pin=%d, i2c_pin=%d\n",
407 DRM_DEBUG_KMS(
"Maybe one SDVO port is shared by "
408 "two SDVO device.\n");
413 DRM_DEBUG_KMS(
"there exists the slave2_addr. Maybe this"
414 " is a SDVO device with multiple inputs.\n");
421 DRM_DEBUG_KMS(
"No SDVO device info is found in VBT\n");
438 dev_priv->
edp.support = 1;
453 int i, child_device_num,
count;
458 DRM_DEBUG_KMS(
"No general definition block is found, no devices defined.\n");
468 DRM_DEBUG_KMS(
"different child size is found. Invalid.\n");
472 block_size = get_blocksize(p_defs);
474 child_device_num = (block_size -
sizeof(*p_defs)) /
478 for (i = 0; i < child_device_num; i++) {
487 DRM_DEBUG_KMS(
"no child dev is parsed from VBT\n");
492 DRM_DEBUG_KMS(
"No memory space for child devices\n");
498 for (i = 0; i < child_device_num; i++) {
506 memcpy((
void *)child_dev_ptr, (
void *)p_child,
544 DRM_DEBUG_KMS(
"Using VBT from OpRegion: %20s\n",
557 for (i = 0; i + 4 <
size; i++) {
558 if (!
memcmp(bios + i,
"$VBT", 4)) {
565 dev_err(dev->dev,
"VBT signature missing\n");
573 parse_general_features(dev_priv, bdb);
574 parse_driver_features(dev_priv, bdb);
575 parse_lfp_panel_data(dev_priv, bdb);
576 parse_sdvo_panel_data(dev_priv, bdb);
577 parse_sdvo_device_mapping(dev_priv, bdb);
578 parse_device_mapping(dev_priv, bdb);
579 parse_backlight_data(dev_priv, bdb);
580 parse_edp(dev_priv, bdb);