[Intel-gfx] [PATCH RESEND 3/7] drm/i915: move VBT based eDP port check to intel_bios.c

Daniel Vetter daniel at ffwll.ch
Wed Mar 16 15:43:57 UTC 2016


On Wed, Mar 16, 2016 at 12:43:31PM +0200, Jani Nikula wrote:
> Hide knowledge about VBT child devices in intel_bios.c.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Patches 2&3: Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  1 +
>  drivers/gpu/drm/i915/intel_bios.c | 33 +++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_dp.c   | 21 +--------------------
>  3 files changed, 35 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 5fb7a22e802b..c6ec7029f691 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3336,6 +3336,7 @@ int intel_bios_init(struct drm_i915_private *dev_priv);
>  bool intel_bios_is_valid_vbt(const void *buf, size_t size);
>  bool intel_bios_is_tv_present(struct drm_i915_private *dev_priv);
>  bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin);
> +bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port);
>  
>  /* intel_opregion.c */
>  #ifdef CONFIG_ACPI
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 4f7eba36a849..7f61ca8165f0 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1522,3 +1522,36 @@ bool intel_bios_is_lvds_present(struct drm_i915_private *dev_priv, u8 *i2c_pin)
>  
>  	return false;
>  }
> +
> +/**
> + * intel_bios_is_port_edp - is the device in given port eDP
> + * @dev_priv:	i915 device instance
> + * @port:	port to check
> + *
> + * Return true if the device in %port is eDP.
> + */
> +bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
> +{
> +	union child_device_config *p_child;
> +	static const short port_mapping[] = {
> +		[PORT_B] = DVO_PORT_DPB,
> +		[PORT_C] = DVO_PORT_DPC,
> +		[PORT_D] = DVO_PORT_DPD,
> +		[PORT_E] = DVO_PORT_DPE,
> +	};
> +	int i;
> +
> +	if (!dev_priv->vbt.child_dev_num)
> +		return false;
> +
> +	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> +		p_child = dev_priv->vbt.child_dev + i;
> +
> +		if (p_child->common.dvo_port == port_mapping[port] &&
> +		    (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
> +		    (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
> +			return true;
> +	}
> +
> +	return false;
> +}
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 0e326e776e8f..2f8ce53df9cb 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4990,14 +4990,6 @@ put_power:
>  bool intel_dp_is_edp(struct drm_device *dev, enum port port)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> -	union child_device_config *p_child;
> -	int i;
> -	static const short port_mapping[] = {
> -		[PORT_B] = DVO_PORT_DPB,
> -		[PORT_C] = DVO_PORT_DPC,
> -		[PORT_D] = DVO_PORT_DPD,
> -		[PORT_E] = DVO_PORT_DPE,
> -	};
>  
>  	/*
>  	 * eDP not supported on g4x. so bail out early just
> @@ -5009,18 +5001,7 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
>  	if (port == PORT_A)
>  		return true;
>  
> -	if (!dev_priv->vbt.child_dev_num)
> -		return false;
> -
> -	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> -		p_child = dev_priv->vbt.child_dev + i;
> -
> -		if (p_child->common.dvo_port == port_mapping[port] &&
> -		    (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
> -		    (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
> -			return true;
> -	}
> -	return false;
> +	return intel_bios_is_port_edp(dev_priv, port);
>  }
>  
>  void
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list