diff mbox

[4/6] drm/i915: stop using is_pch_edp() in intel_dp_init_connector()

Message ID 1367940253-10329-5-git-send-email-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Imre Deak May 7, 2013, 3:24 p.m. UTC
is_pch_edp() will be removed in a follow-up patch, so replace it
with a check for the port and VBT info (for port-D eDP).

Also make things a bit clearer by using a switch on the ports.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

Comments

Ville Syrjala May 8, 2013, 8:07 a.m. UTC | #1
On Tue, May 07, 2013 at 06:24:11PM +0300, Imre Deak wrote:
> is_pch_edp() will be removed in a follow-up patch, so replace it
> with a check for the port and VBT info (for port-D eDP).
> 
> Also make things a bit clearer by using a switch on the ports.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c |   32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index d5a3717..31c6129 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3010,24 +3010,34 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
>  		if (intel_dpd_is_edp(dev))
>  			intel_dp->is_pch_edp = true;
>  
> +	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
>  	 */
> -	if (IS_VALLEYVIEW(dev) && port == PORT_C) {
> -		type = DRM_MODE_CONNECTOR_eDP;
> -		intel_encoder->type = INTEL_OUTPUT_EDP;
> -	} else if (port == PORT_A || is_pch_edp(intel_dp)) {
> +	switch (port) {
> +	case PORT_A:
>  		type = DRM_MODE_CONNECTOR_eDP;
> -		intel_encoder->type = INTEL_OUTPUT_EDP;
> -	} else {
> -		/* The intel_encoder->type value may be INTEL_OUTPUT_UNKNOWN for
> -		 * DDI or INTEL_OUTPUT_DISPLAYPORT for the older gens, so don't
> -		 * rewrite it.
> -		 */
> -		type = DRM_MODE_CONNECTOR_DisplayPort;
> +		break;
> +	case PORT_C:
> +		if (IS_VALLEYVIEW(dev))
> +			type = DRM_MODE_CONNECTOR_eDP;
> +		break;
> +	case PORT_D:
> +		if (HAS_PCH_SPLIT(dev) && intel_dpd_is_edp(dev))
> +			type = DRM_MODE_CONNECTOR_eDP;
> +		break;
> +	default:	/* silence GCC warning */
> +		break;
>  	}
>  
> +	/* The intel_encoder->type value may be INTEL_OUTPUT_UNKNOWN for
> +	 * DDI or INTEL_OUTPUT_DISPLAYPORT for the older gens, so don't
> +	 * rewrite it.
> +	 */
> +	if (type == DRM_MODE_CONNECTOR_eDP)
> +		intel_encoder->type = INTEL_OUTPUT_EDP;

The comment is a bit confusing since now it's in the code path that can
rewrite it. Perhaps add some mention of eDP to the comment as well, so
that people understand that it's still valid for other kinds of
connectors.

> +
>  	drm_connector_init(dev, connector, &intel_dp_connector_funcs, type);
>  	drm_connector_helper_add(connector, &intel_dp_connector_helper_funcs);
>  
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d5a3717..31c6129 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3010,24 +3010,34 @@  intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 		if (intel_dpd_is_edp(dev))
 			intel_dp->is_pch_edp = true;
 
+	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
 	 */
-	if (IS_VALLEYVIEW(dev) && port == PORT_C) {
-		type = DRM_MODE_CONNECTOR_eDP;
-		intel_encoder->type = INTEL_OUTPUT_EDP;
-	} else if (port == PORT_A || is_pch_edp(intel_dp)) {
+	switch (port) {
+	case PORT_A:
 		type = DRM_MODE_CONNECTOR_eDP;
-		intel_encoder->type = INTEL_OUTPUT_EDP;
-	} else {
-		/* The intel_encoder->type value may be INTEL_OUTPUT_UNKNOWN for
-		 * DDI or INTEL_OUTPUT_DISPLAYPORT for the older gens, so don't
-		 * rewrite it.
-		 */
-		type = DRM_MODE_CONNECTOR_DisplayPort;
+		break;
+	case PORT_C:
+		if (IS_VALLEYVIEW(dev))
+			type = DRM_MODE_CONNECTOR_eDP;
+		break;
+	case PORT_D:
+		if (HAS_PCH_SPLIT(dev) && intel_dpd_is_edp(dev))
+			type = DRM_MODE_CONNECTOR_eDP;
+		break;
+	default:	/* silence GCC warning */
+		break;
 	}
 
+	/* The intel_encoder->type value may be INTEL_OUTPUT_UNKNOWN for
+	 * DDI or INTEL_OUTPUT_DISPLAYPORT for the older gens, so don't
+	 * rewrite it.
+	 */
+	if (type == DRM_MODE_CONNECTOR_eDP)
+		intel_encoder->type = INTEL_OUTPUT_EDP;
+
 	drm_connector_init(dev, connector, &intel_dp_connector_funcs, type);
 	drm_connector_helper_add(connector, &intel_dp_connector_helper_funcs);