All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/i915: eDP vs. DP detection changes
@ 2013-11-01 16:22 ville.syrjala
  2013-11-01 16:22 ` [PATCH 1/3] drm/i915: Check VBT for eDP ports on VLV ville.syrjala
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: ville.syrjala @ 2013-11-01 16:22 UTC (permalink / raw)
  To: intel-gfx

This series attempts to fix eDP detection, on VLV mainly. And it succeeds
in doing so for at least one VLV machine that has eDP on port B instead
of port C.

The last simplification patch was suggested by Jesse. I suppose it might
cause false positives on some machines that currently work ,so I'll
happily leave the decision whether to merge it to someone else ;)

Ville Syrjälä (3):
      drm/i915: Check VBT for eDP ports on VLV
      drm/i915: Make intel_dp_is_edp() less specific
      drm/i915: Simplify DP vs. eDP detection

 drivers/gpu/drm/i915/intel_display.c |  5 ++---
 drivers/gpu/drm/i915/intel_dp.c      | 36 ++++++++++++++----------------------
 drivers/gpu/drm/i915/intel_drv.h     |  2 +-
 3 files changed, 17 insertions(+), 26 deletions(-)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/3] drm/i915: Check VBT for eDP ports on VLV
  2013-11-01 16:22 [PATCH 0/3] drm/i915: eDP vs. DP detection changes ville.syrjala
@ 2013-11-01 16:22 ` ville.syrjala
  2013-11-01 17:23   ` Jesse Barnes
  2013-11-01 16:22 ` [PATCH 2/3] drm/i915: Make intel_dp_is_edp() less specific ville.syrjala
  2013-11-01 16:22 ` [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection ville.syrjala
  2 siblings, 1 reply; 13+ messages in thread
From: ville.syrjala @ 2013-11-01 16:22 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

VLV can have eDP on either port B or C, or even both. Based on the
VBT spec, intel_dpd_is_edp() should work on VLV too, assuming we
check the correct ports.

So instead of hardcoding port D, rename the function to
intel_dp_is_edp() and pass the port as a parameter, and use it
on VLV ports B and C.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051
Tested-by: Robert Hooker <robert.hooker@canonical.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |  5 ++---
 drivers/gpu/drm/i915/intel_dp.c      | 14 ++++++++++----
 drivers/gpu/drm/i915/intel_drv.h     |  2 +-
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8f40ae3..3cdfbda 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9954,7 +9954,7 @@ static void intel_setup_outputs(struct drm_device *dev)
 			intel_ddi_init(dev, PORT_D);
 	} else if (HAS_PCH_SPLIT(dev)) {
 		int found;
-		dpd_is_edp = intel_dpd_is_edp(dev);
+		dpd_is_edp = intel_dp_is_edp(dev, PORT_D);
 
 		if (has_edp_a(dev))
 			intel_dp_init(dev, DP_A, PORT_A);
@@ -9991,8 +9991,7 @@ static void intel_setup_outputs(struct drm_device *dev)
 			intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIC,
 					PORT_C);
 			if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED)
-				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C,
-					      PORT_C);
+				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C);
 		}
 
 		intel_dsi_init(dev);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index b3cc333..ede023c 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3263,11 +3263,16 @@ intel_trans_dp_port_sel(struct drm_crtc *crtc)
 }
 
 /* check the VBT to see whether the eDP is on DP-D port */
-bool intel_dpd_is_edp(struct drm_device *dev)
+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] = PORT_IDPB,
+		[PORT_C] = PORT_IDPC,
+		[PORT_D] = PORT_IDPD,
+	};
 
 	if (!dev_priv->vbt.child_dev_num)
 		return false;
@@ -3275,7 +3280,7 @@ bool intel_dpd_is_edp(struct drm_device *dev)
 	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_IDPD &&
+		if (p_child->common.dvo_port == port_mapping[port] &&
 		    p_child->common.device_type == DEVICE_TYPE_eDP)
 			return true;
 	}
@@ -3564,12 +3569,13 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	case PORT_A:
 		type = DRM_MODE_CONNECTOR_eDP;
 		break;
+	case PORT_B:
 	case PORT_C:
-		if (IS_VALLEYVIEW(dev))
+		if (IS_VALLEYVIEW(dev) && intel_dp_is_edp(dev, port))
 			type = DRM_MODE_CONNECTOR_eDP;
 		break;
 	case PORT_D:
-		if (HAS_PCH_SPLIT(dev) && intel_dpd_is_edp(dev))
+		if (HAS_PCH_SPLIT(dev) && intel_dp_is_edp(dev, port))
 			type = DRM_MODE_CONNECTOR_eDP;
 		break;
 	default:	/* silence GCC warning */
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9d2624f..3612896 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -707,7 +707,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder);
 void intel_dp_check_link_status(struct intel_dp *intel_dp);
 bool intel_dp_compute_config(struct intel_encoder *encoder,
 			     struct intel_crtc_config *pipe_config);
-bool intel_dpd_is_edp(struct drm_device *dev);
+bool intel_dp_is_edp(struct drm_device *dev, enum port port);
 void ironlake_edp_backlight_on(struct intel_dp *intel_dp);
 void ironlake_edp_backlight_off(struct intel_dp *intel_dp);
 void ironlake_edp_panel_on(struct intel_dp *intel_dp);
-- 
1.8.1.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/3] drm/i915: Make intel_dp_is_edp() less specific
  2013-11-01 16:22 [PATCH 0/3] drm/i915: eDP vs. DP detection changes ville.syrjala
  2013-11-01 16:22 ` [PATCH 1/3] drm/i915: Check VBT for eDP ports on VLV ville.syrjala
@ 2013-11-01 16:22 ` ville.syrjala
  2013-11-01 17:25   ` Jesse Barnes
  2013-11-01 16:22 ` [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection ville.syrjala
  2 siblings, 1 reply; 13+ messages in thread
From: ville.syrjala @ 2013-11-01 16:22 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

All the bits in the VBT child device type have some speciifc meaning,
so looking for an exact match isn't always the right thing. On some
VLVs for example the device type for eDP panels is 0x1806.

If we mask out the bits that could concievably change between different
eDP panels, we are left with the set of bits that should still
tell us if the port is eDP or not.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051
Tested-by: Robert Hooker <robert.hooker@canonical.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index ede023c..87cfb12 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3281,7 +3281,7 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		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)
+		    (p_child->common.device_type & 0x1f3f) == (DEVICE_TYPE_eDP & 0x1f3f))
 			return true;
 	}
 	return false;
-- 
1.8.1.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection
  2013-11-01 16:22 [PATCH 0/3] drm/i915: eDP vs. DP detection changes ville.syrjala
  2013-11-01 16:22 ` [PATCH 1/3] drm/i915: Check VBT for eDP ports on VLV ville.syrjala
  2013-11-01 16:22 ` [PATCH 2/3] drm/i915: Make intel_dp_is_edp() less specific ville.syrjala
@ 2013-11-01 16:22 ` ville.syrjala
  2013-11-01 17:25   ` Jesse Barnes
  2 siblings, 1 reply; 13+ messages in thread
From: ville.syrjala @ 2013-11-01 16:22 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reduce the eDP detection to just checking if it's port A, or if
the VBT tells us that the port is eDP for the other ports.

Suggested-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 87cfb12..1e6bf7b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3274,6 +3274,9 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		[PORT_D] = PORT_IDPD,
 	};
 
+	if (port == PORT_A)
+		return true;
+
 	if (!dev_priv->vbt.child_dev_num)
 		return false;
 
@@ -3560,27 +3563,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	intel_dp->DP = I915_READ(intel_dp->output_reg);
 	intel_dp->attached_connector = intel_connector;
 
-	type = DRM_MODE_CONNECTOR_DisplayPort;
-	/*
-	 * FIXME : We need to initialize built-in panels before external panels.
-	 * For X0, DP_C is fixed as eDP. Revisit this as part of VLV eDP cleanup
-	 */
-	switch (port) {
-	case PORT_A:
+	if (intel_dp_is_edp(dev, port))
 		type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	case PORT_B:
-	case PORT_C:
-		if (IS_VALLEYVIEW(dev) && intel_dp_is_edp(dev, port))
-			type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	case PORT_D:
-		if (HAS_PCH_SPLIT(dev) && intel_dp_is_edp(dev, port))
-			type = DRM_MODE_CONNECTOR_eDP;
-		break;
-	default:	/* silence GCC warning */
-		break;
-	}
+	else
+		type = DRM_MODE_CONNECTOR_DisplayPort;
 
 	/*
 	 * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but
-- 
1.8.1.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] drm/i915: Check VBT for eDP ports on VLV
  2013-11-01 16:22 ` [PATCH 1/3] drm/i915: Check VBT for eDP ports on VLV ville.syrjala
@ 2013-11-01 17:23   ` Jesse Barnes
  0 siblings, 0 replies; 13+ messages in thread
From: Jesse Barnes @ 2013-11-01 17:23 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx

On Fri,  1 Nov 2013 18:22:39 +0200
ville.syrjala@linux.intel.com wrote:

>  			if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED)
> -				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C,
> -					      PORT_C);
> +				intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C);
>  		}
>  

Spurious whitespace change, but it's fine.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/3] drm/i915: Make intel_dp_is_edp() less specific
  2013-11-01 16:22 ` [PATCH 2/3] drm/i915: Make intel_dp_is_edp() less specific ville.syrjala
@ 2013-11-01 17:25   ` Jesse Barnes
  2013-11-01 18:32     ` [PATCH 1/2] drm/i915: Give names to the VBT child device type bits ville.syrjala
  0 siblings, 1 reply; 13+ messages in thread
From: Jesse Barnes @ 2013-11-01 17:25 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx

On Fri,  1 Nov 2013 18:22:40 +0200
ville.syrjala@linux.intel.com wrote:

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> All the bits in the VBT child device type have some speciifc meaning,
> so looking for an exact match isn't always the right thing. On some
> VLVs for example the device type for eDP panels is 0x1806.
> 
> If we mask out the bits that could concievably change between different
> eDP panels, we are left with the set of bits that should still
> tell us if the port is eDP or not.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051
> Tested-by: Robert Hooker <robert.hooker@canonical.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index ede023c..87cfb12 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3281,7 +3281,7 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
>  		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)
> +		    (p_child->common.device_type & 0x1f3f) == (DEVICE_TYPE_eDP & 0x1f3f))
>  			return true;
>  	}
>  	return false;

Is there no way to split out these magic bits individually into
something readable?  If not, I guess we'll have to trust you, but it
seems fragile.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection
  2013-11-01 16:22 ` [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection ville.syrjala
@ 2013-11-01 17:25   ` Jesse Barnes
  2013-11-28 12:43     ` Daniel Vetter
  0 siblings, 1 reply; 13+ messages in thread
From: Jesse Barnes @ 2013-11-01 17:25 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx

On Fri,  1 Nov 2013 18:22:41 +0200
ville.syrjala@linux.intel.com wrote:

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Reduce the eDP detection to just checking if it's port A, or if
> the VBT tells us that the port is eDP for the other ports.
> 
> Suggested-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 26 ++++++--------------------
>  1 file changed, 6 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 87cfb12..1e6bf7b 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3274,6 +3274,9 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
>  		[PORT_D] = PORT_IDPD,
>  	};
>  
> +	if (port == PORT_A)
> +		return true;
> +
>  	if (!dev_priv->vbt.child_dev_num)
>  		return false;
>  
> @@ -3560,27 +3563,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
>  	intel_dp->DP = I915_READ(intel_dp->output_reg);
>  	intel_dp->attached_connector = intel_connector;
>  
> -	type = DRM_MODE_CONNECTOR_DisplayPort;
> -	/*
> -	 * FIXME : We need to initialize built-in panels before external panels.
> -	 * For X0, DP_C is fixed as eDP. Revisit this as part of VLV eDP cleanup
> -	 */
> -	switch (port) {
> -	case PORT_A:
> +	if (intel_dp_is_edp(dev, port))
>  		type = DRM_MODE_CONNECTOR_eDP;
> -		break;
> -	case PORT_B:
> -	case PORT_C:
> -		if (IS_VALLEYVIEW(dev) && intel_dp_is_edp(dev, port))
> -			type = DRM_MODE_CONNECTOR_eDP;
> -		break;
> -	case PORT_D:
> -		if (HAS_PCH_SPLIT(dev) && intel_dp_is_edp(dev, port))
> -			type = DRM_MODE_CONNECTOR_eDP;
> -		break;
> -	default:	/* silence GCC warning */
> -		break;
> -	}
> +	else
> +		type = DRM_MODE_CONNECTOR_DisplayPort;
>  
>  	/*
>  	 * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but

Ah much better.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/2] drm/i915: Give names to the VBT child device type bits
  2013-11-01 17:25   ` Jesse Barnes
