[Intel-gfx] [PATCH 15/15] drm/i915: Simplify intel_ddi_get_encoder_port()

Ville Syrjälä ville.syrjala at linux.intel.com
Thu Dec 10 06:19:32 PST 2015


On Thu, Dec 10, 2015 at 02:57:09PM +0100, Daniel Vetter wrote:
> On Tue, Dec 08, 2015 at 07:59:50PM +0200, ville.syrjala at linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > 
> > We no longer have any need to look up the intel_digital_port based
> > on the passed in intel_encoder, but we still want to look up the port.
> > Let's just move that logic into intel_ddi_get_encoder_port() and drop
> > the dig_port stuff.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> I wonder whether we shouldn't just add intel_encoder->port somewhere.

Maybe. We do have a port in sdvo now too, there's one in DSI, and I was
tempted to add it for DVO when doing the encoder->name stuff.

> 
> Anyway Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> 
> > ---
> >  drivers/gpu/drm/i915/intel_ddi.c | 34 +++++++---------------------------
> >  1 file changed, 7 insertions(+), 27 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> > index f4f5c52a116c..b4c3aad2d817 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -304,43 +304,23 @@ static const struct bxt_ddi_buf_trans bxt_ddi_translations_hdmi[] = {
> >  static void bxt_ddi_vswing_sequence(struct drm_i915_private *dev_priv,
> >  				    u32 level, enum port port, int type);
> >  
> > -static void ddi_get_encoder_port(struct intel_encoder *intel_encoder,
> > -				 struct intel_digital_port **dig_port,
> > -				 enum port *port)
> > +enum port intel_ddi_get_encoder_port(struct intel_encoder *encoder)
> >  {
> > -	struct drm_encoder *encoder = &intel_encoder->base;
> > -
> > -	switch (intel_encoder->type) {
> > +	switch (encoder->type) {
> >  	case INTEL_OUTPUT_DP_MST:
> > -		*dig_port = enc_to_mst(encoder)->primary;
> > -		*port = (*dig_port)->port;
> > -		break;
> > +		return enc_to_mst(&encoder->base)->primary->port;
> >  	case INTEL_OUTPUT_DISPLAYPORT:
> >  	case INTEL_OUTPUT_EDP:
> >  	case INTEL_OUTPUT_HDMI:
> > -		*dig_port = enc_to_dig_port(encoder);
> > -		*port = (*dig_port)->port;
> > -		break;
> > +		return enc_to_dig_port(&encoder->base)->port;
> >  	case INTEL_OUTPUT_ANALOG:
> > -		*dig_port = NULL;
> > -		*port = PORT_E;
> > -		break;
> > +		return PORT_E;
> >  	default:
> > -		WARN(1, "Invalid DDI encoder type %d\n", intel_encoder->type);
> > -		break;
> > +		MISSING_CASE(encoder->type);
> > +		return PORT_A;
> >  	}
> >  }
> >  
> > -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);
> > -
> > -	return port;
> > -}
> > -
> >  static const struct ddi_buf_trans *
> >  skl_get_buf_trans_dp(struct drm_i915_private *dev_priv, int *n_entries)
> >  {
> > -- 
> > 2.4.10
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel OTC


More information about the Intel-gfx mailing list