Re: [PATCH 5/5] drm/i915: Enable lspcon initialization

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

 



On Tue, May 31, 2016 at 02:55:46PM +0530, Shashank Sharma wrote:
> This patch adds initialization code for lspcon.
> What we are doing here is:
> 	- Check if lspcon is configured in VBT for this port
> 	- If lspcon is configured, configure it as DP port
> 	- Register additional HDMI functions to support LS
> 	  mode functionalities.
> 
> Signed-off-by: Shashank Sharma <shashank.sharma@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c  | 36 ++++++++++++++++++++++++++++++++++--
>  drivers/gpu/drm/i915/intel_drv.h  |  4 ++++
>  drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++++++++++++
>  3 files changed, 55 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 811c829..2107c0d 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2314,8 +2314,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_digital_port *intel_dig_port;
>  	struct intel_encoder *intel_encoder;
> +	struct intel_connector *intel_connector = NULL;
>  	struct drm_encoder *encoder;
> -	bool init_hdmi, init_dp;
> +	bool init_hdmi, init_dp, init_lspcon = false;
>  	int max_lanes;
>  
>  	if (I915_READ(DDI_BUF_CTL(PORT_A)) & DDI_A_4_LANES) {
> @@ -2347,6 +2348,19 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
>  	init_hdmi = (dev_priv->vbt.ddi_port_info[port].supports_dvi ||
>  		     dev_priv->vbt.ddi_port_info[port].supports_hdmi);
>  	init_dp = dev_priv->vbt.ddi_port_info[port].supports_dp;
> +
> +	if (intel_bios_is_lspcon_present(dev_priv, port)) {
> +		/*
> +		* Lspcon device needs to be driven with DP connector
> +		* with special detection sequence. So make sure DP
> +		* is initialized before lspcon.
> +		*/
> +		init_dp = true;
> +		init_lspcon = true;
> +		init_hdmi = false;
> +		DRM_DEBUG_KMS("VBT says port %c has lspcon\n", port_name(port));
> +	}
> +
>  	if (!init_dp && !init_hdmi) {
>  		DRM_DEBUG_KMS("VBT says port %c is not DVI/HDMI/DP compatible, respect it\n",
>  			      port_name(port));
> @@ -2399,7 +2413,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
>  	intel_encoder->cloneable = 0;
>  
>  	if (init_dp) {
> -		if (!intel_ddi_init_dp_connector(intel_dig_port))
> +		intel_connector = intel_ddi_init_dp_connector(intel_dig_port);
> +		if (!intel_connector)
>  			goto err;
>  
>  		intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
> @@ -2420,6 +2435,23 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
>  			goto err;
>  	}
>  
> +	if (init_lspcon) {
> +		if (lspcon_init(intel_dig_port)) {
> +			if (intel_hdmi_init_minimum(intel_dig_port,
> +				intel_connector)) {
> +				DRM_ERROR("HDMI init for LSPCON failed\n");
> +				goto err;
> +			}
> +		} else {
> +			/*
> +			* LSPCON init faied, but DP init was success, so lets try to
> +			* drive as DP++ port.
> +			*/
> +			DRM_ERROR("LSPCON init failed on port %c\n",
> +				port_name(port));
> +		}
> +	}
> +
>  	return;
>  
>  err:
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index fa77886..402e656 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1454,6 +1454,10 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>  void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
>  enum drm_connector_status
>  intel_hdmi_detect(struct drm_connector *connector, bool force);
> +int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,
> +			       struct intel_connector *intel_connector);
> +
> +
>  
>  /* intel_lvds.c */
>  void intel_lvds_init(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 79184e2..54b0b46 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1931,6 +1931,23 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
>  	}
>  }
>  
> +int intel_hdmi_init_minimum(struct intel_digital_port *intel_dig_port,
> +			       struct intel_connector *intel_connector)
> +{
> +	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
> +
> +	if (WARN(intel_dig_port->max_lanes < 4,
> +		"Not enough lanes (%d) for HDMI on port %c\n",
> +		intel_dig_port->max_lanes, port_name(intel_dig_port->port)))
> +		return -EINVAL;
> +
> +	intel_hdmi->write_infoframe = hsw_write_infoframe;
> +	intel_hdmi->set_infoframes = hsw_set_infoframes;
> +	intel_hdmi->infoframe_enabled = hsw_infoframe_enabled;
> +	intel_hdmi->attached_connector = intel_connector;
> +	return 0;
> +}

Hmm. I think I had patches somewhere to isolate the infoframe stuff from
the HDMI code a bit better. I think I even had patches to move the
infoframe hooks to the dig_port level. Should maybe dig those up.

> +
>  void intel_hdmi_init(struct drm_device *dev,
>  		     i915_reg_t hdmi_reg, enum port port)
>  {
> -- 
> 1.9.1

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
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