diff mbox

[1/9] drm/i915: Organize VBT stuff inside drm_i915_private

Message ID 1359570291-2170-2-git-send-email-rodrigo.vivi@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi Jan. 30, 2013, 6:24 p.m. UTC
drm_i915_private is getting bigger and bigger when adding new vbt stuff.
So, the better way of getting drm_i915_private organized is to create an special structure for vbt stuff.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
---
 drivers/gpu/drm/i915/i915_dma.c      |  8 +--
 drivers/gpu/drm/i915/i915_drv.h      | 56 +++++++++++----------
 drivers/gpu/drm/i915/intel_bios.c    | 96 ++++++++++++++++++------------------
 drivers/gpu/drm/i915/intel_crt.c     |  4 +-
 drivers/gpu/drm/i915/intel_display.c | 16 +++---
 drivers/gpu/drm/i915/intel_dp.c      | 12 ++---
 drivers/gpu/drm/i915/intel_lvds.c    | 20 ++++----
 drivers/gpu/drm/i915/intel_sdvo.c    |  6 +--
 drivers/gpu/drm/i915/intel_tv.c      |  8 +--
 9 files changed, 116 insertions(+), 110 deletions(-)

Comments

Jani Nikula Jan. 31, 2013, 9:08 a.m. UTC | #1
On Wed, 30 Jan 2013, Rodrigo Vivi <rodrigo.vivi@gmail.com> wrote:
> drm_i915_private is getting bigger and bigger when adding new vbt stuff.
> So, the better way of getting drm_i915_private organized is to create an special structure for vbt stuff.
>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
> ---
>  drivers/gpu/drm/i915/i915_dma.c      |  8 +--
>  drivers/gpu/drm/i915/i915_drv.h      | 56 +++++++++++----------
>  drivers/gpu/drm/i915/intel_bios.c    | 96 ++++++++++++++++++------------------
>  drivers/gpu/drm/i915/intel_crt.c     |  4 +-
>  drivers/gpu/drm/i915/intel_display.c | 16 +++---
>  drivers/gpu/drm/i915/intel_dp.c      | 12 ++---
>  drivers/gpu/drm/i915/intel_lvds.c    | 20 ++++----
>  drivers/gpu/drm/i915/intel_sdvo.c    |  6 +--
>  drivers/gpu/drm/i915/intel_tv.c      |  8 +--
>  9 files changed, 116 insertions(+), 110 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 3f70178..e43711f 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1714,10 +1714,10 @@ int i915_driver_unload(struct drm_device *dev)
>  		 * free the memory space allocated for the child device
>  		 * config parsed from VBT
>  		 */
> -		if (dev_priv->child_dev && dev_priv->child_dev_num) {
> -			kfree(dev_priv->child_dev);
> -			dev_priv->child_dev = NULL;
> -			dev_priv->child_dev_num = 0;
> +		if (dev_priv->vbt.child_dev && dev_priv->vbt.child_dev_num) {
> +			kfree(dev_priv->vbt.child_dev);
> +			dev_priv->vbt.child_dev = NULL;
> +			dev_priv->vbt.child_dev_num = 0;
>  		}
>  
>  		vga_switcheroo_unregister_client(dev->pdev);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 3189034..e22f6bd 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -665,6 +665,36 @@ struct intel_l3_parity {
>  	struct work_struct error_work;
>  };
>  
> +struct intel_vbt_data {
> +	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
> +	struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
> +
> +	/* Feature bits */
> +	unsigned int int_tv_support:1;
> +	unsigned int lvds_dither:1;
> +	unsigned int lvds_vbt:1;
> +	unsigned int int_crt_support:1;
> +	unsigned int lvds_use_ssc:1;
> +	unsigned int display_clock_mode:1;
> +	int lvds_ssc_freq;
> +	unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
> +
> +	/* eDP */
> +	int edp_rate;
> +	int edp_lanes;
> +	int edp_preemphasis;
> +	int edp_vswing;
> +	bool edp_initialized;
> +	bool edp_support;
> +	int edp_bpp;
> +	struct edp_power_seq edp_pps;
> +
> +	int crt_ddc_pin;
> +
> +	int child_dev_num;
> +	struct child_device_config *child_dev;
> +};
> +
>  typedef struct drm_i915_private {
>  	struct drm_device *dev;
>  	struct kmem_cache *slab;
> @@ -745,6 +775,7 @@ typedef struct drm_i915_private {
>  	struct intel_fbc_work *fbc_work;
>  
>  	struct intel_opregion opregion;
> +	struct intel_vbt_data vbt;
>  
>  	/* overlay */
>  	struct intel_overlay *overlay;
> @@ -753,32 +784,9 @@ typedef struct drm_i915_private {
>  	/* LVDS info */
>  	int backlight_level;  /* restore backlight to this value */
>  	bool backlight_enabled;
> -	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
> -	struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
>  
> -	/* Feature bits from the VBIOS */
> -	unsigned int int_tv_support:1;
> -	unsigned int lvds_dither:1;
> -	unsigned int lvds_vbt:1;
> -	unsigned int int_crt_support:1;
> -	unsigned int lvds_use_ssc:1;
> -	unsigned int display_clock_mode:1;
> -	int lvds_ssc_freq;
> -	unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
> -	struct {
> -		int rate;
> -		int lanes;
> -		int preemphasis;
> -		int vswing;
> -
> -		bool initialized;
> -		bool support;
> -		int bpp;
> -		struct edp_power_seq pps;
> -	} edp;
>  	bool no_aux_handshake;
>  
> -	int crt_ddc_pin;
>  	struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
>  	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
>  	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
> @@ -928,8 +936,6 @@ typedef struct drm_i915_private {
>  	/* indicates the reduced downclock for LVDS*/
>  	int lvds_downclock;
>  	u16 orig_clock;
> -	int child_dev_num;
> -	struct child_device_config *child_dev;
>  
>  	bool mchbar_need_disable;
>  
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 55ffba1..e145151 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -212,7 +212,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
>  	if (!lvds_options)
>  		return;
>  
> -	dev_priv->lvds_dither = lvds_options->pixel_dither;
> +	dev_priv->vbt.lvds_dither = lvds_options->pixel_dither;
>  	if (lvds_options->panel_type == 0xff)
>  		return;
>  
> @@ -226,7 +226,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
>  	if (!lvds_lfp_data_ptrs)
>  		return;
>  
> -	dev_priv->lvds_vbt = 1;
> +	dev_priv->vbt.lvds_vbt = 1;
>  
>  	panel_dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
>  					       lvds_lfp_data_ptrs,
> @@ -238,7 +238,7 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
>  
>  	fill_detail_timing_data(panel_fixed_mode, panel_dvo_timing);
>  
> -	dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode;
> +	dev_priv->vbt.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);
> @@ -274,9 +274,9 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
>  		/* check the resolution, just to be sure */
>  		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;
> +			dev_priv->vbt.bios_lvds_val = fp_timing->lvds_reg_val;
>  			DRM_DEBUG_KMS("VBT initial LVDS value %x\n",
> -				      dev_priv->bios_lvds_val);
> +				      dev_priv->vbt.bios_lvds_val);
>  		}
>  	}
>  }
> @@ -316,7 +316,7 @@ parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
>  
>  	fill_detail_timing_data(panel_fixed_mode, dvo_timing + index);
>  
> -	dev_priv->sdvo_lvds_vbt_mode = panel_fixed_mode;
> +	dev_priv->vbt.sdvo_lvds_vbt_mode = panel_fixed_mode;
>  
>  	DRM_DEBUG_KMS("Found SDVO panel mode in BIOS VBT tables:\n");
>  	drm_mode_debug_printmodeline(panel_fixed_mode);
> @@ -345,18 +345,18 @@ parse_general_features(struct drm_i915_private *dev_priv,
>  
>  	general = find_section(bdb, BDB_GENERAL_FEATURES);
>  	if (general) {
> -		dev_priv->int_tv_support = general->int_tv_support;
> -		dev_priv->int_crt_support = general->int_crt_support;
> -		dev_priv->lvds_use_ssc = general->enable_ssc;
> -		dev_priv->lvds_ssc_freq =
> +		dev_priv->vbt.int_tv_support = general->int_tv_support;
> +		dev_priv->vbt.int_crt_support = general->int_crt_support;
> +		dev_priv->vbt.lvds_use_ssc = general->enable_ssc;
> +		dev_priv->vbt.lvds_ssc_freq =
>  			intel_bios_ssc_frequency(dev, general->ssc_freq);
> -		dev_priv->display_clock_mode = general->display_clock_mode;
> +		dev_priv->vbt.display_clock_mode = general->display_clock_mode;
>  		DRM_DEBUG_KMS("BDB_GENERAL_FEATURES int_tv_support %d int_crt_support %d lvds_use_ssc %d lvds_ssc_freq %d display_clock_mode %d\n",
> -			      dev_priv->int_tv_support,
> -			      dev_priv->int_crt_support,
> -			      dev_priv->lvds_use_ssc,
> -			      dev_priv->lvds_ssc_freq,
> -			      dev_priv->display_clock_mode);
> +			      dev_priv->vbt.int_tv_support,
> +			      dev_priv->vbt.int_crt_support,
> +			      dev_priv->vbt.lvds_use_ssc,
> +			      dev_priv->vbt.lvds_ssc_freq,
> +			      dev_priv->vbt.display_clock_mode);
>  	}
>  }
>  
> @@ -373,7 +373,7 @@ parse_general_definitions(struct drm_i915_private *dev_priv,
>  			int bus_pin = general->crt_ddc_gmbus_pin;
>  			DRM_DEBUG_KMS("crt_ddc_bus_pin: %d\n", bus_pin);
>  			if (intel_gmbus_is_port_valid(bus_pin))
> -				dev_priv->crt_ddc_pin = bus_pin;
> +				dev_priv->vbt.crt_ddc_pin = bus_pin;
>  		} else {
>  			DRM_DEBUG_KMS("BDB_GD too small (%d). Invalid.\n",
>  				      block_size);
> @@ -484,7 +484,7 @@ parse_driver_features(struct drm_i915_private *dev_priv,
>  
>  	if (SUPPORTS_EDP(dev) &&
>  	    driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
> -		dev_priv->edp.support = 1;
> +		dev_priv->vbt.edp_support = 1;
>  
>  	if (driver->dual_frequency)
>  		dev_priv->render_reclock_avail = true;
> @@ -499,20 +499,20 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
>  
>  	edp = find_section(bdb, BDB_EDP);
>  	if (!edp) {
> -		if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp.support)
> +		if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->vbt.edp_support)
>  			DRM_DEBUG_KMS("No eDP BDB found but eDP panel supported.\n");
>  		return;
>  	}
>  
>  	switch ((edp->color_depth >> (panel_type * 2)) & 3) {
>  	case EDP_18BPP:
> -		dev_priv->edp.bpp = 18;
> +		dev_priv->vbt.edp_bpp = 18;
>  		break;
>  	case EDP_24BPP:
> -		dev_priv->edp.bpp = 24;
> +		dev_priv->vbt.edp_bpp = 24;
>  		break;
>  	case EDP_30BPP:
> -		dev_priv->edp.bpp = 30;
> +		dev_priv->vbt.edp_bpp = 30;
>  		break;
>  	}
>  
> @@ -520,48 +520,48 @@ parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
>  	edp_pps = &edp->power_seqs[panel_type];
>  	edp_link_params = &edp->link_params[panel_type];
>  
> -	dev_priv->edp.pps = *edp_pps;
> +	dev_priv->vbt.edp_pps = *edp_pps;
>  
> -	dev_priv->edp.rate = edp_link_params->rate ? DP_LINK_BW_2_7 :
> +	dev_priv->vbt.edp_rate = edp_link_params->rate ? DP_LINK_BW_2_7 :
>  		DP_LINK_BW_1_62;
>  	switch (edp_link_params->lanes) {
>  	case 0:
> -		dev_priv->edp.lanes = 1;
> +		dev_priv->vbt.edp_lanes = 1;
>  		break;
>  	case 1:
> -		dev_priv->edp.lanes = 2;
> +		dev_priv->vbt.edp_lanes = 2;
>  		break;
>  	case 3:
>  	default:
> -		dev_priv->edp.lanes = 4;
> +		dev_priv->vbt.edp_lanes = 4;
>  		break;
>  	}
>  	switch (edp_link_params->preemphasis) {
>  	case 0:
> -		dev_priv->edp.preemphasis = DP_TRAIN_PRE_EMPHASIS_0;
> +		dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_0;
>  		break;
>  	case 1:
> -		dev_priv->edp.preemphasis = DP_TRAIN_PRE_EMPHASIS_3_5;
> +		dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_3_5;
>  		break;
>  	case 2:
> -		dev_priv->edp.preemphasis = DP_TRAIN_PRE_EMPHASIS_6;
> +		dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_6;
>  		break;
>  	case 3:
> -		dev_priv->edp.preemphasis = DP_TRAIN_PRE_EMPHASIS_9_5;
> +		dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_9_5;
>  		break;
>  	}
>  	switch (edp_link_params->vswing) {
>  	case 0:
> -		dev_priv->edp.vswing = DP_TRAIN_VOLTAGE_SWING_400;
> +		dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_400;
>  		break;
>  	case 1:
> -		dev_priv->edp.vswing = DP_TRAIN_VOLTAGE_SWING_600;
> +		dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_600;
>  		break;
>  	case 2:
> -		dev_priv->edp.vswing = DP_TRAIN_VOLTAGE_SWING_800;
> +		dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_800;
>  		break;
>  	case 3:
> -		dev_priv->edp.vswing = DP_TRAIN_VOLTAGE_SWING_1200;
> +		dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_1200;
>  		break;
>  	}
>  }
> @@ -609,13 +609,13 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
>  		DRM_DEBUG_KMS("no child dev is parsed from VBT\n");
>  		return;
>  	}
> -	dev_priv->child_dev = kcalloc(count, sizeof(*p_child), GFP_KERNEL);
> -	if (!dev_priv->child_dev) {
> +	dev_priv->vbt.child_dev = kcalloc(count, sizeof(*p_child), GFP_KERNEL);
> +	if (!dev_priv->vbt.child_dev) {
>  		DRM_DEBUG_KMS("No memory space for child device\n");
>  		return;
>  	}
>  
> -	dev_priv->child_dev_num = count;
> +	dev_priv->vbt.child_dev_num = count;
>  	count = 0;
>  	for (i = 0; i < child_device_num; i++) {
>  		p_child = &(p_defs->devices[i]);
> @@ -623,7 +623,7 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
>  			/* skip the device block if device type is invalid */
>  			continue;
>  		}
> -		child_dev_ptr = dev_priv->child_dev + count;
> +		child_dev_ptr = dev_priv->vbt.child_dev + count;
>  		count++;
>  		memcpy((void *)child_dev_ptr, (void *)p_child,
>  					sizeof(*p_child));
> @@ -636,23 +636,23 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
>  {
>  	struct drm_device *dev = dev_priv->dev;
>  
> -	dev_priv->crt_ddc_pin = GMBUS_PORT_VGADDC;
> +	dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC;
>  
>  	/* LFP panel data */
> -	dev_priv->lvds_dither = 1;
> -	dev_priv->lvds_vbt = 0;
> +	dev_priv->vbt.lvds_dither = 1;
> +	dev_priv->vbt.lvds_vbt = 0;
>  
>  	/* SDVO panel data */
> -	dev_priv->sdvo_lvds_vbt_mode = NULL;
> +	dev_priv->vbt.sdvo_lvds_vbt_mode = NULL;
>  
>  	/* general features */
> -	dev_priv->int_tv_support = 1;
> -	dev_priv->int_crt_support = 1;
> +	dev_priv->vbt.int_tv_support = 1;
> +	dev_priv->vbt.int_crt_support = 1;
>  
>  	/* Default to using SSC */
> -	dev_priv->lvds_use_ssc = 1;
> -	dev_priv->lvds_ssc_freq = intel_bios_ssc_frequency(dev, 1);
> -	DRM_DEBUG_KMS("Set default to SSC at %dMHz\n", dev_priv->lvds_ssc_freq);
> +	dev_priv->vbt.lvds_use_ssc = 1;
> +	dev_priv->vbt.lvds_ssc_freq = intel_bios_ssc_frequency(dev, 1);
> +	DRM_DEBUG_KMS("Set default to SSC at %dMHz\n", dev_priv->vbt.lvds_ssc_freq);
>  }
>  
>  static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id)
> diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
> index 71a5eba..3f30095 100644
> --- a/drivers/gpu/drm/i915/intel_crt.c
> +++ b/drivers/gpu/drm/i915/intel_crt.c
> @@ -433,7 +433,7 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
>  
>  	BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG);
>  
> -	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
> +	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin);
>  	edid = intel_crt_get_edid(connector, i2c);
>  
>  	if (edid) {
> @@ -639,7 +639,7 @@ static int intel_crt_get_modes(struct drm_connector *connector)
>  	int ret;
>  	struct i2c_adapter *i2c;
>  
> -	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
> +	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin);
>  	ret = intel_crt_ddc_get_modes(connector, i2c);
>  	if (ret || !IS_G4X(dev))
>  		return ret;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b35902e..9e4db94 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3984,7 +3984,7 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
>  {
>  	if (i915_panel_use_ssc >= 0)
>  		return i915_panel_use_ssc != 0;
> -	return dev_priv->lvds_use_ssc
> +	return dev_priv->vbt.lvds_use_ssc
>  		&& !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE);
>  }
>  
> @@ -4055,7 +4055,7 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc,
>  
>  		if (intel_encoder->type == INTEL_OUTPUT_EDP) {
>  			/* Use VBT settings if we have an eDP panel */
> -			unsigned int edp_bpc = dev_priv->edp.bpp / 3;
> +			unsigned int edp_bpc = dev_priv->vbt.edp_bpp / 3;
>  
>  			if (edp_bpc && edp_bpc < display_bpc) {
>  				DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc);
> @@ -4156,7 +4156,7 @@ static int i9xx_get_refclk(struct drm_crtc *crtc, int num_connectors)
>  		refclk = vlv_get_refclk(crtc);
>  	} else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
>  	    intel_panel_use_ssc(dev_priv) && num_connectors < 2) {
> -		refclk = dev_priv->lvds_ssc_freq * 1000;
> +		refclk = dev_priv->vbt.lvds_ssc_freq * 1000;
>  		DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n",
>  			      refclk / 1000);
>  	} else if (!IS_GEN2(dev)) {
> @@ -4768,7 +4768,7 @@ static void ironlake_init_pch_refclk(struct drm_device *dev)
>  	}
>  
>  	if (HAS_PCH_IBX(dev)) {
> -		has_ck505 = dev_priv->display_clock_mode;
> +		has_ck505 = dev_priv->vbt.display_clock_mode;
>  		can_ssc = has_ck505;
>  	} else {
>  		has_ck505 = false;
> @@ -5049,8 +5049,8 @@ static int ironlake_get_refclk(struct drm_crtc *crtc)
>  
>  	if (is_lvds && intel_panel_use_ssc(dev_priv) && num_connectors < 2) {
>  		DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n",
> -			      dev_priv->lvds_ssc_freq);
> -		return dev_priv->lvds_ssc_freq * 1000;
> +			      dev_priv->vbt.lvds_ssc_freq);
> +		return dev_priv->vbt.lvds_ssc_freq * 1000;
>  	}
>  
>  	return 120000;
> @@ -5399,7 +5399,7 @@ static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,
>  	factor = 21;
>  	if (is_lvds) {
>  		if ((intel_panel_use_ssc(dev_priv) &&
> -		     dev_priv->lvds_ssc_freq == 100) ||
> +		     dev_priv->vbt.lvds_ssc_freq == 100) ||
>  		    intel_is_dual_link_lvds(dev))
>  			factor = 25;
>  	} else if (is_sdvo && is_tv)
> @@ -5512,7 +5512,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
>  	/* determine panel color depth */
>  	dither = intel_choose_pipe_bpp_dither(crtc, fb, &intel_crtc->bpp,
>  					      adjusted_mode);
> -	if (is_lvds && dev_priv->lvds_dither)
> +	if (is_lvds && dev_priv->vbt.lvds_dither)
>  		dither = true;
>  
>  	fp = clock.n << 16 | clock.m1 << 8 | clock.m2;
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 1492706..cbd3236 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2609,11 +2609,11 @@ bool intel_dpd_is_edp(struct drm_device *dev)
>  	struct child_device_config *p_child;
>  	int i;
>  
> -	if (!dev_priv->child_dev_num)
> +	if (!dev_priv->vbt.child_dev_num)
>  		return false;
>  
> -	for (i = 0; i < dev_priv->child_dev_num; i++) {
> -		p_child = dev_priv->child_dev + i;
> +	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> +		p_child = dev_priv->vbt.child_dev + i;
>  
>  		if (p_child->dvo_port == PORT_IDPD &&
>  		    p_child->device_type == DEVICE_TYPE_eDP)
> @@ -2677,7 +2677,7 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev,
>  	DRM_DEBUG_KMS("cur t1_t3 %d t8 %d t9 %d t10 %d t11_t12 %d\n",
>  		      cur.t1_t3, cur.t8, cur.t9, cur.t10, cur.t11_t12);
>  
> -	vbt = dev_priv->edp.pps;
> +	vbt = dev_priv->vbt.edp_pps;
>  
>  	/* Upper limits from eDP 1.3 spec. Note that we use the clunky units of
>  	 * our hw here, which are all in 100usec. */
> @@ -2886,8 +2886,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
>  		}
>  
>  		/* fallback to VBT if available for eDP */
> -		if (!fixed_mode && dev_priv->lfp_lvds_vbt_mode) {
> -			fixed_mode = drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
> +		if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) {
> +			fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
>  			if (fixed_mode)
>  				fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
>  		}
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 8c61876..d3be319 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -137,7 +137,7 @@ static void intel_pre_pll_enable_lvds(struct intel_encoder *encoder)
>  	 * special lvds dither control bit on pch-split platforms, dithering is
>  	 * only controlled through the PIPECONF reg. */
>  	if (INTEL_INFO(dev)->gen == 4) {
> -		if (dev_priv->lvds_dither)
> +		if (dev_priv->vbt.lvds_dither)
>  			temp |= LVDS_ENABLE_DITHER;
>  		else
>  			temp &= ~LVDS_ENABLE_DITHER;
> @@ -454,7 +454,7 @@ out:
>  	}
>  
>  	/* Make sure pre-965 set dither correctly */
> -	if (INTEL_INFO(dev)->gen < 4 && dev_priv->lvds_dither)
> +	if (INTEL_INFO(dev)->gen < 4 && dev_priv->vbt.lvds_dither)
>  		pfit_control |= PANEL_8TO6_DITHER_ENABLE;
>  
>  	if (pfit_control != lvds_encoder->pfit_control ||
> @@ -920,11 +920,11 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int i;
>  
> -	if (!dev_priv->child_dev_num)
> +	if (!dev_priv->vbt.child_dev_num)
>  		return true;
>  
> -	for (i = 0; i < dev_priv->child_dev_num; i++) {
> -		struct child_device_config *child = dev_priv->child_dev + i;
> +	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> +		struct child_device_config *child = dev_priv->vbt.child_dev + i;
>  
>  		/* If the device type is not LFP, continue.
>  		 * We have to check both the new identifiers as well as the
> @@ -1012,7 +1012,7 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
>  	 */
>  	val = I915_READ(lvds_encoder->reg);
>  	if (!(val & ~(LVDS_PIPE_MASK | LVDS_DETECTED)))
> -		val = dev_priv->bios_lvds_val;
> +		val = dev_priv->vbt.bios_lvds_val;
>  
>  	return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP;
>  }
> @@ -1069,7 +1069,7 @@ bool intel_lvds_init(struct drm_device *dev)
>  	if (HAS_PCH_SPLIT(dev)) {
>  		if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0)
>  			return false;
> -		if (dev_priv->edp.support) {
> +		if (dev_priv->vbt.edp_support) {
>  			DRM_DEBUG_KMS("disable LVDS for eDP support\n");
>  			return false;
>  		}
> @@ -1190,11 +1190,11 @@ bool intel_lvds_init(struct drm_device *dev)
>  	}
>  
>  	/* Failed to get EDID, what about VBT? */
> -	if (dev_priv->lfp_lvds_vbt_mode) {
> +	if (dev_priv->vbt.lfp_lvds_vbt_mode) {
>  		DRM_DEBUG_KMS("using mode from VBT: ");
> -		drm_mode_debug_printmodeline(dev_priv->lfp_lvds_vbt_mode);
> +		drm_mode_debug_printmodeline(dev_priv->vbt.lfp_lvds_vbt_mode);
>  
> -		fixed_mode = drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
> +		fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
>  		if (fixed_mode) {
>  			fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
>  			goto out;
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index f01063a..4d0be3d 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1487,7 +1487,7 @@ intel_sdvo_get_analog_edid(struct drm_connector *connector)
>  
>  	return drm_get_edid(connector,
>  			    intel_gmbus_get_adapter(dev_priv,
> -						    dev_priv->crt_ddc_pin));
> +						    dev_priv->vbt.crt_ddc_pin));
>  }
>  
>  static enum drm_connector_status
> @@ -1773,9 +1773,9 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
>  		goto end;
>  
>  	/* Fetch modes from VBT */
> -	if (dev_priv->sdvo_lvds_vbt_mode != NULL) {
> +	if (dev_priv->vbt.sdvo_lvds_vbt_mode != NULL) {
>  		newmode = drm_mode_duplicate(connector->dev,
> -					     dev_priv->sdvo_lvds_vbt_mode);
> +					     dev_priv->vbt.sdvo_lvds_vbt_mode);
>  		if (newmode != NULL) {
>  			/* Guarantee the mode is preferred */
>  			newmode->type = (DRM_MODE_TYPE_PREFERRED |
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 984a113..500f053 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -1521,12 +1521,12 @@ static int tv_is_present_in_vbt(struct drm_device *dev)
>  	struct child_device_config *p_child;
>  	int i, ret;
>  
> -	if (!dev_priv->child_dev_num)
> +	if (!dev_priv->vbt.child_dev_num)
>  		return 1;
>  
>  	ret = 0;
> -	for (i = 0; i < dev_priv->child_dev_num; i++) {
> -		p_child = dev_priv->child_dev + i;
> +	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> +		p_child = dev_priv->vbt.child_dev + i;
>  		/*
>  		 * If the device type is not TV, continue.
>  		 */
> @@ -1564,7 +1564,7 @@ intel_tv_init(struct drm_device *dev)
>  		return;
>  	}
>  	/* Even if we have an encoder we may not have a connector */
> -	if (!dev_priv->int_tv_support)
> +	if (!dev_priv->vbt.int_tv_support)
>  		return;
>  
>  	/*
> -- 
> 1.7.11.7
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 3f70178..e43711f 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1714,10 +1714,10 @@  int i915_driver_unload(struct drm_device *dev)
 		 * free the memory space allocated for the child device
 		 * config parsed from VBT
 		 */
-		if (dev_priv->child_dev && dev_priv->child_dev_num) {
-			kfree(dev_priv->child_dev);
-			dev_priv->child_dev = NULL;
-			dev_priv->child_dev_num = 0;
+		if (dev_priv->vbt.child_dev && dev_priv->vbt.child_dev_num) {
+			kfree(dev_priv->vbt.child_dev);
+			dev_priv->vbt.child_dev = NULL;
+			dev_priv->vbt.child_dev_num = 0;
 		}
 
 		vga_switcheroo_unregister_client(dev->pdev);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3189034..e22f6bd 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -665,6 +665,36 @@  struct intel_l3_parity {
 	struct work_struct error_work;
 };
 
+struct intel_vbt_data {
+	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
+	struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
+
+	/* Feature bits */
+	unsigned int int_tv_support:1;
+	unsigned int lvds_dither:1;
+	unsigned int lvds_vbt:1;
+	unsigned int int_crt_support:1;
+	unsigned int lvds_use_ssc:1;
+	unsigned int display_clock_mode:1;
+	int lvds_ssc_freq;
+	unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
+
+	/* eDP */
+	int edp_rate;
+	int edp_lanes;
+	int edp_preemphasis;
+	int edp_vswing;
+	bool edp_initialized;
+	bool edp_support;
+	int edp_bpp;
+	struct edp_power_seq edp_pps;
+
+	int crt_ddc_pin;
+
+	int child_dev_num;
+	struct child_device_config *child_dev;
+};
+
 typedef struct drm_i915_private {
 	struct drm_device *dev;
 	struct kmem_cache *slab;
@@ -745,6 +775,7 @@  typedef struct drm_i915_private {
 	struct intel_fbc_work *fbc_work;
 
 	struct intel_opregion opregion;
+	struct intel_vbt_data vbt;
 
 	/* overlay */
 	struct intel_overlay *overlay;
@@ -753,32 +784,9 @@  typedef struct drm_i915_private {
 	/* LVDS info */
 	int backlight_level;  /* restore backlight to this value */
 	bool backlight_enabled;
-	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
-	struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
 
-	/* Feature bits from the VBIOS */
-	unsigned int int_tv_support:1;
-	unsigned int lvds_dither:1;
-	unsigned int lvds_vbt:1;
-	unsigned int int_crt_support:1;
-	unsigned int lvds_use_ssc:1;
-	unsigned int display_clock_mode:1;
-	int lvds_ssc_freq;
-	unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
-	struct {
-		int rate;
-		int lanes;
-		int preemphasis;
-		int vswing;
-
-		bool initialized;
-		bool support;
-		int bpp;
-		struct edp_power_seq pps;
-	} edp;
 	bool no_aux_handshake;
 
-	int crt_ddc_pin;
 	struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
 	int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
 	int num_fence_regs; /* 8 on pre-965, 16 otherwise */
@@ -928,8 +936,6 @@  typedef struct drm_i915_private {
 	/* indicates the reduced downclock for LVDS*/
 	int lvds_downclock;
 	u16 orig_clock;
-	int child_dev_num;
-	struct child_device_config *child_dev;
 
 	bool mchbar_need_disable;
 
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 55ffba1..e145151 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -212,7 +212,7 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 	if (!lvds_options)
 		return;
 
-	dev_priv->lvds_dither = lvds_options->pixel_dither;
+	dev_priv->vbt.lvds_dither = lvds_options->pixel_dither;
 	if (lvds_options->panel_type == 0xff)
 		return;
 
@@ -226,7 +226,7 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 	if (!lvds_lfp_data_ptrs)
 		return;
 
-	dev_priv->lvds_vbt = 1;
+	dev_priv->vbt.lvds_vbt = 1;
 
 	panel_dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
 					       lvds_lfp_data_ptrs,
@@ -238,7 +238,7 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 
 	fill_detail_timing_data(panel_fixed_mode, panel_dvo_timing);
 
-	dev_priv->lfp_lvds_vbt_mode = panel_fixed_mode;
+	dev_priv->vbt.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);
@@ -274,9 +274,9 @@  parse_lfp_panel_data(struct drm_i915_private *dev_priv,
 		/* check the resolution, just to be sure */
 		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;
+			dev_priv->vbt.bios_lvds_val = fp_timing->lvds_reg_val;
 			DRM_DEBUG_KMS("VBT initial LVDS value %x\n",
-				      dev_priv->bios_lvds_val);
+				      dev_priv->vbt.bios_lvds_val);
 		}
 	}
 }
@@ -316,7 +316,7 @@  parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
 
 	fill_detail_timing_data(panel_fixed_mode, dvo_timing + index);
 
-	dev_priv->sdvo_lvds_vbt_mode = panel_fixed_mode;
+	dev_priv->vbt.sdvo_lvds_vbt_mode = panel_fixed_mode;
 
 	DRM_DEBUG_KMS("Found SDVO panel mode in BIOS VBT tables:\n");
 	drm_mode_debug_printmodeline(panel_fixed_mode);
@@ -345,18 +345,18 @@  parse_general_features(struct drm_i915_private *dev_priv,
 
 	general = find_section(bdb, BDB_GENERAL_FEATURES);
 	if (general) {
-		dev_priv->int_tv_support = general->int_tv_support;
-		dev_priv->int_crt_support = general->int_crt_support;
-		dev_priv->lvds_use_ssc = general->enable_ssc;
-		dev_priv->lvds_ssc_freq =
+		dev_priv->vbt.int_tv_support = general->int_tv_support;
+		dev_priv->vbt.int_crt_support = general->int_crt_support;
+		dev_priv->vbt.lvds_use_ssc = general->enable_ssc;
+		dev_priv->vbt.lvds_ssc_freq =
 			intel_bios_ssc_frequency(dev, general->ssc_freq);
-		dev_priv->display_clock_mode = general->display_clock_mode;
+		dev_priv->vbt.display_clock_mode = general->display_clock_mode;
 		DRM_DEBUG_KMS("BDB_GENERAL_FEATURES int_tv_support %d int_crt_support %d lvds_use_ssc %d lvds_ssc_freq %d display_clock_mode %d\n",
-			      dev_priv->int_tv_support,
-			      dev_priv->int_crt_support,
-			      dev_priv->lvds_use_ssc,
-			      dev_priv->lvds_ssc_freq,
-			      dev_priv->display_clock_mode);
+			      dev_priv->vbt.int_tv_support,
+			      dev_priv->vbt.int_crt_support,
+			      dev_priv->vbt.lvds_use_ssc,
+			      dev_priv->vbt.lvds_ssc_freq,
+			      dev_priv->vbt.display_clock_mode);
 	}
 }
 
@@ -373,7 +373,7 @@  parse_general_definitions(struct drm_i915_private *dev_priv,
 			int bus_pin = general->crt_ddc_gmbus_pin;
 			DRM_DEBUG_KMS("crt_ddc_bus_pin: %d\n", bus_pin);
 			if (intel_gmbus_is_port_valid(bus_pin))
-				dev_priv->crt_ddc_pin = bus_pin;
+				dev_priv->vbt.crt_ddc_pin = bus_pin;
 		} else {
 			DRM_DEBUG_KMS("BDB_GD too small (%d). Invalid.\n",
 				      block_size);
@@ -484,7 +484,7 @@  parse_driver_features(struct drm_i915_private *dev_priv,
 
 	if (SUPPORTS_EDP(dev) &&
 	    driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
-		dev_priv->edp.support = 1;
+		dev_priv->vbt.edp_support = 1;
 
 	if (driver->dual_frequency)
 		dev_priv->render_reclock_avail = true;
@@ -499,20 +499,20 @@  parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
 
 	edp = find_section(bdb, BDB_EDP);
 	if (!edp) {
-		if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->edp.support)
+		if (SUPPORTS_EDP(dev_priv->dev) && dev_priv->vbt.edp_support)
 			DRM_DEBUG_KMS("No eDP BDB found but eDP panel supported.\n");
 		return;
 	}
 
 	switch ((edp->color_depth >> (panel_type * 2)) & 3) {
 	case EDP_18BPP:
-		dev_priv->edp.bpp = 18;
+		dev_priv->vbt.edp_bpp = 18;
 		break;
 	case EDP_24BPP:
-		dev_priv->edp.bpp = 24;
+		dev_priv->vbt.edp_bpp = 24;
 		break;
 	case EDP_30BPP:
-		dev_priv->edp.bpp = 30;
+		dev_priv->vbt.edp_bpp = 30;
 		break;
 	}
 
@@ -520,48 +520,48 @@  parse_edp(struct drm_i915_private *dev_priv, struct bdb_header *bdb)
 	edp_pps = &edp->power_seqs[panel_type];
 	edp_link_params = &edp->link_params[panel_type];
 
-	dev_priv->edp.pps = *edp_pps;
+	dev_priv->vbt.edp_pps = *edp_pps;
 
-	dev_priv->edp.rate = edp_link_params->rate ? DP_LINK_BW_2_7 :
+	dev_priv->vbt.edp_rate = edp_link_params->rate ? DP_LINK_BW_2_7 :
 		DP_LINK_BW_1_62;
 	switch (edp_link_params->lanes) {
 	case 0:
-		dev_priv->edp.lanes = 1;
+		dev_priv->vbt.edp_lanes = 1;
 		break;
 	case 1:
-		dev_priv->edp.lanes = 2;
+		dev_priv->vbt.edp_lanes = 2;
 		break;
 	case 3:
 	default:
-		dev_priv->edp.lanes = 4;
+		dev_priv->vbt.edp_lanes = 4;
 		break;
 	}
 	switch (edp_link_params->preemphasis) {
 	case 0:
-		dev_priv->edp.preemphasis = DP_TRAIN_PRE_EMPHASIS_0;
+		dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_0;
 		break;
 	case 1:
-		dev_priv->edp.preemphasis = DP_TRAIN_PRE_EMPHASIS_3_5;
+		dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_3_5;
 		break;
 	case 2:
-		dev_priv->edp.preemphasis = DP_TRAIN_PRE_EMPHASIS_6;
+		dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_6;
 		break;
 	case 3:
-		dev_priv->edp.preemphasis = DP_TRAIN_PRE_EMPHASIS_9_5;
+		dev_priv->vbt.edp_preemphasis = DP_TRAIN_PRE_EMPHASIS_9_5;
 		break;
 	}
 	switch (edp_link_params->vswing) {
 	case 0:
-		dev_priv->edp.vswing = DP_TRAIN_VOLTAGE_SWING_400;
+		dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_400;
 		break;
 	case 1:
-		dev_priv->edp.vswing = DP_TRAIN_VOLTAGE_SWING_600;
+		dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_600;
 		break;
 	case 2:
-		dev_priv->edp.vswing = DP_TRAIN_VOLTAGE_SWING_800;
+		dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_800;
 		break;
 	case 3:
-		dev_priv->edp.vswing = DP_TRAIN_VOLTAGE_SWING_1200;
+		dev_priv->vbt.edp_vswing = DP_TRAIN_VOLTAGE_SWING_1200;
 		break;
 	}
 }
@@ -609,13 +609,13 @@  parse_device_mapping(struct drm_i915_private *dev_priv,
 		DRM_DEBUG_KMS("no child dev is parsed from VBT\n");
 		return;
 	}
-	dev_priv->child_dev = kcalloc(count, sizeof(*p_child), GFP_KERNEL);
-	if (!dev_priv->child_dev) {
+	dev_priv->vbt.child_dev = kcalloc(count, sizeof(*p_child), GFP_KERNEL);
+	if (!dev_priv->vbt.child_dev) {
 		DRM_DEBUG_KMS("No memory space for child device\n");
 		return;
 	}
 
-	dev_priv->child_dev_num = count;
+	dev_priv->vbt.child_dev_num = count;
 	count = 0;
 	for (i = 0; i < child_device_num; i++) {
 		p_child = &(p_defs->devices[i]);
@@ -623,7 +623,7 @@  parse_device_mapping(struct drm_i915_private *dev_priv,
 			/* skip the device block if device type is invalid */
 			continue;
 		}
-		child_dev_ptr = dev_priv->child_dev + count;
+		child_dev_ptr = dev_priv->vbt.child_dev + count;
 		count++;
 		memcpy((void *)child_dev_ptr, (void *)p_child,
 					sizeof(*p_child));
@@ -636,23 +636,23 @@  init_vbt_defaults(struct drm_i915_private *dev_priv)
 {
 	struct drm_device *dev = dev_priv->dev;
 
-	dev_priv->crt_ddc_pin = GMBUS_PORT_VGADDC;
+	dev_priv->vbt.crt_ddc_pin = GMBUS_PORT_VGADDC;
 
 	/* LFP panel data */
-	dev_priv->lvds_dither = 1;
-	dev_priv->lvds_vbt = 0;
+	dev_priv->vbt.lvds_dither = 1;
+	dev_priv->vbt.lvds_vbt = 0;
 
 	/* SDVO panel data */
-	dev_priv->sdvo_lvds_vbt_mode = NULL;
+	dev_priv->vbt.sdvo_lvds_vbt_mode = NULL;
 
 	/* general features */
-	dev_priv->int_tv_support = 1;
-	dev_priv->int_crt_support = 1;
+	dev_priv->vbt.int_tv_support = 1;
+	dev_priv->vbt.int_crt_support = 1;
 
 	/* Default to using SSC */
-	dev_priv->lvds_use_ssc = 1;
-	dev_priv->lvds_ssc_freq = intel_bios_ssc_frequency(dev, 1);
-	DRM_DEBUG_KMS("Set default to SSC at %dMHz\n", dev_priv->lvds_ssc_freq);
+	dev_priv->vbt.lvds_use_ssc = 1;
+	dev_priv->vbt.lvds_ssc_freq = intel_bios_ssc_frequency(dev, 1);
+	DRM_DEBUG_KMS("Set default to SSC at %dMHz\n", dev_priv->vbt.lvds_ssc_freq);
 }
 
 static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id)
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 71a5eba..3f30095 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -433,7 +433,7 @@  static bool intel_crt_detect_ddc(struct drm_connector *connector)
 
 	BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG);
 
-	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
+	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin);
 	edid = intel_crt_get_edid(connector, i2c);
 
 	if (edid) {
@@ -639,7 +639,7 @@  static int intel_crt_get_modes(struct drm_connector *connector)
 	int ret;
 	struct i2c_adapter *i2c;
 
-	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->crt_ddc_pin);
+	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin);
 	ret = intel_crt_ddc_get_modes(connector, i2c);
 	if (ret || !IS_G4X(dev))
 		return ret;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b35902e..9e4db94 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3984,7 +3984,7 @@  static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
 {
 	if (i915_panel_use_ssc >= 0)
 		return i915_panel_use_ssc != 0;
-	return dev_priv->lvds_use_ssc
+	return dev_priv->vbt.lvds_use_ssc
 		&& !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE);
 }
 
@@ -4055,7 +4055,7 @@  static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc,
 
 		if (intel_encoder->type == INTEL_OUTPUT_EDP) {
 			/* Use VBT settings if we have an eDP panel */
-			unsigned int edp_bpc = dev_priv->edp.bpp / 3;
+			unsigned int edp_bpc = dev_priv->vbt.edp_bpp / 3;
 
 			if (edp_bpc && edp_bpc < display_bpc) {
 				DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc);
@@ -4156,7 +4156,7 @@  static int i9xx_get_refclk(struct drm_crtc *crtc, int num_connectors)
 		refclk = vlv_get_refclk(crtc);
 	} else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
 	    intel_panel_use_ssc(dev_priv) && num_connectors < 2) {
-		refclk = dev_priv->lvds_ssc_freq * 1000;
+		refclk = dev_priv->vbt.lvds_ssc_freq * 1000;
 		DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n",
 			      refclk / 1000);
 	} else if (!IS_GEN2(dev)) {
@@ -4768,7 +4768,7 @@  static void ironlake_init_pch_refclk(struct drm_device *dev)
 	}
 
 	if (HAS_PCH_IBX(dev)) {
-		has_ck505 = dev_priv->display_clock_mode;
+		has_ck505 = dev_priv->vbt.display_clock_mode;
 		can_ssc = has_ck505;
 	} else {
 		has_ck505 = false;
@@ -5049,8 +5049,8 @@  static int ironlake_get_refclk(struct drm_crtc *crtc)
 
 	if (is_lvds && intel_panel_use_ssc(dev_priv) && num_connectors < 2) {
 		DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n",
-			      dev_priv->lvds_ssc_freq);
-		return dev_priv->lvds_ssc_freq * 1000;
+			      dev_priv->vbt.lvds_ssc_freq);
+		return dev_priv->vbt.lvds_ssc_freq * 1000;
 	}
 
 	return 120000;
