[Intel-gfx] [PATCH 02/12] drm/i915/bios: store bdb version in i915

Ville Syrjälä ville.syrjala at linux.intel.com
Mon Feb 22 18:14:56 UTC 2021


On Wed, Feb 17, 2021 at 07:03:32PM +0200, Jani Nikula wrote:
> We'll be needing the version in more places in the future, so avoid the
> need to pass it around. No functional changes.
> 
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_bios.c | 28 +++++++++++------------
>  drivers/gpu/drm/i915/i915_drv.h           |  3 +++
>  2 files changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 802c228b2940..a8712fe8bf3e 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -597,7 +597,7 @@ child_device_ptr(const struct bdb_general_definitions *defs, int i)
>  }
>  
>  static void
> -parse_sdvo_device_mapping(struct drm_i915_private *i915, u8 bdb_version)
> +parse_sdvo_device_mapping(struct drm_i915_private *i915)
>  {
>  	struct sdvo_device_mapping *mapping;
>  	const struct display_device_data *devdata;
> @@ -1760,8 +1760,7 @@ static enum port dvo_port_to_port(struct drm_i915_private *i915,
>  }
>  
>  static void parse_ddi_port(struct drm_i915_private *i915,
> -			   struct display_device_data *devdata,
> -			   u8 bdb_version)
> +			   struct display_device_data *devdata)
>  {
>  	const struct child_device_config *child = &devdata->child;
>  	struct ddi_vbt_port_info *info;
> @@ -1800,10 +1799,10 @@ static void parse_ddi_port(struct drm_i915_private *i915,
>  	info->supports_dp = is_dp;
>  	info->supports_edp = is_edp;
>  
> -	if (bdb_version >= 195)
> +	if (i915->vbt.version >= 195)
>  		info->supports_typec_usb = child->dp_usb_type_c;
>  
> -	if (bdb_version >= 209)
> +	if (i915->vbt.version >= 209)
>  		info->supports_tbt = child->tbt;
>  
>  	drm_dbg_kms(&i915->drm,
> @@ -1834,7 +1833,7 @@ static void parse_ddi_port(struct drm_i915_private *i915,
>  		sanitize_aux_ch(i915, port);
>  	}
>  
> -	if (bdb_version >= 158) {
> +	if (i915->vbt.version >= 158) {
>  		/* The VBT HDMI level shift values match the table we have. */
>  		u8 hdmi_level_shift = child->hdmi_level_shifter_value;
>  		drm_dbg_kms(&i915->drm,
> @@ -1845,7 +1844,7 @@ static void parse_ddi_port(struct drm_i915_private *i915,
>  		info->hdmi_level_shift_set = true;
>  	}
>  
> -	if (bdb_version >= 204) {
> +	if (i915->vbt.version >= 204) {
>  		int max_tmds_clock;
>  
>  		switch (child->hdmi_max_data_rate) {
> @@ -1871,7 +1870,7 @@ static void parse_ddi_port(struct drm_i915_private *i915,
>  	}
>  
>  	/* Parse the I_boost config for SKL and above */
> -	if (bdb_version >= 196 && child->iboost) {
> +	if (i915->vbt.version >= 196 && child->iboost) {
>  		info->dp_boost_level = translate_iboost(child->dp_iboost_level);
>  		drm_dbg_kms(&i915->drm,
>  			    "Port %c VBT (e)DP boost level: %d\n",
> @@ -1883,7 +1882,7 @@ static void parse_ddi_port(struct drm_i915_private *i915,
>  	}
>  
>  	/* DP max link rate for CNL+ */
> -	if (bdb_version >= 216) {
> +	if (i915->vbt.version >= 216) {
>  		switch (child->dp_max_link_rate) {
>  		default:
>  		case VBT_DP_MAX_LINK_RATE_HBR3:
> @@ -1907,18 +1906,18 @@ static void parse_ddi_port(struct drm_i915_private *i915,
>  	info->child = child;
>  }
>  
> -static void parse_ddi_ports(struct drm_i915_private *i915, u8 bdb_version)
> +static void parse_ddi_ports(struct drm_i915_private *i915)
>  {
>  	struct display_device_data *devdata;
>  
>  	if (!HAS_DDI(i915) && !IS_CHERRYVIEW(i915))
>  		return;
>  
> -	if (bdb_version < 155)
> +	if (i915->vbt.version < 155)
>  		return;
>  
>  	list_for_each_entry(devdata, &i915->vbt.display_devices, node)
> -		parse_ddi_port(i915, devdata, bdb_version);
> +		parse_ddi_port(i915, devdata);
>  }
>  
>  static void
> @@ -2229,6 +2228,7 @@ void intel_bios_init(struct drm_i915_private *i915)
>  	}
>  
>  	bdb = get_bdb_header(vbt);
> +	i915->vbt.version = bdb->version;
>  
>  	drm_dbg_kms(&i915->drm,
>  		    "VBT signature \"%.*s\", BDB version %d\n",
> @@ -2252,8 +2252,8 @@ void intel_bios_init(struct drm_i915_private *i915)
>  	parse_compression_parameters(i915, bdb);
>  
>  	/* Further processing on pre-parsed data */
> -	parse_sdvo_device_mapping(i915, bdb->version);
> -	parse_ddi_ports(i915, bdb->version);
> +	parse_sdvo_device_mapping(i915);
> +	parse_ddi_ports(i915);
>  
>  out:
>  	if (!vbt) {
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index f8413b3b9da8..62be1465f52b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -615,6 +615,9 @@ enum psr_lines_to_wait {
>  };
>  
>  struct intel_vbt_data {
> +	/* bdb version */
> +	u16 version;
> +
>  	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
>  	struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
>  
> -- 
> 2.20.1

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list