FreeBSD/sys/dev/drm2/i915/intel_bios.c
/* Try to find integrated panel data */
Try to find integrated panel data
Try to find integrated panel data
static void
parse_lfp_panel_data(struct drm_i915_private *dev_priv,
			    struct bdb_header *bdb)
{
	const struct bdb_lvds_options *lvds_options;
	const struct bdb_lvds_lfp_data *lvds_lfp_data;
	const struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs;
	const struct lvds_dvo_timing *panel_dvo_timing;
	const struct lvds_fp_timing *fp_timing;
	struct drm_display_mode *panel_fixed_mode;
	int i, downclock;
	lvds_options = find_section(bdb, BDB_LVDS_OPTIONS);
	if (!lvds_options)
		return;
	dev_priv->lvds_dither = lvds_options->pixel_dither;
	if (lvds_options->panel_type == 0xff)
		return;
	panel_type = lvds_options->panel_type;
	lvds_lfp_data = find_section(bdb, BDB_LVDS_LFP_DATA);
	if (!lvds_lfp_data)
		return;
	lvds_lfp_data_ptrs = find_section(bdb, BDB_LVDS_LFP_DATA_PTRS);
	if (!lvds_lfp_data_ptrs)
		return;
	dev_priv->lvds_vbt = 1;
	panel_dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
					       lvds_lfp_data_ptrs,
					       lvds_options->panel_type);
	panel_fixed_mode = malloc(sizeof(*panel_fixed_mode), DRM_MEM_KMS, M_WAITOK | M_ZERO);
	if (!panel_fixed_mode)
		return;
	fill_detail_timing_data(panel_fixed_mode, panel_dvo_timing);
	dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode;
	DRM_DEBUG_KMS("Found panel mode in BIOS VBT tables:\n");
	drm_mode_debug_printmodeline(panel_fixed_mode);
	downclock = panel_dvo_timing->clock;
	for (i = 0; i < 16; i++) {
		const struct lvds_dvo_timing *dvo_timing;
		dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
						 lvds_lfp_data_ptrs,
						 i);
		if (lvds_dvo_timing_equal_size(dvo_timing, panel_dvo_timing) &&
		    dvo_timing->clock < downclock)
			downclock = dvo_timing->clock;
	}
	if (downclock < panel_dvo_timing->clock && i915_lvds_downclock) {
		dev_priv->lvds_downclock_avail = 1;
		dev_priv->lvds_downclock = downclock * 10;
		DRM_DEBUG_KMS("LVDS downclock is found in VBT. "
			      "Normal Clock %dKHz, downclock %dKHz\n",
			      panel_fixed_mode->clock, 10*downclock);
	}
	fp_timing = get_lvds_fp_timing(bdb, lvds_lfp_data,
				       lvds_lfp_data_ptrs,
				       lvds_options->panel_type);
	if (fp_timing) {
		if (fp_timing->x_res == panel_fixed_mode->hdisplay &&
		    fp_timing->y_res == panel_fixed_mode->vdisplay) {
			dev_priv->bios_lvds_val = fp_timing->lvds_reg_val;
			DRM_DEBUG_KMS("VBT initial LVDS value %x\n",
				      dev_priv->bios_lvds_val);
		}
	}
}
static void parse_lfp_panel_data ( struct drm_i915_private * dev_priv , struct bdb_header * bdb ) { const struct bdb_lvds_options * lvds_options ; const struct bdb_lvds_lfp_data * lvds_lfp_data ; const struct bdb_lvds_lfp_data_ptrs * lvds_lfp_data_ptrs ; const struct lvds_dvo_timing * panel_dvo_timing ; const struct lvds_fp_timing * fp_timing ; struct drm_display_mode * panel_fixed_mode ; int i , downclock ; lvds_options = find_section ( bdb , BDB_LVDS_OPTIONS ) ; if ( ! lvds_options ) return ; dev_priv -> lvds_dither = lvds_options -> pixel_dither ; if ( lvds_options -> panel_type == 0xff ) return ; panel_type = lvds_options -> panel_type ; lvds_lfp_data = find_section ( bdb , BDB_LVDS_LFP_DATA ) ; if ( ! lvds_lfp_data ) return ; lvds_lfp_data_ptrs = find_section ( bdb , BDB_LVDS_LFP_DATA_PTRS ) ; if ( ! lvds_lfp_data_ptrs ) return ; dev_priv -> lvds_vbt = 1 ; panel_dvo_timing = get_lvds_dvo_timing ( lvds_lfp_data , lvds_lfp_data_ptrs , lvds_options -> panel_type ) ; panel_fixed_mode = malloc ( sizeof ( * panel_fixed_mode ) , DRM_MEM_KMS , M_WAITOK | M_ZERO ) ; if ( ! panel_fixed_mode ) return ; fill_detail_timing_data ( panel_fixed_mode , panel_dvo_timing ) ; dev_priv -> lfp_lvds_vbt_mode = panel_fixed_mode ; DRM_DEBUG_KMS ( " \n " ) ; drm_mode_debug_printmodeline ( panel_fixed_mode ) ; downclock = panel_dvo_timing -> clock ; for ( i = 0 ; i < 16 ; i ++ ) { const struct lvds_dvo_timing * dvo_timing ; dvo_timing = get_lvds_dvo_timing ( lvds_lfp_data , lvds_lfp_data_ptrs , i ) ; if ( lvds_dvo_timing_equal_size ( dvo_timing , panel_dvo_timing ) && dvo_timing -> clock < downclock ) downclock = dvo_timing -> clock ; } if ( downclock < panel_dvo_timing -> clock && i915_lvds_downclock ) { dev_priv -> lvds_downclock_avail = 1 ; dev_priv -> lvds_downclock = downclock * 10 ; DRM_DEBUG_KMS ( " " " \n " , panel_fixed_mode -> clock , 10 * downclock ) ; } fp_timing = get_lvds_fp_timing ( bdb , lvds_lfp_data , lvds_lfp_data_ptrs , lvds_options -> panel_type ) ; if ( fp_timing ) { if ( fp_timing -> x_res == panel_fixed_mode -> hdisplay && fp_timing -> y_res == panel_fixed_mode -> vdisplay ) { dev_priv -> bios_lvds_val = fp_timing -> lvds_reg_val ; DRM_DEBUG_KMS ( " \n " , dev_priv -> bios_lvds_val ) ; } } }
Try to find integrated panel data
Try to find integrated panel data
/*
	 * Iterate over the LVDS panel timing info to find the lowest clock
	 * for the native resolution.
	 */ /* check the resolution, just to be sure */