Re: [PATCH RESEND 4/7] drm/i915: move VBT based DSI presence check to intel_bios.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 16, 2016 at 12:43:32PM +0200, Jani Nikula wrote:
> Hide knowledge about VBT child devices in intel_bios.c.
> 
> v2: Move port check to intel_bios.c (Sivakumar)
> 
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_drv.h   |  2 +-
>  drivers/gpu/drm/i915/intel_bios.c | 39 ++++++++++++++++++++++++++++++++++++++-
>  drivers/gpu/drm/i915/intel_dsi.c  | 17 ++++++++---------
>  3 files changed, 47 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index c6ec7029f691..9c7402c062b9 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1449,7 +1449,6 @@ struct intel_vbt_data {
>  
>  	/* MIPI DSI */
>  	struct {
> -		u16 port;
>  		u16 panel_id;
>  		struct mipi_config *config;
>  		struct mipi_pps_data *pps;
> @@ -3337,6 +3336,7 @@ 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);
> +bool intel_bios_is_dsi_present(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 7f61ca8165f0..4b6bd6f2e193 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1237,7 +1237,6 @@ parse_device_mapping(struct drm_i915_private *dev_priv,
>  		    &&p_child->common.device_type & DEVICE_TYPE_MIPI_OUTPUT) {
>  			DRM_DEBUG_KMS("Found MIPI as LFP\n");
>  			dev_priv->vbt.has_mipi = 1;
> -			dev_priv->vbt.dsi.port = p_child->common.dvo_port;
>  		}
>  
>  		child_dev_ptr = dev_priv->vbt.child_dev + count;
> @@ -1555,3 +1554,41 @@ bool intel_bios_is_port_edp(struct drm_i915_private *dev_priv, enum port port)
>  
>  	return false;
>  }
> +
> +/**
> + * intel_bios_is_dsi_present - is DSI present in VBT
> + * @dev_priv:	i915 device instance
> + * @port:	port for DSI if present
> + *
> + * Return true if DSI is present, and return the port in %port.
> + */
> +bool intel_bios_is_dsi_present(struct drm_i915_private *dev_priv,
> +			       enum port *port)
> +{
> +	union child_device_config *p_child;
> +	u8 dvo_port;
> +	int i;
> +
> +	for (i = 0; i < dev_priv->vbt.child_dev_num; i++) {
> +		p_child = dev_priv->vbt.child_dev + i;
> +
> +		if (!(p_child->common.device_type & DEVICE_TYPE_MIPI_OUTPUT))
> +			continue;
> +
> +		dvo_port = p_child->common.dvo_port;
> +
> +		switch (dvo_port) {
> +		case DVO_PORT_MIPIA:
> +		case DVO_PORT_MIPIC:
> +			*port = dvo_port - DVO_PORT_MIPIA;

I think this needs a type cast to appease sparse. Once you've made sure
sparse is happy (i.e. with or without the cast, whatever is needed):

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> +			return true;
> +		case DVO_PORT_MIPIB:
> +		case DVO_PORT_MIPID:
> +			DRM_DEBUG_KMS("VBT has unsupported DSI port %c\n",
> +				      port_name(dvo_port - DVO_PORT_MIPIA));
> +			break;
> +		}
> +	}
> +
> +	return false;
> +}
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 01b8e9f4c272..1df70ab9edf9 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -1121,7 +1121,7 @@ void intel_dsi_init(struct drm_device *dev)
>  	DRM_DEBUG_KMS("\n");
>  
>  	/* There is no detection method for MIPI so rely on VBT */
> -	if (!dev_priv->vbt.has_mipi)
> +	if (!intel_bios_is_dsi_present(dev_priv, &port))
>  		return;
>  
>  	if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) {
> @@ -1162,16 +1162,15 @@ void intel_dsi_init(struct drm_device *dev)
>  	intel_connector->unregister = intel_connector_unregister;
>  
>  	/* Pipe A maps to MIPI DSI port A, pipe B maps to MIPI DSI port C */
> -	if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) {
> -		intel_encoder->crtc_mask = (1 << PIPE_A);
> -		intel_dsi->ports = (1 << PORT_A);
> -	} else if (dev_priv->vbt.dsi.port == DVO_PORT_MIPIC) {
> -		intel_encoder->crtc_mask = (1 << PIPE_B);
> -		intel_dsi->ports = (1 << PORT_C);
> -	}
> +	if (port == PORT_A)
> +		intel_encoder->crtc_mask = 1 << PIPE_A;
> +	else
> +		intel_encoder->crtc_mask = 1 << PIPE_B;
>  
>  	if (dev_priv->vbt.dsi.config->dual_link)
> -		intel_dsi->ports = ((1 << PORT_A) | (1 << PORT_C));
> +		intel_dsi->ports = (1 << PORT_A) | (1 << PORT_C);
> +	else
> +		intel_dsi->ports = 1 << port;
>  
>  	/* Create a DSI host (and a device) for each port. */
>  	for_each_dsi_port(port, intel_dsi->ports) {
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux