drm/i915/bxt: fix intel_prepare_ddi for DSI ports
diff mbox

Message ID 1434546769-28152-1-git-send-email-imre.deak@intel.com
State New
Headers show

Commit Message

Imre Deak June 17, 2015, 1:12 p.m. UTC
BXT introduces DSI ports, for which we need to skip the DDI port setup.
Also there is no real reason for having a BUG for unknown port types so
convert it to a WARN.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Lespiau, Damien June 22, 2015, 1:34 p.m. UTC | #1
On Wed, Jun 17, 2015 at 04:12:49PM +0300, Imre Deak wrote:
> BXT introduces DSI ports, for which we need to skip the DDI port setup.
> Also there is no real reason for having a BUG for unknown port types so
> convert it to a WARN.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

I think we could do with a better port abstraction as a whole, right now
that's all a bit messy. But anyway:

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 31b29e8..9ae297a 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -210,7 +210,7 @@ static const struct bxt_ddi_buf_trans bxt_ddi_translations_hdmi[] = {
>  	{ 154, 0x9A, 1, 128, true },	/* 9:	1200		0   */
>  };
>  
> -static void ddi_get_encoder_port(struct intel_encoder *intel_encoder,
> +static bool ddi_get_encoder_port(struct intel_encoder *intel_encoder,
>  				 struct intel_digital_port **dig_port,
>  				 enum port *port)
>  {
> @@ -228,9 +228,10 @@ static void ddi_get_encoder_port(struct intel_encoder *intel_encoder,
>  		*dig_port = NULL;
>  		*port = PORT_E;
>  	} else {
> -		DRM_ERROR("Invalid DDI encoder type %d\n", type);
> -		BUG();
> +		return false;
>  	}
> +
> +	return true;
>  }
>  
>  enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
> @@ -238,7 +239,8 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
>  	struct intel_digital_port *dig_port;
>  	enum port port;
>  
> -	ddi_get_encoder_port(intel_encoder, &dig_port, &port);
> +	if (WARN_ON(!ddi_get_encoder_port(intel_encoder, &dig_port, &port)))
> +		return PORT_A;
>  
>  	return port;
>  }
> @@ -390,7 +392,8 @@ void intel_prepare_ddi(struct drm_device *dev)
>  		enum port port;
>  		bool supports_hdmi;
>  
> -		ddi_get_encoder_port(intel_encoder, &intel_dig_port, &port);
> +		if (!ddi_get_encoder_port(intel_encoder, &intel_dig_port, &port))
> +			continue;
>  
>  		if (visited[port])
>  			continue;
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter June 22, 2015, 2:45 p.m. UTC | #2
On Mon, Jun 22, 2015 at 02:34:14PM +0100, Damien Lespiau wrote:
> On Wed, Jun 17, 2015 at 04:12:49PM +0300, Imre Deak wrote:
> > BXT introduces DSI ports, for which we need to skip the DDI port setup.
> > Also there is no real reason for having a BUG for unknown port types so
> > convert it to a WARN.
> > 
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> 
> I think we could do with a better port abstraction as a whole, right now
> that's all a bit messy. But anyway:

I did ask for that for the bxt dsi enabling stuff. Punting on this one
until we have the complete picture there.
-Daniel

> 
> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
> 
> > ---
> >  drivers/gpu/drm/i915/intel_ddi.c | 13 ++++++++-----
> >  1 file changed, 8 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> > index 31b29e8..9ae297a 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -210,7 +210,7 @@ static const struct bxt_ddi_buf_trans bxt_ddi_translations_hdmi[] = {
> >  	{ 154, 0x9A, 1, 128, true },	/* 9:	1200		0   */
> >  };
> >  
> > -static void ddi_get_encoder_port(struct intel_encoder *intel_encoder,
> > +static bool ddi_get_encoder_port(struct intel_encoder *intel_encoder,
> >  				 struct intel_digital_port **dig_port,
> >  				 enum port *port)
> >  {
> > @@ -228,9 +228,10 @@ static void ddi_get_encoder_port(struct intel_encoder *intel_encoder,
> >  		*dig_port = NULL;
> >  		*port = PORT_E;
> >  	} else {
> > -		DRM_ERROR("Invalid DDI encoder type %d\n", type);
> > -		BUG();
> > +		return false;
> >  	}
> > +
> > +	return true;
> >  }
> >  
> >  enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
> > @@ -238,7 +239,8 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
> >  	struct intel_digital_port *dig_port;
> >  	enum port port;
> >  
> > -	ddi_get_encoder_port(intel_encoder, &dig_port, &port);
> > +	if (WARN_ON(!ddi_get_encoder_port(intel_encoder, &dig_port, &port)))
> > +		return PORT_A;
> >  
> >  	return port;
> >  }
> > @@ -390,7 +392,8 @@ void intel_prepare_ddi(struct drm_device *dev)
> >  		enum port port;
> >  		bool supports_hdmi;
> >  
> > -		ddi_get_encoder_port(intel_encoder, &intel_dig_port, &port);
> > +		if (!ddi_get_encoder_port(intel_encoder, &intel_dig_port, &port))
> > +			continue;
> >  
> >  		if (visited[port])
> >  			continue;
> > -- 
> > 2.1.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Shuang He June 29, 2015, 12:39 a.m. UTC | #3
Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 6586
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
ILK                                  303/303              303/303
SNB                                  312/312              312/312
IVB                                  343/343              343/343
BYT                                  284/284              284/284
HSW                                  380/380              380/380
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
Note: You need to pay more attention to line start with '*'

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 31b29e8..9ae297a 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -210,7 +210,7 @@  static const struct bxt_ddi_buf_trans bxt_ddi_translations_hdmi[] = {
 	{ 154, 0x9A, 1, 128, true },	/* 9:	1200		0   */
 };
 
-static void ddi_get_encoder_port(struct intel_encoder *intel_encoder,
+static bool ddi_get_encoder_port(struct intel_encoder *intel_encoder,
 				 struct intel_digital_port **dig_port,
 				 enum port *port)
 {
@@ -228,9 +228,10 @@  static void ddi_get_encoder_port(struct intel_encoder *intel_encoder,
 		*dig_port = NULL;
 		*port = PORT_E;
 	} else {
-		DRM_ERROR("Invalid DDI encoder type %d\n", type);
-		BUG();
+		return false;
 	}
+
+	return true;
 }
 
 enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
@@ -238,7 +239,8 @@  enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
 	struct intel_digital_port *dig_port;
 	enum port port;
 
-	ddi_get_encoder_port(intel_encoder, &dig_port, &port);
+	if (WARN_ON(!ddi_get_encoder_port(intel_encoder, &dig_port, &port)))
+		return PORT_A;
 
 	return port;
 }
@@ -390,7 +392,8 @@  void intel_prepare_ddi(struct drm_device *dev)
 		enum port port;
 		bool supports_hdmi;
 
-		ddi_get_encoder_port(intel_encoder, &intel_dig_port, &port);
+		if (!ddi_get_encoder_port(intel_encoder, &intel_dig_port, &port))
+			continue;
 
 		if (visited[port])
 			continue;