@ 2013-11-01 18:32     ` ville.syrjala
  2013-11-01 18:32       ` [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific ville.syrjala
  2013-11-04 15:58       ` [PATCH 1/2] drm/i915: Give names to the VBT child device type bits Paulo Zanoni
  0 siblings, 2 replies; 13+ messages in thread
From: ville.syrjala @ 2013-11-01 18:32 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c | 10 +++++-----
 drivers/gpu/drm/i915/intel_bios.h | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index e29bcae..6dd622d 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -624,11 +624,11 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 
 	aux_channel = child->raw[25];
 
-	is_dvi = child->common.device_type & (1 << 4);
-	is_dp = child->common.device_type & (1 << 2);
-	is_crt = child->common.device_type & (1 << 0);
-	is_hdmi = is_dvi && (child->common.device_type & (1 << 11)) == 0;
-	is_edp = is_dp && (child->common.device_type & (1 << 12));
+	is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
+	is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
+	is_crt = child->common.device_type & DEVICE_TYPE_ANALOG_OUTPUT;
+	is_hdmi = is_dvi && (child->common.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
+	is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR);
 
 	info->supports_dvi = is_dvi;
 	info->supports_hdmi = is_hdmi;
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index 287cc5a..f439c14 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -638,6 +638,22 @@ int intel_parse_bios(struct drm_device *dev);
 #define	 DEVICE_TYPE_DP		0x68C6
 #define	 DEVICE_TYPE_eDP	0x78C6
 
+#define  DEVICE_TYPE_CLASS_EXTENSION	(1 << 15)
+#define  DEVICE_TYPE_POWER_MANAGEMENT	(1 << 14)
+#define  DEVICE_TYPE_HOTPLUG_SIGNALING	(1 << 13)
+#define  DEVICE_TYPE_INTERNAL_CONNECTOR	(1 << 12)
+#define  DEVICE_TYPE_NOT_HDMI_OUTPUT	(1 << 11)
+#define  DEVICE_TYPE_MIPI_OUTPUT	(1 << 10)
+#define  DEVICE_TYPE_COMPOSITE_OUTPUT	(1 << 9)
+#define  DEVICE_TYPE_DUAL_CHANNEL	(1 << 8)
+#define  DEVICE_TYPE_HIGH_SPEED_LINK	(1 << 6)
+#define  DEVICE_TYPE_LVDS_SINGALING	(1 << 5)
+#define  DEVICE_TYPE_TMDS_DVI_SIGNALING	(1 << 4)
+#define  DEVICE_TYPE_VIDEO_SIGNALING	(1 << 3)
+#define  DEVICE_TYPE_DISPLAYPORT_OUTPUT	(1 << 2)
+#define  DEVICE_TYPE_DIGITAL_OUTPUT	(1 << 1)
+#define  DEVICE_TYPE_ANALOG_OUTPUT	(1 << 0)
+
 /* define the DVO port for HDMI output type */
 #define		DVO_B		1
 #define		DVO_C		2
-- 
1.8.1.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific
  2013-11-01 18:32     ` [PATCH 1/2] drm/i915: Give names to the VBT child device type bits ville.syrjala
@ 2013-11-01 18:32       ` ville.syrjala
  2013-11-04 16:08         ` Paulo Zanoni
  2013-11-04 15:58       ` [PATCH 1/2] drm/i915: Give names to the VBT child device type bits Paulo Zanoni
  1 sibling, 1 reply; 13+ messages in thread
From: ville.syrjala @ 2013-11-01 18:32 UTC (permalink / raw)
  To: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

All the bits in the VBT child device type have some speciifc meaning,
so looking for an exact match isn't always the right thing. On some
VLVs for example the device type for eDP panels is 0x1806.

If we mask out the bits that could concievably change between different
eDP panels, we are left with the set of bits that should still
tell us if the port is eDP or not.

v2: Use the named bits for VBT child device type

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051
Tested-by: Robert Hooker <robert.hooker@canonical.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_bios.h | 18 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c   |  3 ++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index f439c14..f580a2b 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -654,6 +654,24 @@ int intel_parse_bios(struct drm_device *dev);
 #define  DEVICE_TYPE_DIGITAL_OUTPUT	(1 << 1)
 #define  DEVICE_TYPE_ANALOG_OUTPUT	(1 << 0)
 
+/*
+ * Bits we care about when checking for DEVICE_TYPE_eDP
+ * Depending on the system, the other bits may or may not
+ * be set for eDP outputs.
+ */
+#define DEVICE_TYPE_eDP_BITS \
+	(DEVICE_TYPE_INTERNAL_CONNECTOR | \
+	 DEVICE_TYPE_NOT_HDMI_OUTPUT | \
+	 DEVICE_TYPE_MIPI_OUTPUT | \
+	 DEVICE_TYPE_COMPOSITE_OUTPUT | \
+	 DEVICE_TYPE_DUAL_CHANNEL | \
+	 DEVICE_TYPE_LVDS_SINGALING | \
+	 DEVICE_TYPE_TMDS_DVI_SIGNALING | \
+	 DEVICE_TYPE_VIDEO_SIGNALING | \
+	 DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
+	 DEVICE_TYPE_DIGITAL_OUTPUT | \
+	 DEVICE_TYPE_ANALOG_OUTPUT)
+
 /* define the DVO port for HDMI output type */
 #define		DVO_B		1
 #define		DVO_C		2
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f25a49e..ee3f573 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3284,7 +3284,8 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
 		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)
+		    (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
+		    (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
 			return true;
 	}
 	return false;
-- 
1.8.1.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] drm/i915: Give names to the VBT child device type bits
  2013-11-01 18:32     ` [PATCH 1/2] drm/i915: Give names to the VBT child device type bits ville.syrjala
  2013-11-01 18:32       ` [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific ville.syrjala
@ 2013-11-04 15:58       ` Paulo Zanoni
  1 sibling, 0 replies; 13+ messages in thread
From: Paulo Zanoni @ 2013-11-04 15:58 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: Intel Graphics Development

2013/11/1  <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

I guess you can blame Paulo for being lazy here...

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

On a future patch, you might also want to do something about the
definition of bits below the comment "/* Add the device class for LFP,
TV, HDMI */".

> ---
>  drivers/gpu/drm/i915/intel_bios.c | 10 +++++-----
>  drivers/gpu/drm/i915/intel_bios.h | 16 ++++++++++++++++
>  2 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index e29bcae..6dd622d 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -624,11 +624,11 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
>
>         aux_channel = child->raw[25];
>
> -       is_dvi = child->common.device_type & (1 << 4);
> -       is_dp = child->common.device_type & (1 << 2);
> -       is_crt = child->common.device_type & (1 << 0);
> -       is_hdmi = is_dvi && (child->common.device_type & (1 << 11)) == 0;
> -       is_edp = is_dp && (child->common.device_type & (1 << 12));
> +       is_dvi = child->common.device_type & DEVICE_TYPE_TMDS_DVI_SIGNALING;
> +       is_dp = child->common.device_type & DEVICE_TYPE_DISPLAYPORT_OUTPUT;
> +       is_crt = child->common.device_type & DEVICE_TYPE_ANALOG_OUTPUT;
> +       is_hdmi = is_dvi && (child->common.device_type & DEVICE_TYPE_NOT_HDMI_OUTPUT) == 0;
> +       is_edp = is_dp && (child->common.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR);
>
>         info->supports_dvi = is_dvi;
>         info->supports_hdmi = is_hdmi;
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index 287cc5a..f439c14 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -638,6 +638,22 @@ int intel_parse_bios(struct drm_device *dev);
>  #define         DEVICE_TYPE_DP         0x68C6
>  #define         DEVICE_TYPE_eDP        0x78C6
>
> +#define  DEVICE_TYPE_CLASS_EXTENSION   (1 << 15)
> +#define  DEVICE_TYPE_POWER_MANAGEMENT  (1 << 14)
> +#define  DEVICE_TYPE_HOTPLUG_SIGNALING (1 << 13)
> +#define  DEVICE_TYPE_INTERNAL_CONNECTOR        (1 << 12)
> +#define  DEVICE_TYPE_NOT_HDMI_OUTPUT   (1 << 11)
> +#define  DEVICE_TYPE_MIPI_OUTPUT       (1 << 10)
> +#define  DEVICE_TYPE_COMPOSITE_OUTPUT  (1 << 9)
> +#define  DEVICE_TYPE_DUAL_CHANNEL      (1 << 8)
> +#define  DEVICE_TYPE_HIGH_SPEED_LINK   (1 << 6)
> +#define  DEVICE_TYPE_LVDS_SINGALING    (1 << 5)
> +#define  DEVICE_TYPE_TMDS_DVI_SIGNALING        (1 << 4)
> +#define  DEVICE_TYPE_VIDEO_SIGNALING   (1 << 3)
> +#define  DEVICE_TYPE_DISPLAYPORT_OUTPUT        (1 << 2)
> +#define  DEVICE_TYPE_DIGITAL_OUTPUT    (1 << 1)
> +#define  DEVICE_TYPE_ANALOG_OUTPUT     (1 << 0)
> +
>  /* define the DVO port for HDMI output type */
>  #define                DVO_B           1
>  #define                DVO_C           2
> --
> 1.8.1.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific
  2013-11-01 18:32       ` [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific ville.syrjala
@ 2013-11-04 16:08         ` Paulo Zanoni
  2013-11-04 16:30           ` Daniel Vetter
  0 siblings, 1 reply; 13+ messages in thread
From: Paulo Zanoni @ 2013-11-04 16:08 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: Intel Graphics Development

2013/11/1  <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> All the bits in the VBT child device type have some speciifc meaning,
> so looking for an exact match isn't always the right thing. On some
> VLVs for example the device type for eDP panels is 0x1806.
>
> If we mask out the bits that could concievably change between different
> eDP panels, we are left with the set of bits that should still
> tell us if the port is eDP or not.
>
> v2: Use the named bits for VBT child device type

We go with this patch until they start creating analog eDP panels or
whatever else their creative minds come up with :)

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71051
> Tested-by: Robert Hooker <robert.hooker@canonical.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_bios.h | 18 ++++++++++++++++++
>  drivers/gpu/drm/i915/intel_dp.c   |  3 ++-
>  2 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
> index f439c14..f580a2b 100644
> --- a/drivers/gpu/drm/i915/intel_bios.h
> +++ b/drivers/gpu/drm/i915/intel_bios.h
> @@ -654,6 +654,24 @@ int intel_parse_bios(struct drm_device *dev);
>  #define  DEVICE_TYPE_DIGITAL_OUTPUT    (1 << 1)
>  #define  DEVICE_TYPE_ANALOG_OUTPUT     (1 << 0)
>
> +/*
> + * Bits we care about when checking for DEVICE_TYPE_eDP
> + * Depending on the system, the other bits may or may not
> + * be set for eDP outputs.
> + */
> +#define DEVICE_TYPE_eDP_BITS \
> +       (DEVICE_TYPE_INTERNAL_CONNECTOR | \
> +        DEVICE_TYPE_NOT_HDMI_OUTPUT | \
> +        DEVICE_TYPE_MIPI_OUTPUT | \
> +        DEVICE_TYPE_COMPOSITE_OUTPUT | \
> +        DEVICE_TYPE_DUAL_CHANNEL | \
> +        DEVICE_TYPE_LVDS_SINGALING | \
> +        DEVICE_TYPE_TMDS_DVI_SIGNALING | \
> +        DEVICE_TYPE_VIDEO_SIGNALING | \
> +        DEVICE_TYPE_DISPLAYPORT_OUTPUT | \
> +        DEVICE_TYPE_DIGITAL_OUTPUT | \
> +        DEVICE_TYPE_ANALOG_OUTPUT)
> +
>  /* define the DVO port for HDMI output type */
>  #define                DVO_B           1
>  #define                DVO_C           2
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index f25a49e..ee3f573 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3284,7 +3284,8 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
>                 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)
> +                   (p_child->common.device_type & DEVICE_TYPE_eDP_BITS) ==
> +                   (DEVICE_TYPE_eDP & DEVICE_TYPE_eDP_BITS))
>                         return true;
>         }
>         return false;
> --
> 1.8.1.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific
  2013-11-04 16:08         ` Paulo Zanoni
@ 2013-11-04 16:30           ` Daniel Vetter
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Vetter @ 2013-11-04 16:30 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: Intel Graphics Development

On Mon, Nov 04, 2013 at 02:08:19PM -0200, Paulo Zanoni wrote:
> 2013/11/1  <ville.syrjala@linux.intel.com>:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > All the bits in the VBT child device type have some speciifc meaning,
> > so looking for an exact match isn't always the right thing. On some
> > VLVs for example the device type for eDP panels is 0x1806.
> >
> > If we mask out the bits that could concievably change between different
> > eDP panels, we are left with the set of bits that should still
> > tell us if the port is eDP or not.
> >
> > v2: Use the named bits for VBT child device type
> 
> We go with this patch until they start creating analog eDP panels or
> whatever else their creative minds come up with :)
> 
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Both merged, thanks for patches&review.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection
  2013-11-01 17:25   ` Jesse Barnes
@ 2013-11-28 12:43     ` Daniel Vetter
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Vetter @ 2013-11-28 12:43 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: intel-gfx

On Fri, Nov 01, 2013 at 10:25:42AM -0700, Jesse Barnes wrote:
> On Fri,  1 Nov 2013 18:22:41 +0200
> ville.syrjala@linux.intel.com wrote:
> 
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Reduce the eDP detection to just checking if it's port A, or if
> > the VBT tells us that the port is eDP for the other ports.
> > 
> > Suggested-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c | 26 ++++++--------------------
> >  1 file changed, 6 insertions(+), 20 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 87cfb12..1e6bf7b 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -3274,6 +3274,9 @@ bool intel_dp_is_edp(struct drm_device *dev, enum port port)
> >  		[PORT_D] = PORT_IDPD,
> >  	};
> >  
> > +	if (port == PORT_A)
> > +		return true;
> > +
> >  	if (!dev_priv->vbt.child_dev_num)
> >  		return false;
> >  
> > @@ -3560,27 +3563,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
> >  	intel_dp->DP = I915_READ(intel_dp->output_reg);
> >  	intel_dp->attached_connector = intel_connector;
> >  
> > -	type = DRM_MODE_CONNECTOR_DisplayPort;
> > -	/*
> > -	 * FIXME : We need to initialize built-in panels before external panels.
> > -	 * For X0, DP_C is fixed as eDP. Revisit this as part of VLV eDP cleanup
> > -	 */
> > -	switch (port) {
> > -	case PORT_A:
> > +	if (intel_dp_is_edp(dev, port))
> >  		type = DRM_MODE_CONNECTOR_eDP;
> > -		break;
> > -	case PORT_B:
> > -	case PORT_C:
> > -		if (IS_VALLEYVIEW(dev) && intel_dp_is_edp(dev, port))
> > -			type = DRM_MODE_CONNECTOR_eDP;
> > -		break;
> > -	case PORT_D:
> > -		if (HAS_PCH_SPLIT(dev) && intel_dp_is_edp(dev, port))
> > -			type = DRM_MODE_CONNECTOR_eDP;
> > -		break;
> > -	default:	/* silence GCC warning */
> > -		break;
> > -	}
> > +	else
> > +		type = DRM_MODE_CONNECTOR_DisplayPort;
> >  
> >  	/*
> >  	 * For eDP we always set the encoder type to INTEL_OUTPUT_EDP, but
> 
> Ah much better.
> 
> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Ok, now also merged patches 1&3 of the original series here. Patch 1
didn't really apply that well any more, so please double-check what I've
done.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-11-28 12:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01 16:22 [PATCH 0/3] drm/i915: eDP vs. DP detection changes ville.syrjala
2013-11-01 16:22 ` [PATCH 1/3] drm/i915: Check VBT for eDP ports on VLV ville.syrjala
2013-11-01 17:23   ` Jesse Barnes
2013-11-01 16:22 ` [PATCH 2/3] drm/i915: Make intel_dp_is_edp() less specific ville.syrjala
2013-11-01 17:25   ` Jesse Barnes
2013-11-01 18:32     ` [PATCH 1/2] drm/i915: Give names to the VBT child device type bits ville.syrjala
2013-11-01 18:32       ` [PATCH v2 2/2] drm/i915: Make intel_dp_is_edp() less specific ville.syrjala
2013-11-04 16:08         ` Paulo Zanoni
2013-11-04 16:30           ` Daniel Vetter
2013-11-04 15:58       ` [PATCH 1/2] drm/i915: Give names to the VBT child device type bits Paulo Zanoni
2013-11-01 16:22 ` [PATCH 3/3] drm/i915: Simplify DP vs. eDP detection ville.syrjala
2013-11-01 17:25   ` Jesse Barnes
2013-11-28 12:43     ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.