@@ -5399,7 +5399,7 @@  static uint32_t ironlake_compute_dpll(struct intel_crtc *intel_crtc,
 	factor = 21;
 	if (is_lvds) {
 		if ((intel_panel_use_ssc(dev_priv) &&
-		     dev_priv->lvds_ssc_freq == 100) ||
+		     dev_priv->vbt.lvds_ssc_freq == 100) ||
 		    intel_is_dual_link_lvds(dev))
 			factor = 25;
 	} else if (is_sdvo && is_tv)
@@ -5512,7 +5512,7 @@  static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 	/* determine panel color depth */
 	dither = intel_choose_pipe_bpp_dither(crtc, fb, &intel_crtc->bpp,
 					      adjusted_mode);
-	if (is_lvds && dev_priv->lvds_dither)
+	if (is_lvds && dev_priv->vbt.lvds_dither)
 		dither = true;
 
 	fp = clock.n << 16 | clock.m1 << 8 | clock.m2;
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1492706..cbd3236 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2609,11 +2609,11 @@  bool intel_dpd_is_edp(struct drm_device *dev)
 	struct child_device_config *p_child;
 	int i;
 
-	if (!dev_priv->child_dev_num)
+	if (!dev_priv->vbt.child_dev_num)
 		return false;
 
-	for (i = 0; i < dev_priv->child_dev_num; i++) {
-		p_child = dev_priv->child_dev + i;
+	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
+		p_child = dev_priv->vbt.child_dev + i;
 
 		if (p_child->dvo_port == PORT_IDPD &&
 		    p_child->device_type == DEVICE_TYPE_eDP)
@@ -2677,7 +2677,7 @@  intel_dp_init_panel_power_sequencer(struct drm_device *dev,
 	DRM_DEBUG_KMS("cur t1_t3 %d t8 %d t9 %d t10 %d t11_t12 %d\n",
 		      cur.t1_t3, cur.t8, cur.t9, cur.t10, cur.t11_t12);
 
-	vbt = dev_priv->edp.pps;
+	vbt = dev_priv->vbt.edp_pps;
 
 	/* Upper limits from eDP 1.3 spec. Note that we use the clunky units of
 	 * our hw here, which are all in 100usec. */
@@ -2886,8 +2886,8 @@  intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 		}
 
 		/* fallback to VBT if available for eDP */
-		if (!fixed_mode && dev_priv->lfp_lvds_vbt_mode) {
-			fixed_mode = drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
+		if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) {
+			fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
 			if (fixed_mode)
 				fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
 		}
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 8c61876..d3be319 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -137,7 +137,7 @@  static void intel_pre_pll_enable_lvds(struct intel_encoder *encoder)
 	 * special lvds dither control bit on pch-split platforms, dithering is
 	 * only controlled through the PIPECONF reg. */
 	if (INTEL_INFO(dev)->gen == 4) {
-		if (dev_priv->lvds_dither)
+		if (dev_priv->vbt.lvds_dither)
 			temp |= LVDS_ENABLE_DITHER;
 		else
 			temp &= ~LVDS_ENABLE_DITHER;
@@ -454,7 +454,7 @@  out:
 	}
 
 	/* Make sure pre-965 set dither correctly */
-	if (INTEL_INFO(dev)->gen < 4 && dev_priv->lvds_dither)
+	if (INTEL_INFO(dev)->gen < 4 && dev_priv->vbt.lvds_dither)
 		pfit_control |= PANEL_8TO6_DITHER_ENABLE;
 
 	if (pfit_control != lvds_encoder->pfit_control ||
@@ -920,11 +920,11 @@  static bool lvds_is_present_in_vbt(struct drm_device *dev,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int i;
 
-	if (!dev_priv->child_dev_num)
+	if (!dev_priv->vbt.child_dev_num)
 		return true;
 
-	for (i = 0; i < dev_priv->child_dev_num; i++) {
-		struct child_device_config *child = dev_priv->child_dev + i;
+	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
+		struct child_device_config *child = dev_priv->vbt.child_dev + i;
 
 		/* If the device type is not LFP, continue.
 		 * We have to check both the new identifiers as well as the
@@ -1012,7 +1012,7 @@  static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
 	 */
 	val = I915_READ(lvds_encoder->reg);
 	if (!(val & ~(LVDS_PIPE_MASK | LVDS_DETECTED)))
-		val = dev_priv->bios_lvds_val;
+		val = dev_priv->vbt.bios_lvds_val;
 
 	return (val & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP;
 }
@@ -1069,7 +1069,7 @@  bool intel_lvds_init(struct drm_device *dev)
 	if (HAS_PCH_SPLIT(dev)) {
 		if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0)
 			return false;
-		if (dev_priv->edp.support) {
+		if (dev_priv->vbt.edp_support) {
 			DRM_DEBUG_KMS("disable LVDS for eDP support\n");
 			return false;
 		}
@@ -1190,11 +1190,11 @@  bool intel_lvds_init(struct drm_device *dev)
 	}
 
 	/* Failed to get EDID, what about VBT? */
-	if (dev_priv->lfp_lvds_vbt_mode) {
+	if (dev_priv->vbt.lfp_lvds_vbt_mode) {
 		DRM_DEBUG_KMS("using mode from VBT: ");
-		drm_mode_debug_printmodeline(dev_priv->lfp_lvds_vbt_mode);
+		drm_mode_debug_printmodeline(dev_priv->vbt.lfp_lvds_vbt_mode);
 
-		fixed_mode = drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
+		fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
 		if (fixed_mode) {
 			fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
 			goto out;
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index f01063a..4d0be3d 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1487,7 +1487,7 @@  intel_sdvo_get_analog_edid(struct drm_connector *connector)
 
 	return drm_get_edid(connector,
 			    intel_gmbus_get_adapter(dev_priv,
-						    dev_priv->crt_ddc_pin));
+						    dev_priv->vbt.crt_ddc_pin));
 }
 
 static enum drm_connector_status
@@ -1773,9 +1773,9 @@  static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
 		goto end;
 
 	/* Fetch modes from VBT */
-	if (dev_priv->sdvo_lvds_vbt_mode != NULL) {
+	if (dev_priv->vbt.sdvo_lvds_vbt_mode != NULL) {
 		newmode = drm_mode_duplicate(connector->dev,
-					     dev_priv->sdvo_lvds_vbt_mode);
+					     dev_priv->vbt.sdvo_lvds_vbt_mode);
 		if (newmode != NULL) {
 			/* Guarantee the mode is preferred */
 			newmode->type = (DRM_MODE_TYPE_PREFERRED |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 984a113..500f053 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1521,12 +1521,12 @@  static int tv_is_present_in_vbt(struct drm_device *dev)
 	struct child_device_config *p_child;
 	int i, ret;
 
-	if (!dev_priv->child_dev_num)
+	if (!dev_priv->vbt.child_dev_num)
 		return 1;
 
 	ret = 0;
-	for (i = 0; i < dev_priv->child_dev_num; i++) {
-		p_child = dev_priv->child_dev + i;
+	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
+		p_child = dev_priv->vbt.child_dev + i;
 		/*
 		 * If the device type is not TV, continue.
 		 */
@@ -1564,7 +1564,7 @@  intel_tv_init(struct drm_device *dev)
 		return;
 	}
 	/* Even if we have an encoder we may not have a connector */
-	if (!dev_priv->int_tv_support)
+	if (!dev_priv->vbt.int_tv_support)
 		return;
 
 	/*