diff mbox

[v3,4/4] drm/i915: Enable lspcon initialization

Message ID 1467723950-14093-5-git-send-email-shashank.sharma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sharma, Shashank July 5, 2016, 1:05 p.m. UTC
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, initialize it and configure it
          as DP port.

V2: Addressed Ville's review comments:
- Not adding AVI IF functions for LSPCON display now.
  This part will be added once the dig_port level AVI-IF series
  gets merged.

V3: Rebase

Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

Comments

Rodrigo Vivi July 6, 2016, 5:34 p.m. UTC | #1
If this works even without setting the info frame on this code and that
is on progress on other series I believe we can move forward so in this
case fell free to use:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


On Tue, 2016-07-05 at 18:35 +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, initialize it and configure it

>           as DP port.

> 

> V2: Addressed Ville's review comments:

> - Not adding AVI IF functions for LSPCON display now.

>   This part will be added once the dig_port level AVI-IF series

>   gets merged.

> 

> V3: Rebase

> 

> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>

> ---

>  drivers/gpu/drm/i915/intel_ddi.c | 29 ++++++++++++++++++++++++++++-

>  1 file changed, 28 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/i915/intel_ddi.c

> b/drivers/gpu/drm/i915/intel_ddi.c

> index d6efe8b..3d115a7 100644

> --- a/drivers/gpu/drm/i915/intel_ddi.c

> +++ b/drivers/gpu/drm/i915/intel_ddi.c

> @@ -2326,7 +2326,7 @@ void intel_ddi_init(struct drm_device *dev,

> enum port port)

>  	struct intel_digital_port *intel_dig_port;

>  	struct intel_encoder *intel_encoder;

>  	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) {

> @@ -2358,6 +2358,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));

> @@ -2433,6 +2446,20 @@ void intel_ddi_init(struct drm_device *dev,

> enum port port)

>  			goto err;

>  	}

>  

> +	if (init_lspcon) {

> +		if (lspcon_init(intel_dig_port))

> +			/* TODO: handle hdmi info frame part */

> +			DRM_DEBUG_KMS("LSPCON init success on port

> %c\n",

> +				port_name(port));

> +		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:
Sharma, Shashank July 6, 2016, 5:40 p.m. UTC | #2
Thanks. I forgot to mention, this code works without AVI IF too. 

Regards
Shashank 
-----Original Message-----
From: Vivi, Rodrigo 

Sent: Wednesday, July 6, 2016 11:04 PM
To: Sharma, Shashank <shashank.sharma@intel.com>; intel-gfx@lists.freedesktop.org; rodrigo.vivi@gmail.com
Cc: ville.syrjala@linux.intel.com; Zanoni, Paulo R <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH v3 4/4] drm/i915: Enable lspcon initialization

If this works even without setting the info frame on this code and that is on progress on other series I believe we can move forward so in this case fell free to use:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


On Tue, 2016-07-05 at 18:35 +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, initialize it and configure it

>           as DP port.

> 

> V2: Addressed Ville's review comments:

> - Not adding AVI IF functions for LSPCON display now.

>   This part will be added once the dig_port level AVI-IF series

>   gets merged.

> 

> V3: Rebase

> 

> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>

> ---

>  drivers/gpu/drm/i915/intel_ddi.c | 29 ++++++++++++++++++++++++++++-

>  1 file changed, 28 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/i915/intel_ddi.c

> b/drivers/gpu/drm/i915/intel_ddi.c

> index d6efe8b..3d115a7 100644

> --- a/drivers/gpu/drm/i915/intel_ddi.c

> +++ b/drivers/gpu/drm/i915/intel_ddi.c

> @@ -2326,7 +2326,7 @@ void intel_ddi_init(struct drm_device *dev, enum 

> port port)

>  	struct intel_digital_port *intel_dig_port;

>  	struct intel_encoder *intel_encoder;

>  	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) { @@ -2358,6 

> +2358,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));

> @@ -2433,6 +2446,20 @@ void intel_ddi_init(struct drm_device *dev, 

> enum port port)

>  			goto err;

>  	}

>  

> +	if (init_lspcon) {

> +		if (lspcon_init(intel_dig_port))

> +			/* TODO: handle hdmi info frame part */

> +			DRM_DEBUG_KMS("LSPCON init success on port

> %c\n",

> +				port_name(port));

> +		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 mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index d6efe8b..3d115a7 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2326,7 +2326,7 @@  void intel_ddi_init(struct drm_device *dev, enum port port)
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	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) {
@@ -2358,6 +2358,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));
@@ -2433,6 +2446,20 @@  void intel_ddi_init(struct drm_device *dev, enum port port)
 			goto err;
 	}
 
+	if (init_lspcon) {
+		if (lspcon_init(intel_dig_port))
+			/* TODO: handle hdmi info frame part */
+			DRM_DEBUG_KMS("LSPCON init success on port %c\n",
+				port_name(port));
+		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: