Lines Matching +full:op +full:- +full:panel
59 * blocks have a 1-byte Block ID, 2-byte Block Size, and Block Size bytes of
92 return _get_blocksize(block_data - 3); in get_blocksize()
105 index += bdb->header_size; in find_raw_section()
106 total = bdb->bdb_size; in find_raw_section()
138 return block - bdb; in raw_block_offset()
153 list_for_each_entry(entry, &display->vbt.bdb_blocks, node) { in bdb_find_section()
154 if (entry->section_id == section_id) in bdb_find_section()
155 return entry->data + 3; in bdb_find_section()
213 if (ptrs->panel_name.table_size) in lfp_data_min_size()
214 size = max(size, ptrs->panel_name.offset + in lfp_data_min_size()
237 if (ptrs->num_entries != 3) in validate_lfp_data_ptrs()
240 fp_timing_size = ptrs->ptr[0].fp_timing.table_size; in validate_lfp_data_ptrs()
241 dvo_timing_size = ptrs->ptr[0].dvo_timing.table_size; in validate_lfp_data_ptrs()
242 panel_pnp_id_size = ptrs->ptr[0].panel_pnp_id.table_size; in validate_lfp_data_ptrs()
243 panel_name_size = ptrs->panel_name.table_size; in validate_lfp_data_ptrs()
256 lfp_data_size = ptrs->ptr[1].fp_timing.offset - ptrs->ptr[0].fp_timing.offset; in validate_lfp_data_ptrs()
262 if (ptrs->ptr[i].fp_timing.table_size != fp_timing_size || in validate_lfp_data_ptrs()
263 ptrs->ptr[i].dvo_timing.table_size != dvo_timing_size || in validate_lfp_data_ptrs()
264 ptrs->ptr[i].panel_pnp_id.table_size != panel_pnp_id_size) in validate_lfp_data_ptrs()
267 if (ptrs->ptr[i].fp_timing.offset - ptrs->ptr[i-1].fp_timing.offset != lfp_data_size || in validate_lfp_data_ptrs()
268 ptrs->ptr[i].dvo_timing.offset - ptrs->ptr[i-1].dvo_timing.offset != lfp_data_size || in validate_lfp_data_ptrs()
269 ptrs->ptr[i].panel_pnp_id.offset - ptrs->ptr[i-1].panel_pnp_id.offset != lfp_data_size) in validate_lfp_data_ptrs()
285 if (ptrs->ptr[0].fp_timing.offset + fp_timing_size != ptrs->ptr[0].dvo_timing.offset || in validate_lfp_data_ptrs()
286 ptrs->ptr[0].dvo_timing.offset + dvo_timing_size != ptrs->ptr[0].panel_pnp_id.offset || in validate_lfp_data_ptrs()
287 ptrs->ptr[0].panel_pnp_id.offset + panel_pnp_id_size != lfp_data_size) in validate_lfp_data_ptrs()
292 if (ptrs->ptr[i].fp_timing.offset + fp_timing_size > data_block_size || in validate_lfp_data_ptrs()
293 ptrs->ptr[i].dvo_timing.offset + dvo_timing_size > data_block_size || in validate_lfp_data_ptrs()
294 ptrs->ptr[i].panel_pnp_id.offset + panel_pnp_id_size > data_block_size) in validate_lfp_data_ptrs()
298 if (ptrs->panel_name.offset + 16 * panel_name_size > data_block_size) in validate_lfp_data_ptrs()
303 const u16 *t = data_block + ptrs->ptr[i].fp_timing.offset + in validate_lfp_data_ptrs()
304 fp_timing_size - 2; in validate_lfp_data_ptrs()
323 if (ptrs->ptr[i].fp_timing.offset < offset || in fixup_lfp_data_ptrs()
324 ptrs->ptr[i].dvo_timing.offset < offset || in fixup_lfp_data_ptrs()
325 ptrs->ptr[i].panel_pnp_id.offset < offset) in fixup_lfp_data_ptrs()
328 ptrs->ptr[i].fp_timing.offset -= offset; in fixup_lfp_data_ptrs()
329 ptrs->ptr[i].dvo_timing.offset -= offset; in fixup_lfp_data_ptrs()
330 ptrs->ptr[i].panel_pnp_id.offset -= offset; in fixup_lfp_data_ptrs()
333 if (ptrs->panel_name.table_size) { in fixup_lfp_data_ptrs()
334 if (ptrs->panel_name.offset < offset) in fixup_lfp_data_ptrs()
337 ptrs->panel_name.offset -= offset; in fixup_lfp_data_ptrs()
349 table->table_size = table_size; in make_lfp_data_ptr()
350 table->offset = total_size - table_size; in make_lfp_data_ptr()
352 return total_size - table_size; in make_lfp_data_ptr()
359 next->table_size = prev->table_size; in next_lfp_data_ptr()
360 next->offset = prev->offset + size; in next_lfp_data_ptr()
377 if (display->vbt.version < 155) in generate_lfp_data_ptrs()
386 drm_dbg_kms(display->drm, "Generating LFP data table pointers\n"); in generate_lfp_data_ptrs()
404 size = make_lfp_data_ptr(&ptrs->ptr[0].panel_pnp_id, table_size, size); in generate_lfp_data_ptrs()
407 size = make_lfp_data_ptr(&ptrs->ptr[0].dvo_timing, table_size, size); in generate_lfp_data_ptrs()
410 size = make_lfp_data_ptr(&ptrs->ptr[0].fp_timing, table_size, size); in generate_lfp_data_ptrs()
412 if (ptrs->ptr[0].fp_timing.table_size) in generate_lfp_data_ptrs()
413 ptrs->num_entries++; in generate_lfp_data_ptrs()
414 if (ptrs->ptr[0].dvo_timing.table_size) in generate_lfp_data_ptrs()
415 ptrs->num_entries++; in generate_lfp_data_ptrs()
416 if (ptrs->ptr[0].panel_pnp_id.table_size) in generate_lfp_data_ptrs()
417 ptrs->num_entries++; in generate_lfp_data_ptrs()
419 if (size != 0 || ptrs->num_entries != 3) { in generate_lfp_data_ptrs()
427 next_lfp_data_ptr(&ptrs->ptr[i].fp_timing, &ptrs->ptr[i-1].fp_timing, size); in generate_lfp_data_ptrs()
428 next_lfp_data_ptr(&ptrs->ptr[i].dvo_timing, &ptrs->ptr[i-1].dvo_timing, size); in generate_lfp_data_ptrs()
429 next_lfp_data_ptr(&ptrs->ptr[i].panel_pnp_id, &ptrs->ptr[i-1].panel_pnp_id, size); in generate_lfp_data_ptrs()
435 ptrs->panel_name.table_size = table_size; in generate_lfp_data_ptrs()
436 ptrs->panel_name.offset = size * 16; in generate_lfp_data_ptrs()
439 offset = block - bdb; in generate_lfp_data_ptrs()
442 ptrs->ptr[i].fp_timing.offset += offset; in generate_lfp_data_ptrs()
443 ptrs->ptr[i].dvo_timing.offset += offset; in generate_lfp_data_ptrs()
444 ptrs->ptr[i].panel_pnp_id.offset += offset; in generate_lfp_data_ptrs()
447 if (ptrs->panel_name.table_size) in generate_lfp_data_ptrs()
448 ptrs->panel_name.offset += offset; in generate_lfp_data_ptrs()
474 drm_WARN(display->drm, min_size == 0, in init_bdb_block()
493 entry->section_id = section_id; in init_bdb_block()
494 memcpy(entry->data, block - 3, block_size + 3); in init_bdb_block()
498 drm_dbg_kms(display->drm, in init_bdb_block()
503 !fixup_lfp_data_ptrs(bdb, entry->data + 3)) { in init_bdb_block()
504 drm_err(display->drm, in init_bdb_block()
510 list_add_tail(&entry->node, &display->vbt.bdb_blocks); in init_bdb_block()
534 panel_fixed_mode->hdisplay = (dvo_timing->hactive_hi << 8) | in fill_detail_timing_data()
535 dvo_timing->hactive_lo; in fill_detail_timing_data()
536 panel_fixed_mode->hsync_start = panel_fixed_mode->hdisplay + in fill_detail_timing_data()
537 ((dvo_timing->hsync_off_hi << 8) | dvo_timing->hsync_off_lo); in fill_detail_timing_data()
538 panel_fixed_mode->hsync_end = panel_fixed_mode->hsync_start + in fill_detail_timing_data()
539 ((dvo_timing->hsync_pulse_width_hi << 8) | in fill_detail_timing_data()
540 dvo_timing->hsync_pulse_width_lo); in fill_detail_timing_data()
541 panel_fixed_mode->htotal = panel_fixed_mode->hdisplay + in fill_detail_timing_data()
542 ((dvo_timing->hblank_hi << 8) | dvo_timing->hblank_lo); in fill_detail_timing_data()
544 panel_fixed_mode->vdisplay = (dvo_timing->vactive_hi << 8) | in fill_detail_timing_data()
545 dvo_timing->vactive_lo; in fill_detail_timing_data()
546 panel_fixed_mode->vsync_start = panel_fixed_mode->vdisplay + in fill_detail_timing_data()
547 ((dvo_timing->vsync_off_hi << 4) | dvo_timing->vsync_off_lo); in fill_detail_timing_data()
548 panel_fixed_mode->vsync_end = panel_fixed_mode->vsync_start + in fill_detail_timing_data()
549 ((dvo_timing->vsync_pulse_width_hi << 4) | in fill_detail_timing_data()
550 dvo_timing->vsync_pulse_width_lo); in fill_detail_timing_data()
551 panel_fixed_mode->vtotal = panel_fixed_mode->vdisplay + in fill_detail_timing_data()
552 ((dvo_timing->vblank_hi << 8) | dvo_timing->vblank_lo); in fill_detail_timing_data()
553 panel_fixed_mode->clock = dvo_timing->clock * 10; in fill_detail_timing_data()
554 panel_fixed_mode->type = DRM_MODE_TYPE_PREFERRED; in fill_detail_timing_data()
556 if (dvo_timing->hsync_positive) in fill_detail_timing_data()
557 panel_fixed_mode->flags |= DRM_MODE_FLAG_PHSYNC; in fill_detail_timing_data()
559 panel_fixed_mode->flags |= DRM_MODE_FLAG_NHSYNC; in fill_detail_timing_data()
561 if (dvo_timing->vsync_positive) in fill_detail_timing_data()
562 panel_fixed_mode->flags |= DRM_MODE_FLAG_PVSYNC; in fill_detail_timing_data()
564 panel_fixed_mode->flags |= DRM_MODE_FLAG_NVSYNC; in fill_detail_timing_data()
566 panel_fixed_mode->width_mm = (dvo_timing->himage_hi << 8) | in fill_detail_timing_data()
567 dvo_timing->himage_lo; in fill_detail_timing_data()
568 panel_fixed_mode->height_mm = (dvo_timing->vimage_hi << 8) | in fill_detail_timing_data()
569 dvo_timing->vimage_lo; in fill_detail_timing_data()
572 if (panel_fixed_mode->hsync_end > panel_fixed_mode->htotal) { in fill_detail_timing_data()
573 drm_dbg_kms(display->drm, "reducing hsync_end %d->%d\n", in fill_detail_timing_data()
574 panel_fixed_mode->hsync_end, panel_fixed_mode->htotal); in fill_detail_timing_data()
575 panel_fixed_mode->hsync_end = panel_fixed_mode->htotal; in fill_detail_timing_data()
577 if (panel_fixed_mode->vsync_end > panel_fixed_mode->vtotal) { in fill_detail_timing_data()
578 drm_dbg_kms(display->drm, "reducing vsync_end %d->%d\n", in fill_detail_timing_data()
579 panel_fixed_mode->vsync_end, panel_fixed_mode->vtotal); in fill_detail_timing_data()
580 panel_fixed_mode->vsync_end = panel_fixed_mode->vtotal; in fill_detail_timing_data()
591 return (const void *)data + ptrs->ptr[index].dvo_timing.offset; in get_lfp_dvo_timing()
599 return (const void *)data + ptrs->ptr[index].fp_timing.offset; in get_lfp_fp_timing()
610 return (const void *)data + ptrs->ptr[index].panel_pnp_id.offset; in get_lfp_pnp_id()
617 if (ptrs->panel_name.table_size) in get_lfp_data_tail()
618 return (const void *)data + ptrs->panel_name.offset; in get_lfp_data_tail()
638 return -1; in vbt_get_panel_type()
640 if (lfp_options->panel_type > 0xf && in vbt_get_panel_type()
641 lfp_options->panel_type != 0xff) { in vbt_get_panel_type()
642 drm_dbg_kms(display->drm, "Invalid VBT panel type 0x%x\n", in vbt_get_panel_type()
643 lfp_options->panel_type); in vbt_get_panel_type()
644 return -1; in vbt_get_panel_type()
647 if (devdata && devdata->child.handle == DEVICE_HANDLE_LFP2) in vbt_get_panel_type()
648 return lfp_options->panel_type2; in vbt_get_panel_type()
650 drm_WARN_ON(display->drm, in vbt_get_panel_type()
651 devdata && devdata->child.handle != DEVICE_HANDLE_LFP1); in vbt_get_panel_type()
653 return lfp_options->panel_type; in vbt_get_panel_type()
664 int i, best = -1; in pnpid_get_panel_type()
667 return -1; in pnpid_get_panel_type()
675 p = drm_dbg_printer(display->drm, DRM_UT_KMS, "EDID"); in pnpid_get_panel_type()
680 return -1; in pnpid_get_panel_type()
684 return -1; in pnpid_get_panel_type()
710 return use_fallback ? 0 : -1; in fallback_get_panel_type()
754 drm_WARN_ON(display->drm, panel_types[i].panel_type > 0xf && in get_panel_type()
758 drm_dbg_kms(display->drm, "Panel type (%s): %d\n", in get_panel_type()
773 drm_dbg_kms(display->drm, "Selected panel type (%s): %d\n", in get_panel_type()
781 return (value >> (panel_type * num_bits)) & (BIT(num_bits) - 1); in panel_bits()
789 /* Parse general panel options */
792 struct intel_panel *panel) in parse_panel_options() argument
795 int panel_type = panel->vbt.panel_type; in parse_panel_options()
802 panel->vbt.lvds_dither = lfp_options->pixel_dither; in parse_panel_options()
812 drrs_mode = panel_bits(lfp_options->dps_panel_type_bits, in parse_panel_options()
821 panel->vbt.drrs_type = DRRS_TYPE_STATIC; in parse_panel_options()
822 drm_dbg_kms(display->drm, "DRRS supported mode is static\n"); in parse_panel_options()
825 panel->vbt.drrs_type = DRRS_TYPE_SEAMLESS; in parse_panel_options()
826 drm_dbg_kms(display->drm, in parse_panel_options()
830 panel->vbt.drrs_type = DRRS_TYPE_NONE; in parse_panel_options()
831 drm_dbg_kms(display->drm, in parse_panel_options()
839 struct intel_panel *panel, in parse_lfp_panel_dtd() argument
846 int panel_type = panel->vbt.panel_type; in parse_lfp_panel_dtd()
858 panel->vbt.lfp_vbt_mode = panel_fixed_mode; in parse_lfp_panel_dtd()
860 drm_dbg_kms(display->drm, in parse_lfp_panel_dtd()
861 "Found panel mode in BIOS VBT legacy lfp table: " DRM_MODE_FMT "\n", in parse_lfp_panel_dtd()
869 if (fp_timing->x_res == panel_fixed_mode->hdisplay && in parse_lfp_panel_dtd()
870 fp_timing->y_res == panel_fixed_mode->vdisplay) { in parse_lfp_panel_dtd()
871 panel->vbt.bios_lvds_val = fp_timing->lvds_reg_val; in parse_lfp_panel_dtd()
872 drm_dbg_kms(display->drm, in parse_lfp_panel_dtd()
874 panel->vbt.bios_lvds_val); in parse_lfp_panel_dtd()
880 struct intel_panel *panel) in parse_lfp_data() argument
887 int panel_type = panel->vbt.panel_type; in parse_lfp_data()
897 if (!panel->vbt.lfp_vbt_mode) in parse_lfp_data()
898 parse_lfp_panel_dtd(display, panel, data, ptrs); in parse_lfp_data()
902 p = drm_dbg_printer(display->drm, DRM_UT_KMS, "Panel"); in parse_lfp_data()
909 drm_dbg_kms(display->drm, "Panel name: %.*s\n", in parse_lfp_data()
910 (int)sizeof(tail->panel_name[0].name), in parse_lfp_data()
911 tail->panel_name[panel_type].name); in parse_lfp_data()
913 if (display->vbt.version >= 188) { in parse_lfp_data()
914 panel->vbt.seamless_drrs_min_refresh_rate = in parse_lfp_data()
915 tail->seamless_drrs_min_refresh_rate[panel_type]; in parse_lfp_data()
916 drm_dbg_kms(display->drm, in parse_lfp_data()
918 panel->vbt.seamless_drrs_min_refresh_rate); in parse_lfp_data()
924 struct intel_panel *panel) in parse_generic_dtd() argument
933 * the "LFP panel tables" block (42). As of VBT revision 229 the in parse_generic_dtd()
939 if (display->vbt.version < 229) in parse_generic_dtd()
946 if (generic_dtd->gdtd_size < sizeof(struct generic_dtd_entry)) { in parse_generic_dtd()
947 drm_err(display->drm, "GDTD size %u is too small.\n", in parse_generic_dtd()
948 generic_dtd->gdtd_size); in parse_generic_dtd()
950 } else if (generic_dtd->gdtd_size != in parse_generic_dtd()
952 drm_err(display->drm, "Unexpected GDTD size %u\n", in parse_generic_dtd()
953 generic_dtd->gdtd_size); in parse_generic_dtd()
957 num_dtd = (get_blocksize(generic_dtd) - in parse_generic_dtd()
958 sizeof(struct bdb_generic_dtd)) / generic_dtd->gdtd_size; in parse_generic_dtd()
959 if (panel->vbt.panel_type >= num_dtd) { in parse_generic_dtd()
960 drm_err(display->drm, in parse_generic_dtd()
961 "Panel type %d not found in table of %d DTD's\n", in parse_generic_dtd()
962 panel->vbt.panel_type, num_dtd); in parse_generic_dtd()
966 dtd = &generic_dtd->dtd[panel->vbt.panel_type]; in parse_generic_dtd()
972 panel_fixed_mode->hdisplay = dtd->hactive; in parse_generic_dtd()
973 panel_fixed_mode->hsync_start = in parse_generic_dtd()
974 panel_fixed_mode->hdisplay + dtd->hfront_porch; in parse_generic_dtd()
975 panel_fixed_mode->hsync_end = in parse_generic_dtd()
976 panel_fixed_mode->hsync_start + dtd->hsync; in parse_generic_dtd()
977 panel_fixed_mode->htotal = in parse_generic_dtd()
978 panel_fixed_mode->hdisplay + dtd->hblank; in parse_generic_dtd()
980 panel_fixed_mode->vdisplay = dtd->vactive; in parse_generic_dtd()
981 panel_fixed_mode->vsync_start = in parse_generic_dtd()
982 panel_fixed_mode->vdisplay + dtd->vfront_porch; in parse_generic_dtd()
983 panel_fixed_mode->vsync_end = in parse_generic_dtd()
984 panel_fixed_mode->vsync_start + dtd->vsync; in parse_generic_dtd()
985 panel_fixed_mode->vtotal = in parse_generic_dtd()
986 panel_fixed_mode->vdisplay + dtd->vblank; in parse_generic_dtd()
988 panel_fixed_mode->clock = dtd->pixel_clock; in parse_generic_dtd()
989 panel_fixed_mode->width_mm = dtd->width_mm; in parse_generic_dtd()
990 panel_fixed_mode->height_mm = dtd->height_mm; in parse_generic_dtd()
992 panel_fixed_mode->type = DRM_MODE_TYPE_PREFERRED; in parse_generic_dtd()
995 if (dtd->hsync_positive_polarity) in parse_generic_dtd()
996 panel_fixed_mode->flags |= DRM_MODE_FLAG_PHSYNC; in parse_generic_dtd()
998 panel_fixed_mode->flags |= DRM_MODE_FLAG_NHSYNC; in parse_generic_dtd()
1000 if (dtd->vsync_positive_polarity) in parse_generic_dtd()
1001 panel_fixed_mode->flags |= DRM_MODE_FLAG_PVSYNC; in parse_generic_dtd()
1003 panel_fixed_mode->flags |= DRM_MODE_FLAG_NVSYNC; in parse_generic_dtd()
1005 drm_dbg_kms(display->drm, in parse_generic_dtd()
1006 "Found panel mode in BIOS VBT generic dtd table: " DRM_MODE_FMT "\n", in parse_generic_dtd()
1009 panel->vbt.lfp_vbt_mode = panel_fixed_mode; in parse_generic_dtd()
1014 struct intel_panel *panel) in parse_lfp_backlight() argument
1018 int panel_type = panel->vbt.panel_type; in parse_lfp_backlight()
1025 if (backlight_data->entry_size != sizeof(backlight_data->data[0])) { in parse_lfp_backlight()
1026 drm_dbg_kms(display->drm, in parse_lfp_backlight()
1028 backlight_data->entry_size); in parse_lfp_backlight()
1032 entry = &backlight_data->data[panel_type]; in parse_lfp_backlight()
1034 panel->vbt.backlight.present = entry->type == BDB_BACKLIGHT_TYPE_PWM; in parse_lfp_backlight()
1035 if (!panel->vbt.backlight.present) { in parse_lfp_backlight()
1036 drm_dbg_kms(display->drm, in parse_lfp_backlight()
1038 entry->type); in parse_lfp_backlight()
1042 panel->vbt.backlight.type = INTEL_BACKLIGHT_DISPLAY_DDI; in parse_lfp_backlight()
1043 panel->vbt.backlight.controller = 0; in parse_lfp_backlight()
1044 if (display->vbt.version >= 191) { in parse_lfp_backlight()
1047 method = &backlight_data->backlight_control[panel_type]; in parse_lfp_backlight()
1048 panel->vbt.backlight.type = method->type; in parse_lfp_backlight()
1049 panel->vbt.backlight.controller = method->controller; in parse_lfp_backlight()
1052 panel->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; in parse_lfp_backlight()
1053 panel->vbt.backlight.active_low_pwm = entry->active_low_pwm; in parse_lfp_backlight()
1055 if (display->vbt.version >= 234) { in parse_lfp_backlight()
1059 level = backlight_data->brightness_level[panel_type].level; in parse_lfp_backlight()
1060 min_level = backlight_data->brightness_min_level[panel_type].level; in parse_lfp_backlight()
1062 if (display->vbt.version >= 236) in parse_lfp_backlight()
1063 scale = backlight_data->brightness_precision_bits[panel_type] == 16; in parse_lfp_backlight()
1071 drm_warn(display->drm, "Brightness min level > 255\n"); in parse_lfp_backlight()
1074 panel->vbt.backlight.min_brightness = min_level; in parse_lfp_backlight()
1076 panel->vbt.backlight.brightness_precision_bits = in parse_lfp_backlight()
1077 backlight_data->brightness_precision_bits[panel_type]; in parse_lfp_backlight()
1079 level = backlight_data->level[panel_type]; in parse_lfp_backlight()
1080 panel->vbt.backlight.min_brightness = entry->min_brightness; in parse_lfp_backlight()
1083 if (display->vbt.version >= 239) in parse_lfp_backlight()
1084 panel->vbt.backlight.hdr_dpcd_refresh_timeout = in parse_lfp_backlight()
1085 DIV_ROUND_UP(backlight_data->hdr_dpcd_refresh_timeout[panel_type], 100); in parse_lfp_backlight()
1087 panel->vbt.backlight.hdr_dpcd_refresh_timeout = 30; in parse_lfp_backlight()
1089 drm_dbg_kms(display->drm, in parse_lfp_backlight()
1092 panel->vbt.backlight.pwm_freq_hz, in parse_lfp_backlight()
1093 panel->vbt.backlight.active_low_pwm ? "low" : "high", in parse_lfp_backlight()
1094 panel->vbt.backlight.min_brightness, in parse_lfp_backlight()
1096 panel->vbt.backlight.controller); in parse_lfp_backlight()
1101 struct intel_panel *panel) in parse_sdvo_lvds_data() argument
1107 index = display->params.vbt_sdvo_panel_type; in parse_sdvo_lvds_data()
1108 if (index == -2) { in parse_sdvo_lvds_data()
1109 drm_dbg_kms(display->drm, in parse_sdvo_lvds_data()
1114 if (index == -1) { in parse_sdvo_lvds_data()
1121 index = sdvo_lvds_options->panel_type; in parse_sdvo_lvds_data()
1131 * could lead to hard-to-detect bugs, so better double-check in parse_sdvo_lvds_data()
1134 if (index >= ARRAY_SIZE(dtd->dtd)) { in parse_sdvo_lvds_data()
1135 drm_err(display->drm, in parse_sdvo_lvds_data()
1136 "index %d is larger than dtd->dtd[4] array\n", in parse_sdvo_lvds_data()
1145 fill_detail_timing_data(display, panel_fixed_mode, &dtd->dtd[index]); in parse_sdvo_lvds_data()
1147 panel->vbt.sdvo_lvds_vbt_mode = panel_fixed_mode; in parse_sdvo_lvds_data()
1149 drm_dbg_kms(display->drm, in parse_sdvo_lvds_data()
1171 struct drm_i915_private *i915 = to_i915(display->drm); in parse_general_features()
1178 display->vbt.int_tv_support = general->int_tv_support; in parse_general_features()
1180 if (display->vbt.version >= 155 && in parse_general_features()
1182 display->vbt.int_crt_support = general->int_crt_support; in parse_general_features()
1183 display->vbt.lvds_use_ssc = general->enable_ssc; in parse_general_features()
1184 display->vbt.lvds_ssc_freq = in parse_general_features()
1185 intel_bios_ssc_frequency(display, general->ssc_freq); in parse_general_features()
1186 display->vbt.display_clock_mode = general->display_clock_mode; in parse_general_features()
1187 display->vbt.fdi_rx_polarity_inverted = general->fdi_rx_polarity_inverted; in parse_general_features()
1188 if (display->vbt.version >= 181) { in parse_general_features()
1189 display->vbt.orientation = general->rotate_180 ? in parse_general_features()
1193 display->vbt.orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; in parse_general_features()
1196 if (display->vbt.version >= 249 && general->afc_startup_config) { in parse_general_features()
1197 display->vbt.override_afc_startup = true; in parse_general_features()
1198 display->vbt.override_afc_startup_val = general->afc_startup_config == 1 ? 0 : 7; in parse_general_features()
1201 drm_dbg_kms(display->drm, in parse_general_features()
1203 display->vbt.int_tv_support, in parse_general_features()
1204 display->vbt.int_crt_support, in parse_general_features()
1205 display->vbt.lvds_use_ssc, in parse_general_features()
1206 display->vbt.lvds_ssc_freq, in parse_general_features()
1207 display->vbt.display_clock_mode, in parse_general_features()
1208 display->vbt.fdi_rx_polarity_inverted); in parse_general_features()
1214 return (const void *) &defs->devices[i * defs->child_dev_size]; in child_device_ptr()
1228 drm_dbg_kms(display->drm, "Skipping SDVO device mapping\n"); in parse_sdvo_device_mapping()
1232 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in parse_sdvo_device_mapping()
1233 const struct child_device_config *child = &devdata->child; in parse_sdvo_device_mapping()
1236 if (child->target_addr != TARGET_ADDR1 && in parse_sdvo_device_mapping()
1237 child->target_addr != TARGET_ADDR2) { in parse_sdvo_device_mapping()
1244 if (child->dvo_port != DEVICE_PORT_DVOB && in parse_sdvo_device_mapping()
1245 child->dvo_port != DEVICE_PORT_DVOC) { in parse_sdvo_device_mapping()
1247 drm_dbg_kms(display->drm, in parse_sdvo_device_mapping()
1251 drm_dbg_kms(display->drm, in parse_sdvo_device_mapping()
1254 child->target_addr, in parse_sdvo_device_mapping()
1255 (child->dvo_port == DEVICE_PORT_DVOB) ? in parse_sdvo_device_mapping()
1257 mapping = &display->vbt.sdvo_mappings[child->dvo_port - 1]; in parse_sdvo_device_mapping()
1258 if (!mapping->initialized) { in parse_sdvo_device_mapping()
1259 mapping->dvo_port = child->dvo_port; in parse_sdvo_device_mapping()
1260 mapping->target_addr = child->target_addr; in parse_sdvo_device_mapping()
1261 mapping->dvo_wiring = child->dvo_wiring; in parse_sdvo_device_mapping()
1262 mapping->ddc_pin = child->ddc_pin; in parse_sdvo_device_mapping()
1263 mapping->i2c_pin = child->i2c_pin; in parse_sdvo_device_mapping()
1264 mapping->initialized = 1; in parse_sdvo_device_mapping()
1265 drm_dbg_kms(display->drm, in parse_sdvo_device_mapping()
1267 mapping->dvo_port, mapping->target_addr, in parse_sdvo_device_mapping()
1268 mapping->dvo_wiring, mapping->ddc_pin, in parse_sdvo_device_mapping()
1269 mapping->i2c_pin); in parse_sdvo_device_mapping()
1271 drm_dbg_kms(display->drm, in parse_sdvo_device_mapping()
1275 if (child->target2_addr) { in parse_sdvo_device_mapping()
1278 drm_dbg_kms(display->drm, in parse_sdvo_device_mapping()
1287 drm_dbg_kms(display->drm, in parse_sdvo_device_mapping()
1307 if (driver->lvds_config != BDB_DRIVER_FEATURE_INT_LVDS) in parse_driver_features()
1308 display->vbt.int_lvds_support = 0; in parse_driver_features()
1321 if (display->vbt.version >= 134 && in parse_driver_features()
1322 driver->lvds_config != BDB_DRIVER_FEATURE_INT_LVDS && in parse_driver_features()
1323 driver->lvds_config != BDB_DRIVER_FEATURE_INT_SDVO_LVDS) in parse_driver_features()
1324 display->vbt.int_lvds_support = 0; in parse_driver_features()
1330 struct intel_panel *panel) in parse_panel_driver_features() argument
1338 if (display->vbt.version < 228) { in parse_panel_driver_features()
1339 drm_dbg_kms(display->drm, "DRRS State Enabled:%d\n", in parse_panel_driver_features()
1340 driver->drrs_enabled); in parse_panel_driver_features()
1345 * driver->drrs_enabled=false in parse_panel_driver_features()
1347 if (!driver->drrs_enabled && panel->vbt.drrs_type != DRRS_TYPE_NONE) { in parse_panel_driver_features()
1352 if (driver->dmrrs_enabled) in parse_panel_driver_features()
1353 panel->vbt.drrs_type = DRRS_TYPE_STATIC; in parse_panel_driver_features()
1355 panel->vbt.drrs_type = DRRS_TYPE_NONE; in parse_panel_driver_features()
1358 panel->vbt.psr.enable = driver->psr_enabled; in parse_panel_driver_features()
1364 struct intel_panel *panel) in parse_power_conservation_features() argument
1367 u8 panel_type = panel->vbt.panel_type; in parse_power_conservation_features()
1369 panel->vbt.vrr = true; /* matches Windows behaviour */ in parse_power_conservation_features()
1371 if (display->vbt.version < 228) in parse_power_conservation_features()
1378 panel->vbt.psr.enable = panel_bool(power->psr, panel_type); in parse_power_conservation_features()
1384 * power->drrs & BIT(panel_type)=false in parse_power_conservation_features()
1386 if (!panel_bool(power->drrs, panel_type) && panel->vbt.drrs_type != DRRS_TYPE_NONE) { in parse_power_conservation_features()
1391 if (panel_bool(power->dmrrs, panel_type)) in parse_power_conservation_features()
1392 panel->vbt.drrs_type = DRRS_TYPE_STATIC; in parse_power_conservation_features()
1394 panel->vbt.drrs_type = DRRS_TYPE_NONE; in parse_power_conservation_features()
1397 if (display->vbt.version >= 232) in parse_power_conservation_features()
1398 panel->vbt.edp.hobl = panel_bool(power->hobl, panel_type); in parse_power_conservation_features()
1400 if (display->vbt.version >= 233) in parse_power_conservation_features()
1401 panel->vbt.vrr = panel_bool(power->vrr_feature_enabled, in parse_power_conservation_features()
1407 struct intel_panel *panel) in parse_edp() argument
1412 int panel_type = panel->vbt.panel_type; in parse_edp()
1418 switch (panel_bits(edp->color_depth, panel_type, 2)) { in parse_edp()
1420 panel->vbt.edp.bpp = 18; in parse_edp()
1423 panel->vbt.edp.bpp = 24; in parse_edp()
1426 panel->vbt.edp.bpp = 30; in parse_edp()
1431 edp_pps = &edp->power_seqs[panel_type]; in parse_edp()
1432 edp_link_params = &edp->fast_link_params[panel_type]; in parse_edp()
1434 panel->vbt.edp.pps = *edp_pps; in parse_edp()
1436 if (display->vbt.version >= 224) { in parse_edp()
1437 panel->vbt.edp.rate = in parse_edp()
1438 edp->edp_fast_link_training_rate[panel_type] * 20; in parse_edp()
1440 switch (edp_link_params->rate) { in parse_edp()
1442 panel->vbt.edp.rate = 162000; in parse_edp()
1445 panel->vbt.edp.rate = 270000; in parse_edp()
1448 panel->vbt.edp.rate = 540000; in parse_edp()
1451 drm_dbg_kms(display->drm, in parse_edp()
1453 edp_link_params->rate); in parse_edp()
1458 switch (edp_link_params->lanes) { in parse_edp()
1460 panel->vbt.edp.lanes = 1; in parse_edp()
1463 panel->vbt.edp.lanes = 2; in parse_edp()
1466 panel->vbt.edp.lanes = 4; in parse_edp()
1469 drm_dbg_kms(display->drm, in parse_edp()
1471 edp_link_params->lanes); in parse_edp()
1475 switch (edp_link_params->preemphasis) { in parse_edp()
1477 panel->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_0; in parse_edp()
1480 panel->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_1; in parse_edp()
1483 panel->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_2; in parse_edp()
1486 panel->vbt.edp.preemphasis = DP_TRAIN_PRE_EMPH_LEVEL_3; in parse_edp()
1489 drm_dbg_kms(display->drm, in parse_edp()
1490 "VBT has unknown eDP pre-emphasis value %u\n", in parse_edp()
1491 edp_link_params->preemphasis); in parse_edp()
1495 switch (edp_link_params->vswing) { in parse_edp()
1497 panel->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_0; in parse_edp()
1500 panel->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_1; in parse_edp()
1503 panel->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_2; in parse_edp()
1506 panel->vbt.edp.vswing = DP_TRAIN_VOLTAGE_SWING_LEVEL_3; in parse_edp()
1509 drm_dbg_kms(display->drm, in parse_edp()
1511 edp_link_params->vswing); in parse_edp()
1515 if (display->vbt.version >= 173) { in parse_edp()
1519 if (display->params.edp_vswing) { in parse_edp()
1520 panel->vbt.edp.low_vswing = in parse_edp()
1521 display->params.edp_vswing == 1; in parse_edp()
1523 vswing = (edp->edp_vswing_preemph >> (panel_type * 4)) & 0xF; in parse_edp()
1524 panel->vbt.edp.low_vswing = vswing == 0; in parse_edp()
1528 panel->vbt.edp.drrs_msa_timing_delay = in parse_edp()
1529 panel_bits(edp->sdrrs_msa_timing_delay, panel_type, 2); in parse_edp()
1531 if (display->vbt.version >= 244) in parse_edp()
1532 panel->vbt.edp.max_link_rate = in parse_edp()
1533 edp->edp_max_port_link_rate[panel_type] * 20; in parse_edp()
1535 if (display->vbt.version >= 251) in parse_edp()
1536 panel->vbt.edp.dsc_disable = in parse_edp()
1537 panel_bool(edp->edp_dsc_disable, panel_type); in parse_edp()
1542 struct intel_panel *panel) in parse_psr() argument
1544 struct drm_i915_private *i915 = to_i915(display->drm); in parse_psr()
1547 int panel_type = panel->vbt.panel_type; in parse_psr()
1551 drm_dbg_kms(display->drm, "No PSR BDB found.\n"); in parse_psr()
1555 psr_table = &psr->psr_table[panel_type]; in parse_psr()
1557 panel->vbt.psr.full_link = psr_table->full_link; in parse_psr()
1558 panel->vbt.psr.require_aux_wakeup = psr_table->require_aux_to_wakeup; in parse_psr()
1561 panel->vbt.psr.idle_frames = psr_table->idle_frames < 0 ? 0 : in parse_psr()
1562 psr_table->idle_frames > 15 ? 15 : psr_table->idle_frames; in parse_psr()
1568 if (display->vbt.version >= 205 && in parse_psr()
1570 switch (psr_table->tp1_wakeup_time) { in parse_psr()
1572 panel->vbt.psr.tp1_wakeup_time_us = 500; in parse_psr()
1575 panel->vbt.psr.tp1_wakeup_time_us = 100; in parse_psr()
1578 panel->vbt.psr.tp1_wakeup_time_us = 0; in parse_psr()
1581 drm_dbg_kms(display->drm, in parse_psr()
1582 "VBT tp1 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n", in parse_psr()
1583 psr_table->tp1_wakeup_time); in parse_psr()
1586 panel->vbt.psr.tp1_wakeup_time_us = 2500; in parse_psr()
1590 switch (psr_table->tp2_tp3_wakeup_time) { in parse_psr()
1592 panel->vbt.psr.tp2_tp3_wakeup_time_us = 500; in parse_psr()
1595 panel->vbt.psr.tp2_tp3_wakeup_time_us = 100; in parse_psr()
1598 panel->vbt.psr.tp2_tp3_wakeup_time_us = 0; in parse_psr()
1601 drm_dbg_kms(display->drm, in parse_psr()
1602 "VBT tp2_tp3 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n", in parse_psr()
1603 psr_table->tp2_tp3_wakeup_time); in parse_psr()
1606 panel->vbt.psr.tp2_tp3_wakeup_time_us = 2500; in parse_psr()
1610 panel->vbt.psr.tp1_wakeup_time_us = psr_table->tp1_wakeup_time * 100; in parse_psr()
1611 panel->vbt.psr.tp2_tp3_wakeup_time_us = psr_table->tp2_tp3_wakeup_time * 100; in parse_psr()
1614 if (display->vbt.version >= 226) { in parse_psr()
1615 u32 wakeup_time = psr->psr2_tp2_tp3_wakeup_time; in parse_psr()
1633 panel->vbt.psr.psr2_tp2_tp3_wakeup_time_us = wakeup_time; in parse_psr()
1636 panel->vbt.psr.psr2_tp2_tp3_wakeup_time_us = panel->vbt.psr.tp2_tp3_wakeup_time_us; in parse_psr()
1641 struct intel_panel *panel, in parse_dsi_backlight_ports() argument
1646 if (!panel->vbt.dsi.config->dual_link || display->vbt.version < 197) { in parse_dsi_backlight_ports()
1647 panel->vbt.dsi.bl_ports = BIT(port); in parse_dsi_backlight_ports()
1648 if (panel->vbt.dsi.config->cabc_supported) in parse_dsi_backlight_ports()
1649 panel->vbt.dsi.cabc_ports = BIT(port); in parse_dsi_backlight_ports()
1654 switch (panel->vbt.dsi.config->dl_dcs_backlight_ports) { in parse_dsi_backlight_ports()
1656 panel->vbt.dsi.bl_ports = BIT(PORT_A); in parse_dsi_backlight_ports()
1659 panel->vbt.dsi.bl_ports = BIT(port_bc); in parse_dsi_backlight_ports()
1663 panel->vbt.dsi.bl_ports = BIT(PORT_A) | BIT(port_bc); in parse_dsi_backlight_ports()
1667 if (!panel->vbt.dsi.config->cabc_supported) in parse_dsi_backlight_ports()
1670 switch (panel->vbt.dsi.config->dl_dcs_cabc_ports) { in parse_dsi_backlight_ports()
1672 panel->vbt.dsi.cabc_ports = BIT(PORT_A); in parse_dsi_backlight_ports()
1675 panel->vbt.dsi.cabc_ports = BIT(port_bc); in parse_dsi_backlight_ports()
1679 panel->vbt.dsi.cabc_ports = in parse_dsi_backlight_ports()
1687 struct intel_panel *panel) in parse_mipi_config() argument
1692 int panel_type = panel->vbt.panel_type; in parse_mipi_config()
1700 panel->vbt.dsi.panel_id = MIPI_DSI_UNDEFINED_PANEL_ID; in parse_mipi_config()
1704 drm_dbg_kms(display->drm, "No MIPI config BDB found"); in parse_mipi_config()
1708 drm_dbg(display->drm, "Found MIPI Config block, panel index = %d\n", in parse_mipi_config()
1715 config = &start->config[panel_type]; in parse_mipi_config()
1716 pps = &start->pps[panel_type]; in parse_mipi_config()
1719 panel->vbt.dsi.config = kmemdup(config, sizeof(struct mipi_config), GFP_KERNEL); in parse_mipi_config()
1720 if (!panel->vbt.dsi.config) in parse_mipi_config()
1723 panel->vbt.dsi.pps = kmemdup(pps, sizeof(struct mipi_pps_data), GFP_KERNEL); in parse_mipi_config()
1724 if (!panel->vbt.dsi.pps) { in parse_mipi_config()
1725 kfree(panel->vbt.dsi.config); in parse_mipi_config()
1729 parse_dsi_backlight_ports(display, panel, port); in parse_mipi_config()
1732 switch (config->rotation) { in parse_mipi_config()
1736 * an upside down panel, thus we do not trust this. in parse_mipi_config()
1738 panel->vbt.dsi.orientation = in parse_mipi_config()
1742 panel->vbt.dsi.orientation = in parse_mipi_config()
1746 panel->vbt.dsi.orientation = in parse_mipi_config()
1750 panel->vbt.dsi.orientation = in parse_mipi_config()
1755 /* We have mandatory mipi config blocks. Initialize as generic panel */ in parse_mipi_config()
1756 panel->vbt.dsi.panel_id = MIPI_DSI_GENERIC_PANEL_ID; in parse_mipi_config()
1759 /* Find the sequence block and size for the given panel. */
1766 const u8 *data = &sequence->data[0]; in find_panel_sequence_block()
1769 int header_size = sequence->version >= 3 ? 5 : 3; in find_panel_sequence_block()
1774 if (sequence->version >= 3) in find_panel_sequence_block()
1779 drm_err(display->drm, in find_panel_sequence_block()
1785 if (sequence->version >= 3) in find_panel_sequence_block()
1793 drm_err(display->drm, "Invalid sequence block\n"); in find_panel_sequence_block()
1805 drm_err(display->drm, in find_panel_sequence_block()
1842 drm_err(display->drm, "Unknown operation byte\n"); in goto_next_sequence()
1862 drm_err(display->drm, "Too small sequence size\n"); in goto_next_sequence_v3()
1879 drm_err(display->drm, "Invalid sequence size\n"); in goto_next_sequence_v3()
1889 drm_err(display->drm, in goto_next_sequence_v3()
1912 drm_err(display->drm, "Unknown operation byte %u\n", in goto_next_sequence_v3()
1922 * Get len of pre-fixed deassert fragment from a v1 init OTP sequence,
1923 * skip all delay + gpio operands and stop at the first DSI packet op.
1926 struct intel_panel *panel) in get_init_otp_deassert_fragment_len() argument
1928 const u8 *data = panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP]; in get_init_otp_deassert_fragment_len()
1931 if (drm_WARN_ON(display->drm, in get_init_otp_deassert_fragment_len()
1932 !data || panel->vbt.dsi.seq_version != 1)) in get_init_otp_deassert_fragment_len()
1944 len = 3; /* 1 byte for op, 1 for gpio_nr, 1 for value */ in get_init_otp_deassert_fragment_len()
1961 struct intel_panel *panel) in vlv_fixup_mipi_sequences() argument
1966 /* Limit this to v1 vid-mode sequences */ in vlv_fixup_mipi_sequences()
1967 if (panel->vbt.dsi.config->is_cmd_mode || in vlv_fixup_mipi_sequences()
1968 panel->vbt.dsi.seq_version != 1) in vlv_fixup_mipi_sequences()
1972 if (!panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] || in vlv_fixup_mipi_sequences()
1973 !panel->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET] || in vlv_fixup_mipi_sequences()
1974 panel->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET]) in vlv_fixup_mipi_sequences()
1977 /* The deassert-sequence ends at the first DSI packet */ in vlv_fixup_mipi_sequences()
1978 len = get_init_otp_deassert_fragment_len(display, panel); in vlv_fixup_mipi_sequences()
1982 drm_dbg_kms(display->drm, in vlv_fixup_mipi_sequences()
1986 init_otp = (u8 *)panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP]; in vlv_fixup_mipi_sequences()
1987 panel->vbt.dsi.deassert_seq = kmemdup(init_otp, len + 1, GFP_KERNEL); in vlv_fixup_mipi_sequences()
1988 if (!panel->vbt.dsi.deassert_seq) in vlv_fixup_mipi_sequences()
1990 panel->vbt.dsi.deassert_seq[0] = MIPI_SEQ_DEASSERT_RESET; in vlv_fixup_mipi_sequences()
1991 panel->vbt.dsi.deassert_seq[len] = MIPI_SEQ_ELEM_END; in vlv_fixup_mipi_sequences()
1993 panel->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET] = in vlv_fixup_mipi_sequences()
1994 panel->vbt.dsi.deassert_seq; in vlv_fixup_mipi_sequences()
1996 init_otp[len - 1] = MIPI_SEQ_INIT_OTP; in vlv_fixup_mipi_sequences()
1998 panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] = init_otp + len - 1; in vlv_fixup_mipi_sequences()
2004 * - INIT_OTP is not present at all
2005 * - what should be in INIT_OTP is in DISPLAY_ON
2006 * - what should be in DISPLAY_ON is in BACKLIGHT_ON
2016 struct intel_panel *panel) in icl_fixup_mipi_sequences() argument
2018 if (!panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP] && in icl_fixup_mipi_sequences()
2019 panel->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON]) { in icl_fixup_mipi_sequences()
2020 drm_dbg_kms(display->drm, in icl_fixup_mipi_sequences()
2023 swap(panel->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP], in icl_fixup_mipi_sequences()
2024 panel->vbt.dsi.sequence[MIPI_SEQ_DISPLAY_ON]); in icl_fixup_mipi_sequences()
2029 struct intel_panel *panel) in fixup_mipi_sequences() argument
2031 struct drm_i915_private *i915 = to_i915(display->drm); in fixup_mipi_sequences()
2034 icl_fixup_mipi_sequences(display, panel); in fixup_mipi_sequences()
2036 vlv_fixup_mipi_sequences(display, panel); in fixup_mipi_sequences()
2041 struct intel_panel *panel) in parse_mipi_sequence() argument
2043 int panel_type = panel->vbt.panel_type; in parse_mipi_sequence()
2050 /* Only our generic panel driver uses the sequence block. */ in parse_mipi_sequence()
2051 if (panel->vbt.dsi.panel_id != MIPI_DSI_GENERIC_PANEL_ID) in parse_mipi_sequence()
2056 drm_dbg_kms(display->drm, in parse_mipi_sequence()
2062 if (sequence->version >= 4) { in parse_mipi_sequence()
2063 drm_err(display->drm, in parse_mipi_sequence()
2065 sequence->version); in parse_mipi_sequence()
2069 drm_dbg(display->drm, "Found MIPI sequence block v%u\n", in parse_mipi_sequence()
2070 sequence->version); in parse_mipi_sequence()
2087 drm_err(display->drm, "Unknown sequence %u\n", in parse_mipi_sequence()
2094 drm_dbg_kms(display->drm, in parse_mipi_sequence()
2097 panel->vbt.dsi.sequence[seq_id] = data + index; in parse_mipi_sequence()
2099 if (sequence->version >= 3) in parse_mipi_sequence()
2104 drm_err(display->drm, "Invalid sequence %u\n", in parse_mipi_sequence()
2110 panel->vbt.dsi.data = data; in parse_mipi_sequence()
2111 panel->vbt.dsi.size = seq_size; in parse_mipi_sequence()
2112 panel->vbt.dsi.seq_version = sequence->version; in parse_mipi_sequence()
2114 fixup_mipi_sequences(display, panel); in parse_mipi_sequence()
2116 drm_dbg(display->drm, "MIPI related VBT parsing complete\n"); in parse_mipi_sequence()
2121 memset(panel->vbt.dsi.sequence, 0, sizeof(panel->vbt.dsi.sequence)); in parse_mipi_sequence()
2132 if (display->vbt.version < 198) in parse_compression_parameters()
2138 if (params->entry_size != sizeof(params->data[0])) { in parse_compression_parameters()
2139 drm_dbg_kms(display->drm, in parse_compression_parameters()
2146 drm_dbg_kms(display->drm, in parse_compression_parameters()
2152 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in parse_compression_parameters()
2153 const struct child_device_config *child = &devdata->child; in parse_compression_parameters()
2155 if (!child->compression_enable) in parse_compression_parameters()
2159 drm_dbg_kms(display->drm, in parse_compression_parameters()
2164 if (child->compression_method_cps) { in parse_compression_parameters()
2165 drm_dbg_kms(display->drm, in parse_compression_parameters()
2170 index = child->compression_structure_index; in parse_compression_parameters()
2172 devdata->dsc = kmemdup(¶ms->data[index], in parse_compression_parameters()
2173 sizeof(*devdata->dsc), GFP_KERNEL); in parse_compression_parameters()
2182 drm_dbg_kms(display->drm, in translate_iboost()
2241 struct drm_i915_private *i915 = to_i915(display->drm); in map_ddc_pin()
2275 drm_dbg_kms(display->drm, in map_ddc_pin()
2322 if (port_mapping[port][i] == -1) in __dvo_port_to_port()
2336 struct drm_i915_private *i915 = to_i915(display->drm); in dvo_port_to_port()
2342 [PORT_A] = { DVO_PORT_HDMIA, DVO_PORT_DPA, -1 }, in dvo_port_to_port()
2343 [PORT_B] = { DVO_PORT_HDMIB, DVO_PORT_DPB, -1 }, in dvo_port_to_port()
2344 [PORT_C] = { DVO_PORT_HDMIC, DVO_PORT_DPC, -1 }, in dvo_port_to_port()
2345 [PORT_D] = { DVO_PORT_HDMID, DVO_PORT_DPD, -1 }, in dvo_port_to_port()
2347 [PORT_F] = { DVO_PORT_HDMIF, DVO_PORT_DPF, -1 }, in dvo_port_to_port()
2348 [PORT_G] = { DVO_PORT_HDMIG, DVO_PORT_DPG, -1 }, in dvo_port_to_port()
2349 [PORT_H] = { DVO_PORT_HDMIH, DVO_PORT_DPH, -1 }, in dvo_port_to_port()
2350 [PORT_I] = { DVO_PORT_HDMII, DVO_PORT_DPI, -1 }, in dvo_port_to_port()
2357 [PORT_A] = { DVO_PORT_HDMIA, DVO_PORT_DPA, -1 }, in dvo_port_to_port()
2358 [PORT_B] = { DVO_PORT_HDMIB, DVO_PORT_DPB, -1 }, in dvo_port_to_port()
2359 [PORT_C] = { -1 }, in dvo_port_to_port()
2360 [PORT_TC1] = { DVO_PORT_HDMIC, DVO_PORT_DPC, -1 }, in dvo_port_to_port()
2361 [PORT_TC2] = { DVO_PORT_HDMID, DVO_PORT_DPD, -1 }, in dvo_port_to_port()
2368 [PORT_A] = { DVO_PORT_HDMIA, DVO_PORT_DPA, -1 }, in dvo_port_to_port()
2369 [PORT_B] = { -1 }, in dvo_port_to_port()
2370 [PORT_C] = { -1 }, in dvo_port_to_port()
2371 [PORT_TC1] = { DVO_PORT_HDMIB, DVO_PORT_DPB, -1 }, in dvo_port_to_port()
2372 [PORT_TC2] = { DVO_PORT_HDMIC, DVO_PORT_DPC, -1 }, in dvo_port_to_port()
2373 [PORT_TC3] = { DVO_PORT_HDMID, DVO_PORT_DPD, -1 }, in dvo_port_to_port()
2374 [PORT_TC4] = { DVO_PORT_HDMIE, DVO_PORT_DPE, -1 }, in dvo_port_to_port()
2377 [PORT_A] = { DVO_PORT_HDMIA, DVO_PORT_DPA, -1 }, in dvo_port_to_port()
2378 [PORT_B] = { DVO_PORT_HDMIB, DVO_PORT_DPB, -1 }, in dvo_port_to_port()
2379 [PORT_C] = { DVO_PORT_HDMIC, DVO_PORT_DPC, -1 }, in dvo_port_to_port()
2380 [PORT_D_XELPD] = { DVO_PORT_HDMID, DVO_PORT_DPD, -1 }, in dvo_port_to_port()
2381 [PORT_E_XELPD] = { DVO_PORT_HDMIE, DVO_PORT_DPE, -1 }, in dvo_port_to_port()
2382 [PORT_TC1] = { DVO_PORT_HDMIF, DVO_PORT_DPF, -1 }, in dvo_port_to_port()
2383 [PORT_TC2] = { DVO_PORT_HDMIG, DVO_PORT_DPG, -1 }, in dvo_port_to_port()
2384 [PORT_TC3] = { DVO_PORT_HDMIH, DVO_PORT_DPH, -1 }, in dvo_port_to_port()
2385 [PORT_TC4] = { DVO_PORT_HDMII, DVO_PORT_DPI, -1 }, in dvo_port_to_port()
2428 struct intel_display *display = devdata->display; in intel_bios_encoder_port()
2429 const struct child_device_config *child = &devdata->child; in intel_bios_encoder_port()
2432 port = dvo_port_to_port(display, child->dvo_port); in intel_bios_encoder_port()
2434 port = dsi_dvo_port_to_port(display, child->dvo_port); in intel_bios_encoder_port()
2479 if (!devdata || devdata->display->vbt.version < 216) in intel_bios_dp_max_link_rate()
2482 if (devdata->display->vbt.version >= 230) in intel_bios_dp_max_link_rate()
2483 return parse_bdb_230_dp_max_link_rate(devdata->child.dp_max_link_rate); in intel_bios_dp_max_link_rate()
2485 return parse_bdb_216_dp_max_link_rate(devdata->child.dp_max_link_rate); in intel_bios_dp_max_link_rate()
2490 if (!devdata || devdata->display->vbt.version < 244) in intel_bios_dp_max_lane_count()
2493 return devdata->child.dp_max_lane_count + 1; in intel_bios_dp_max_lane_count()
2499 struct intel_display *display = devdata->display; in sanitize_device_type()
2510 drm_dbg_kms(display->drm, "VBT claims port A supports DVI%s, ignoring\n", in sanitize_device_type()
2513 devdata->child.device_type &= ~DEVICE_TYPE_TMDS_DVI_SIGNALING; in sanitize_device_type()
2514 devdata->child.device_type |= DEVICE_TYPE_NOT_HDMI_OUTPUT; in sanitize_device_type()
2520 struct intel_display *display = devdata->display; in sanitize_hdmi_level_shift()
2521 struct drm_i915_private *i915 = to_i915(display->drm); in sanitize_hdmi_level_shift()
2527 * Some BDW machines (eg. HP Pavilion 15-ab) shipped in sanitize_hdmi_level_shift()
2531 if (IS_BROADWELL(i915) && devdata->child.hdmi_level_shifter_value > 9) { in sanitize_hdmi_level_shift()
2532 drm_dbg_kms(display->drm, in sanitize_hdmi_level_shift()
2534 port_name(port), devdata->child.hdmi_level_shifter_value, 9); in sanitize_hdmi_level_shift()
2536 devdata->child.hdmi_level_shifter_value = 9; in sanitize_hdmi_level_shift()
2543 return devdata->child.device_type & DEVICE_TYPE_ANALOG_OUTPUT; in intel_bios_encoder_supports_crt()
2549 return devdata->child.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING; in intel_bios_encoder_supports_dvi()
2556 (devdata->child.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0; in intel_bios_encoder_supports_hdmi()
2562 return devdata->child.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT; in intel_bios_encoder_supports_dp()
2569 devdata->child.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR; in intel_bios_encoder_supports_edp()
2575 return devdata->child.device_type & DEVICE_TYPE_MIPI_OUTPUT; in intel_bios_encoder_supports_dsi()
2581 return devdata && HAS_LSPCON(devdata->display) && devdata->child.lspcon; in intel_bios_encoder_is_lspcon()
2584 /* This is an index in the HDMI/DVI DDI buffer translation table, or -1 */
2587 if (!devdata || devdata->display->vbt.version < 158 || in intel_bios_hdmi_level_shift()
2588 DISPLAY_VER(devdata->display) >= 14) in intel_bios_hdmi_level_shift()
2589 return -1; in intel_bios_hdmi_level_shift()
2591 return devdata->child.hdmi_level_shifter_value; in intel_bios_hdmi_level_shift()
2596 if (!devdata || devdata->display->vbt.version < 204) in intel_bios_hdmi_max_tmds_clock()
2599 switch (devdata->child.hdmi_max_data_rate) { in intel_bios_hdmi_max_tmds_clock()
2601 MISSING_CASE(devdata->child.hdmi_max_data_rate); in intel_bios_hdmi_max_tmds_clock()
2620 struct drm_i915_private *i915 = to_i915(display->drm); in is_port_valid()
2634 struct intel_display *display = devdata->display; in print_ddi_port()
2635 const struct child_device_config *child = &devdata->child; in print_ddi_port()
2654 drm_dbg_kms(display->drm, in print_ddi_port()
2655 …"Port %c VBT info: CRT:%d DVI:%d HDMI:%d DP:%d eDP:%d DSI:%d DP++:%d LSPCON:%d USB-Type-C:%d TBT:%… in print_ddi_port()
2660 devdata->dsc != NULL); in print_ddi_port()
2664 drm_dbg_kms(display->drm, in print_ddi_port()
2671 drm_dbg_kms(display->drm, in print_ddi_port()
2678 drm_dbg_kms(display->drm, in print_ddi_port()
2684 drm_dbg_kms(display->drm, in print_ddi_port()
2690 drm_dbg_kms(display->drm, in print_ddi_port()
2698 drm_WARN(display->drm, child->use_vbt_vswing, in print_ddi_port()
2705 struct intel_display *display = devdata->display; in parse_ddi_port()
2713 drm_dbg_kms(display->drm, in parse_ddi_port()
2725 struct drm_i915_private *i915 = to_i915(display->drm); in has_ddi_port_info()
2737 list_for_each_entry(devdata, &display->vbt.display_devices, node) in parse_ddi_ports()
2740 list_for_each_entry(devdata, &display->vbt.display_devices, node) in parse_ddi_ports()
2749 return -ENOENT; in child_device_expected_size()
2770 expected_size = child_device_expected_size(display->vbt.version); in child_device_size_valid()
2773 drm_dbg(display->drm, in child_device_size_valid()
2775 display->vbt.version, expected_size); in child_device_size_valid()
2780 drm_err(display->drm, in child_device_size_valid()
2782 size, expected_size, display->vbt.version); in child_device_size_valid()
2786 drm_dbg_kms(display->drm, in child_device_size_valid()
2798 struct drm_i915_private *i915 = to_i915(display->drm); in parse_general_definitions()
2808 drm_dbg_kms(display->drm, in parse_general_definitions()
2815 drm_dbg_kms(display->drm, in parse_general_definitions()
2821 bus_pin = defs->crt_ddc_gmbus_pin; in parse_general_definitions()
2822 drm_dbg_kms(display->drm, "crt_ddc_bus_pin: %d\n", bus_pin); in parse_general_definitions()
2824 display->vbt.crt_ddc_pin = bus_pin; in parse_general_definitions()
2826 if (!child_device_size_valid(display, defs->child_dev_size)) in parse_general_definitions()
2830 child_device_num = (block_size - sizeof(*defs)) / defs->child_dev_size; in parse_general_definitions()
2834 if (!child->device_type) in parse_general_definitions()
2837 drm_dbg_kms(display->drm, in parse_general_definitions()
2839 child->device_type); in parse_general_definitions()
2845 devdata->display = display; in parse_general_definitions()
2852 memcpy(&devdata->child, child, in parse_general_definitions()
2853 min_t(size_t, defs->child_dev_size, sizeof(*child))); in parse_general_definitions()
2855 list_add_tail(&devdata->node, &display->vbt.display_devices); in parse_general_definitions()
2858 if (list_empty(&display->vbt.display_devices)) in parse_general_definitions()
2859 drm_dbg_kms(display->drm, in parse_general_definitions()
2867 struct drm_i915_private *i915 = to_i915(display->drm); in init_vbt_defaults()
2869 display->vbt.crt_ddc_pin = GMBUS_PIN_VGADDC; in init_vbt_defaults()
2872 display->vbt.int_tv_support = 1; in init_vbt_defaults()
2873 display->vbt.int_crt_support = 1; in init_vbt_defaults()
2876 display->vbt.int_lvds_support = 1; in init_vbt_defaults()
2879 display->vbt.lvds_use_ssc = 1; in init_vbt_defaults()
2884 display->vbt.lvds_ssc_freq = intel_bios_ssc_frequency(display, in init_vbt_defaults()
2886 drm_dbg_kms(display->drm, "Set default to SSC at %d kHz\n", in init_vbt_defaults()
2887 display->vbt.lvds_ssc_freq); in init_vbt_defaults()
2892 init_vbt_panel_defaults(struct intel_panel *panel) in init_vbt_panel_defaults() argument
2895 panel->vbt.backlight.present = true; in init_vbt_panel_defaults()
2897 /* LFP panel data */ in init_vbt_panel_defaults()
2898 panel->vbt.lvds_dither = true; in init_vbt_panel_defaults()
2905 struct drm_i915_private *i915 = to_i915(display->drm); in init_vbt_missing_defaults()
2906 unsigned int ports = DISPLAY_RUNTIME_INFO(display)->port_mask; in init_vbt_missing_defaults()
2929 devdata->display = display; in init_vbt_missing_defaults()
2930 child = &devdata->child; in init_vbt_missing_defaults()
2933 child->dvo_port = DVO_PORT_HDMIF; in init_vbt_missing_defaults()
2935 child->dvo_port = DVO_PORT_HDMIE; in init_vbt_missing_defaults()
2937 child->dvo_port = DVO_PORT_HDMIA + port; in init_vbt_missing_defaults()
2940 child->device_type |= DEVICE_TYPE_TMDS_DVI_SIGNALING; in init_vbt_missing_defaults()
2943 child->device_type |= DEVICE_TYPE_DISPLAYPORT_OUTPUT; in init_vbt_missing_defaults()
2946 child->device_type |= DEVICE_TYPE_INTERNAL_CONNECTOR; in init_vbt_missing_defaults()
2948 list_add_tail(&devdata->node, &display->vbt.display_devices); in init_vbt_missing_defaults()
2950 drm_dbg_kms(display->drm, in init_vbt_missing_defaults()
2952 child->device_type, port_name(port)); in init_vbt_missing_defaults()
2956 display->vbt.version = 155; in init_vbt_missing_defaults()
2963 return _vbt + vbt->bdb_offset; in get_bdb_header()
2967 * intel_bios_is_valid_vbt - does the given buffer contain a valid VBT
2984 drm_dbg_kms(display->drm, "VBT header incomplete\n"); in intel_bios_is_valid_vbt()
2988 if (memcmp(vbt->signature, "$VBT", 4)) { in intel_bios_is_valid_vbt()
2989 drm_dbg_kms(display->drm, "VBT invalid signature\n"); in intel_bios_is_valid_vbt()
2993 if (vbt->vbt_size > size) { in intel_bios_is_valid_vbt()
2994 drm_dbg_kms(display->drm, in intel_bios_is_valid_vbt()
2999 size = vbt->vbt_size; in intel_bios_is_valid_vbt()
3002 vbt->bdb_offset, in intel_bios_is_valid_vbt()
3005 drm_dbg_kms(display->drm, "BDB header incomplete\n"); in intel_bios_is_valid_vbt()
3010 if (range_overflows_t(size_t, vbt->bdb_offset, bdb->bdb_size, size)) { in intel_bios_is_valid_vbt()
3011 drm_dbg_kms(display->drm, "BDB incomplete\n"); in intel_bios_is_valid_vbt()
3023 const char *name = display->params.vbt_firmware; in firmware_get_vbt()
3029 ret = request_firmware(&fw, name, display->drm->dev); in firmware_get_vbt()
3031 drm_err(display->drm, in firmware_get_vbt()
3037 if (intel_bios_is_valid_vbt(display, fw->data, fw->size)) { in firmware_get_vbt()
3038 vbt = kmemdup(fw->data, fw->size, GFP_KERNEL); in firmware_get_vbt()
3040 drm_dbg_kms(display->drm, in firmware_get_vbt()
3043 *size = fw->size; in firmware_get_vbt()
3046 drm_dbg_kms(display->drm, "Invalid VBT firmware \"%s\"\n", in firmware_get_vbt()
3065 struct drm_i915_private *i915 = to_i915(display->drm); in spi_oprom_get_vbt()
3072 static_region = intel_uncore_read(&i915->uncore, SPI_STATIC_REGIONS); in spi_oprom_get_vbt()
3074 intel_uncore_write(&i915->uncore, PRIMARY_SPI_REGIONID, static_region); in spi_oprom_get_vbt()
3076 oprom_offset = intel_uncore_read(&i915->uncore, OROM_OFFSET); in spi_oprom_get_vbt()
3080 data = intel_spi_read(&i915->uncore, oprom_offset + count); in spi_oprom_get_vbt()
3091 vbt_size = intel_spi_read(&i915->uncore, in spi_oprom_get_vbt()
3100 *(vbt + store++) = intel_spi_read(&i915->uncore, found + count); in spi_oprom_get_vbt()
3105 drm_dbg_kms(display->drm, "Found valid VBT in SPI flash\n"); in spi_oprom_get_vbt()
3121 struct pci_dev *pdev = to_pci_dev(display->drm->dev); in oprom_get_vbt()
3137 size -= i; in oprom_get_vbt()
3145 drm_dbg(display->drm, "VBT header incomplete\n"); in oprom_get_vbt()
3151 drm_dbg(display->drm, in oprom_get_vbt()
3171 drm_dbg_kms(display->drm, "Found valid VBT in PCI ROM\n"); in oprom_get_vbt()
3186 struct drm_i915_private *i915 = to_i915(display->drm); in intel_bios_get_vbt()
3200 with_intel_runtime_pm(&i915->runtime_pm, wakeref) in intel_bios_get_vbt()
3204 with_intel_runtime_pm(&i915->runtime_pm, wakeref) in intel_bios_get_vbt()
3211 * intel_bios_init - find VBT and initialize settings from the BIOS
3223 INIT_LIST_HEAD(&display->vbt.display_devices); in intel_bios_init()
3224 INIT_LIST_HEAD(&display->vbt.bdb_blocks); in intel_bios_init()
3227 drm_dbg_kms(display->drm, in intel_bios_init()
3240 display->vbt.version = bdb->version; in intel_bios_init()
3242 drm_dbg_kms(display->drm, in intel_bios_init()
3244 (int)sizeof(vbt->signature), vbt->signature, in intel_bios_init()
3245 display->vbt.version); in intel_bios_init()
3259 drm_info(display->drm, in intel_bios_init()
3264 /* Further processing on pre-parsed or generated child device data */ in intel_bios_init()
3272 struct intel_panel *panel, in intel_bios_init_panel() argument
3278 if (panel->vbt.panel_type >= 0) { in intel_bios_init_panel()
3279 drm_WARN_ON(display->drm, !use_fallback); in intel_bios_init_panel()
3283 panel->vbt.panel_type = get_panel_type(display, devdata, in intel_bios_init_panel()
3285 if (panel->vbt.panel_type < 0) { in intel_bios_init_panel()
3286 drm_WARN_ON(display->drm, use_fallback); in intel_bios_init_panel()
3290 init_vbt_panel_defaults(panel); in intel_bios_init_panel()
3292 parse_panel_options(display, panel); in intel_bios_init_panel()
3293 parse_generic_dtd(display, panel); in intel_bios_init_panel()
3294 parse_lfp_data(display, panel); in intel_bios_init_panel()
3295 parse_lfp_backlight(display, panel); in intel_bios_init_panel()
3296 parse_sdvo_lvds_data(display, panel); in intel_bios_init_panel()
3297 parse_panel_driver_features(display, panel); in intel_bios_init_panel()
3298 parse_power_conservation_features(display, panel); in intel_bios_init_panel()
3299 parse_edp(display, panel); in intel_bios_init_panel()
3300 parse_psr(display, panel); in intel_bios_init_panel()
3301 parse_mipi_config(display, panel); in intel_bios_init_panel()
3302 parse_mipi_sequence(display, panel); in intel_bios_init_panel()
3306 struct intel_panel *panel, in intel_bios_init_panel_early() argument
3309 intel_bios_init_panel(display, panel, devdata, NULL, false); in intel_bios_init_panel_early()
3313 struct intel_panel *panel, in intel_bios_init_panel_late() argument
3317 intel_bios_init_panel(display, panel, devdata, drm_edid, true); in intel_bios_init_panel_late()
3321 * intel_bios_driver_remove - Free any resources allocated by intel_bios_init()
3329 list_for_each_entry_safe(devdata, nd, &display->vbt.display_devices, in intel_bios_driver_remove()
3331 list_del(&devdata->node); in intel_bios_driver_remove()
3332 kfree(devdata->dsc); in intel_bios_driver_remove()
3336 list_for_each_entry_safe(entry, ne, &display->vbt.bdb_blocks, node) { in intel_bios_driver_remove()
3337 list_del(&entry->node); in intel_bios_driver_remove()
3342 void intel_bios_fini_panel(struct intel_panel *panel) in intel_bios_fini_panel() argument
3344 kfree(panel->vbt.sdvo_lvds_vbt_mode); in intel_bios_fini_panel()
3345 panel->vbt.sdvo_lvds_vbt_mode = NULL; in intel_bios_fini_panel()
3346 kfree(panel->vbt.lfp_vbt_mode); in intel_bios_fini_panel()
3347 panel->vbt.lfp_vbt_mode = NULL; in intel_bios_fini_panel()
3348 kfree(panel->vbt.dsi.data); in intel_bios_fini_panel()
3349 panel->vbt.dsi.data = NULL; in intel_bios_fini_panel()
3350 kfree(panel->vbt.dsi.pps); in intel_bios_fini_panel()
3351 panel->vbt.dsi.pps = NULL; in intel_bios_fini_panel()
3352 kfree(panel->vbt.dsi.config); in intel_bios_fini_panel()
3353 panel->vbt.dsi.config = NULL; in intel_bios_fini_panel()
3354 kfree(panel->vbt.dsi.deassert_seq); in intel_bios_fini_panel()
3355 panel->vbt.dsi.deassert_seq = NULL; in intel_bios_fini_panel()
3359 * intel_bios_is_tv_present - is integrated TV present in VBT
3369 if (!display->vbt.int_tv_support) in intel_bios_is_tv_present()
3372 if (list_empty(&display->vbt.display_devices)) in intel_bios_is_tv_present()
3375 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in intel_bios_is_tv_present()
3376 const struct child_device_config *child = &devdata->child; in intel_bios_is_tv_present()
3381 switch (child->device_type) { in intel_bios_is_tv_present()
3389 /* Only when the addin_offset is non-zero, it is regarded in intel_bios_is_tv_present()
3392 if (child->addin_offset) in intel_bios_is_tv_present()
3400 * intel_bios_is_lvds_present - is LVDS present in VBT
3409 struct drm_i915_private *i915 = to_i915(display->drm); in intel_bios_is_lvds_present()
3412 if (list_empty(&display->vbt.display_devices)) in intel_bios_is_lvds_present()
3415 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in intel_bios_is_lvds_present()
3416 const struct child_device_config *child = &devdata->child; in intel_bios_is_lvds_present()
3422 if (child->device_type != DEVICE_TYPE_INT_LFP && in intel_bios_is_lvds_present()
3423 child->device_type != DEVICE_TYPE_LFP) in intel_bios_is_lvds_present()
3426 if (intel_gmbus_is_valid_pin(i915, child->i2c_pin)) in intel_bios_is_lvds_present()
3427 *i2c_pin = child->i2c_pin; in intel_bios_is_lvds_present()
3431 * information from AIM blocks, a non-zero addin offset is in intel_bios_is_lvds_present()
3434 if (child->addin_offset) in intel_bios_is_lvds_present()
3449 * intel_bios_is_port_present - is the specified digital port present
3465 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in intel_bios_is_port_present()
3466 const struct child_device_config *child = &devdata->child; in intel_bios_is_port_present()
3468 if (dvo_port_to_port(display, child->dvo_port) == port) in intel_bios_is_port_present()
3477 const struct child_device_config *child = &devdata->child; in intel_bios_encoder_supports_dp_dual_mode()
3486 if (dvo_port_type(child->dvo_port) == DVO_PORT_DPA) in intel_bios_encoder_supports_dp_dual_mode()
3490 if (dvo_port_type(child->dvo_port) == DVO_PORT_HDMIA && in intel_bios_encoder_supports_dp_dual_mode()
3491 child->aux_channel != 0) in intel_bios_encoder_supports_dp_dual_mode()
3498 * intel_bios_is_dsi_present - is DSI present in VBT
3509 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in intel_bios_is_dsi_present()
3510 const struct child_device_config *child = &devdata->child; in intel_bios_is_dsi_present()
3511 u8 dvo_port = child->dvo_port; in intel_bios_is_dsi_present()
3513 if (!(child->device_type & DEVICE_TYPE_MIPI_OUTPUT)) in intel_bios_is_dsi_present()
3517 drm_dbg_kms(display->drm, in intel_bios_is_dsi_present()
3519 port_name(dvo_port - DVO_PORT_MIPIA)); in intel_bios_is_dsi_present()
3536 struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; in fill_dsc()
3539 vdsc_cfg->dsc_version_major = dsc->version_major; in fill_dsc()
3540 vdsc_cfg->dsc_version_minor = dsc->version_minor; in fill_dsc()
3542 if (dsc->support_12bpc && dsc_max_bpc >= 12) in fill_dsc()
3544 else if (dsc->support_10bpc && dsc_max_bpc >= 10) in fill_dsc()
3546 else if (dsc->support_8bpc && dsc_max_bpc >= 8) in fill_dsc()
3549 drm_dbg_kms(display->drm, "VBT: Unsupported BPC %d for DCS\n", in fill_dsc()
3552 crtc_state->pipe_bpp = bpc * 3; in fill_dsc()
3554 crtc_state->dsc.compressed_bpp_x16 = fxp_q4_from_int(min(crtc_state->pipe_bpp, in fill_dsc()
3555 VBT_DSC_MAX_BPP(dsc->max_bpp))); in fill_dsc()
3563 if (dsc->slices_per_line & BIT(2)) { in fill_dsc()
3564 crtc_state->dsc.slice_count = 4; in fill_dsc()
3565 } else if (dsc->slices_per_line & BIT(1)) { in fill_dsc()
3566 crtc_state->dsc.slice_count = 2; in fill_dsc()
3569 if (!(dsc->slices_per_line & BIT(0))) in fill_dsc()
3570 drm_dbg_kms(display->drm, in fill_dsc()
3573 crtc_state->dsc.slice_count = 1; in fill_dsc()
3576 if (crtc_state->hw.adjusted_mode.crtc_hdisplay % in fill_dsc()
3577 crtc_state->dsc.slice_count != 0) in fill_dsc()
3578 drm_dbg_kms(display->drm, in fill_dsc()
3580 crtc_state->hw.adjusted_mode.crtc_hdisplay, in fill_dsc()
3581 crtc_state->dsc.slice_count); in fill_dsc()
3587 vdsc_cfg->rc_model_size = drm_dsc_dp_rc_buffer_size(dsc->rc_buffer_block_size, in fill_dsc()
3588 dsc->rc_buffer_size); in fill_dsc()
3591 vdsc_cfg->line_buf_depth = VBT_DSC_LINE_BUFFER_DEPTH(dsc->line_buffer_depth); in fill_dsc()
3593 vdsc_cfg->block_pred_enable = dsc->block_prediction_enable; in fill_dsc()
3595 vdsc_cfg->slice_height = dsc->slice_height; in fill_dsc()
3606 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in intel_bios_get_dsc_params()
3607 const struct child_device_config *child = &devdata->child; in intel_bios_get_dsc_params()
3609 if (!(child->device_type & DEVICE_TYPE_MIPI_OUTPUT)) in intel_bios_get_dsc_params()
3612 if (dsi_dvo_port_to_port(display, child->dvo_port) == encoder->port) { in intel_bios_get_dsc_params()
3613 if (!devdata->dsc) in intel_bios_get_dsc_params()
3616 fill_dsc(crtc_state, devdata->dsc, dsc_max_bpc); in intel_bios_get_dsc_params()
3638 * ADL-S VBT uses PHY based mapping. Combo PHYs A,B,C,D,E
3674 struct drm_i915_private *i915 = to_i915(display->drm); in map_aux_ch()
3697 drm_dbg_kms(display->drm, in map_aux_ch()
3706 if (!devdata || !devdata->child.aux_channel) in intel_bios_dp_aux_ch()
3709 return map_aux_ch(devdata->display, devdata->child.aux_channel); in intel_bios_dp_aux_ch()
3718 if (!devdata || !devdata->child.aux_channel) in intel_bios_dp_has_shared_aux_ch()
3721 display = devdata->display; in intel_bios_dp_has_shared_aux_ch()
3722 aux_channel = devdata->child.aux_channel; in intel_bios_dp_has_shared_aux_ch()
3724 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in intel_bios_dp_has_shared_aux_ch()
3726 aux_channel == devdata->child.aux_channel) in intel_bios_dp_has_shared_aux_ch()
3735 if (!devdata || devdata->display->vbt.version < 196 || !devdata->child.iboost) in intel_bios_dp_boost_level()
3738 return translate_iboost(devdata->display, devdata->child.dp_iboost_level); in intel_bios_dp_boost_level()
3743 if (!devdata || devdata->display->vbt.version < 196 || !devdata->child.iboost) in intel_bios_hdmi_boost_level()
3746 return translate_iboost(devdata->display, devdata->child.hdmi_iboost_level); in intel_bios_hdmi_boost_level()
3751 if (!devdata || !devdata->child.ddc_pin) in intel_bios_hdmi_ddc_pin()
3754 return map_ddc_pin(devdata->display, devdata->child.ddc_pin); in intel_bios_hdmi_ddc_pin()
3759 return devdata->display->vbt.version >= 195 && devdata->child.dp_usb_type_c; in intel_bios_encoder_supports_typec_usb()
3764 return devdata->display->vbt.version >= 209 && devdata->child.tbt; in intel_bios_encoder_supports_tbt()
3769 return devdata && devdata->child.lane_reversal; in intel_bios_encoder_lane_reversal()
3774 return devdata && devdata->child.hpd_invert; in intel_bios_encoder_hpd_invert()
3782 list_for_each_entry(devdata, &display->vbt.display_devices, node) { in intel_bios_encoder_data_lookup()
3796 list_for_each_entry(devdata, &display->vbt.display_devices, node) in intel_bios_for_each_encoder()
3802 struct intel_display *display = m->private; in intel_bios_vbt_show()
3820 struct drm_minor *minor = display->drm->primary; in intel_bios_debugfs_register()
3822 debugfs_create_file("i915_vbt", 0444, minor->debugfs_root, in intel_bios_debugfs_register()