[1/5] drm/i915: Call hsw_fdi_link_train() directly()
diff mbox series

Message ID 20191213195217.15168-1-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/5] drm/i915: Call hsw_fdi_link_train() directly()
Related show

Commit Message

Ville Syrjala Dec. 13, 2019, 7:52 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Remove the pointless vfunc detour for hsw_fdi_link_train()
and just call it directly. Also pass the encoder in so we
can nuke the silly encoder loop within.

Cc: José Roberto de Souza <jose.souza@intel.com>
Cc: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_crt.c     |  2 +-
 drivers/gpu/drm/i915/display/intel_ddi.c     | 12 ++++--------
 drivers/gpu/drm/i915/display/intel_ddi.h     |  2 +-
 drivers/gpu/drm/i915/display/intel_display.c |  2 --
 4 files changed, 6 insertions(+), 12 deletions(-)

Comments

José Roberto de Souza Dec. 16, 2019, 8:37 p.m. UTC | #1
On Fri, 2019-12-13 at 21:52 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Remove the pointless vfunc detour for hsw_fdi_link_train()
> and just call it directly. Also pass the encoder in so we
> can nuke the silly encoder loop within.
> 
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_crt.c     |  2 +-
>  drivers/gpu/drm/i915/display/intel_ddi.c     | 12 ++++--------
>  drivers/gpu/drm/i915/display/intel_ddi.h     |  2 +-
>  drivers/gpu/drm/i915/display/intel_display.c |  2 --
>  4 files changed, 6 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_crt.c
> b/drivers/gpu/drm/i915/display/intel_crt.c
> index 7a2d36905155..50624b8f064d 100644
> --- a/drivers/gpu/drm/i915/display/intel_crt.c
> +++ b/drivers/gpu/drm/i915/display/intel_crt.c
> @@ -278,7 +278,7 @@ static void hsw_pre_enable_crt(struct
> intel_encoder *encoder,
>  
>  	intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
>  
> -	dev_priv->display.fdi_link_train(crtc, crtc_state);
> +	hsw_fdi_link_train(encoder, crtc_state);
>  
>  	intel_ddi_enable_pipe_clock(crtc_state);
>  }
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 5b6f32517c75..94f8bc4cd335 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -1107,18 +1107,14 @@ static u32 icl_pll_to_ddi_clk_sel(struct
> intel_encoder *encoder,
>   * DDI A (which is used for eDP)
>   */
>  
> -void hsw_fdi_link_train(struct intel_crtc *crtc,
> +void hsw_fdi_link_train(struct intel_encoder *encoder,
>  			const struct intel_crtc_state *crtc_state)
>  {
> -	struct drm_device *dev = crtc->base.dev;
> -	struct drm_i915_private *dev_priv = to_i915(dev);
> -	struct intel_encoder *encoder;
> +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> +	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>  	u32 temp, i, rx_ctl_val, ddi_pll_sel;
>  
> -	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
> -		WARN_ON(encoder->type != INTEL_OUTPUT_ANALOG);
> -		intel_prepare_dp_ddi_buffers(encoder, crtc_state);
> -	}
> +	intel_prepare_dp_ddi_buffers(encoder, crtc_state);
>  
>  	/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed
> at the
>  	 * mode set "sequence for CRT port" document:
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h
> b/drivers/gpu/drm/i915/display/intel_ddi.h
> index 19aeab1246ee..167c6579d972 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.h
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
> @@ -22,7 +22,7 @@ struct intel_encoder;
>  void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
>  				const struct intel_crtc_state
> *old_crtc_state,
>  				const struct drm_connector_state
> *old_conn_state);
> -void hsw_fdi_link_train(struct intel_crtc *crtc,
> +void hsw_fdi_link_train(struct intel_encoder *encoder,
>  			const struct intel_crtc_state *crtc_state);
>  void intel_ddi_init(struct drm_i915_private *dev_priv, enum port
> port);
>  bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe
> *pipe);
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 0f37f1d2026d..8aed67d2c105 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16673,8 +16673,6 @@ void intel_init_display_hooks(struct
> drm_i915_private *dev_priv)
>  	} else if (IS_IVYBRIDGE(dev_priv)) {
>  		/* FIXME: detect B0+ stepping and use auto training */
>  		dev_priv->display.fdi_link_train =
> ivb_manual_fdi_link_train;
> -	} else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
> -		dev_priv->display.fdi_link_train = hsw_fdi_link_train;

Just missing the chunk removing fdi_link_train from
drm_i915_display_funcs.

With that:

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

>  	}
>  
>  	if (INTEL_GEN(dev_priv) >= 9)
Ville Syrjala Dec. 16, 2019, 8:50 p.m. UTC | #2
On Mon, Dec 16, 2019 at 08:37:28PM +0000, Souza, Jose wrote:
> On Fri, 2019-12-13 at 21:52 +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Remove the pointless vfunc detour for hsw_fdi_link_train()
> > and just call it directly. Also pass the encoder in so we
> > can nuke the silly encoder loop within.
> > 
> > Cc: José Roberto de Souza <jose.souza@intel.com>
> > Cc: Manasi Navare <manasi.d.navare@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_crt.c     |  2 +-
> >  drivers/gpu/drm/i915/display/intel_ddi.c     | 12 ++++--------
> >  drivers/gpu/drm/i915/display/intel_ddi.h     |  2 +-
> >  drivers/gpu/drm/i915/display/intel_display.c |  2 --
> >  4 files changed, 6 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_crt.c
> > b/drivers/gpu/drm/i915/display/intel_crt.c
> > index 7a2d36905155..50624b8f064d 100644
> > --- a/drivers/gpu/drm/i915/display/intel_crt.c
> > +++ b/drivers/gpu/drm/i915/display/intel_crt.c
> > @@ -278,7 +278,7 @@ static void hsw_pre_enable_crt(struct
> > intel_encoder *encoder,
> >  
> >  	intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
> >  
> > -	dev_priv->display.fdi_link_train(crtc, crtc_state);
> > +	hsw_fdi_link_train(encoder, crtc_state);
> >  
> >  	intel_ddi_enable_pipe_clock(crtc_state);
> >  }
> > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> > b/drivers/gpu/drm/i915/display/intel_ddi.c
> > index 5b6f32517c75..94f8bc4cd335 100644
> > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > @@ -1107,18 +1107,14 @@ static u32 icl_pll_to_ddi_clk_sel(struct
> > intel_encoder *encoder,
> >   * DDI A (which is used for eDP)
> >   */
> >  
> > -void hsw_fdi_link_train(struct intel_crtc *crtc,
> > +void hsw_fdi_link_train(struct intel_encoder *encoder,
> >  			const struct intel_crtc_state *crtc_state)
> >  {
> > -	struct drm_device *dev = crtc->base.dev;
> > -	struct drm_i915_private *dev_priv = to_i915(dev);
> > -	struct intel_encoder *encoder;
> > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> > +	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> >  	u32 temp, i, rx_ctl_val, ddi_pll_sel;
> >  
> > -	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
> > -		WARN_ON(encoder->type != INTEL_OUTPUT_ANALOG);
> > -		intel_prepare_dp_ddi_buffers(encoder, crtc_state);
> > -	}
> > +	intel_prepare_dp_ddi_buffers(encoder, crtc_state);
> >  
> >  	/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed
> > at the
> >  	 * mode set "sequence for CRT port" document:
> > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h
> > b/drivers/gpu/drm/i915/display/intel_ddi.h
> > index 19aeab1246ee..167c6579d972 100644
> > --- a/drivers/gpu/drm/i915/display/intel_ddi.h
> > +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
> > @@ -22,7 +22,7 @@ struct intel_encoder;
> >  void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
> >  				const struct intel_crtc_state
> > *old_crtc_state,
> >  				const struct drm_connector_state
> > *old_conn_state);
> > -void hsw_fdi_link_train(struct intel_crtc *crtc,
> > +void hsw_fdi_link_train(struct intel_encoder *encoder,
> >  			const struct intel_crtc_state *crtc_state);
> >  void intel_ddi_init(struct drm_i915_private *dev_priv, enum port
> > port);
> >  bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe
> > *pipe);
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> > b/drivers/gpu/drm/i915/display/intel_display.c
> > index 0f37f1d2026d..8aed67d2c105 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -16673,8 +16673,6 @@ void intel_init_display_hooks(struct
> > drm_i915_private *dev_priv)
> >  	} else if (IS_IVYBRIDGE(dev_priv)) {
> >  		/* FIXME: detect B0+ stepping and use auto training */
> >  		dev_priv->display.fdi_link_train =
> > ivb_manual_fdi_link_train;
> > -	} else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
> > -		dev_priv->display.fdi_link_train = hsw_fdi_link_train;
> 
> Just missing the chunk removing fdi_link_train from
> drm_i915_display_funcs.

Still need it for pre-hsw.

> 
> With that:
> 
> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
> 
> >  	}
> >  
> >  	if (INTEL_GEN(dev_priv) >= 9)
José Roberto de Souza Dec. 16, 2019, 10:10 p.m. UTC | #3
On Mon, 2019-12-16 at 22:50 +0200, Ville Syrjälä wrote:
> On Mon, Dec 16, 2019 at 08:37:28PM +0000, Souza, Jose wrote:
> > On Fri, 2019-12-13 at 21:52 +0200, Ville Syrjala wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Remove the pointless vfunc detour for hsw_fdi_link_train()
> > > and just call it directly. Also pass the encoder in so we
> > > can nuke the silly encoder loop within.
> > > 
> > > Cc: José Roberto de Souza <jose.souza@intel.com>
> > > Cc: Manasi Navare <manasi.d.navare@intel.com>
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/display/intel_crt.c     |  2 +-
> > >  drivers/gpu/drm/i915/display/intel_ddi.c     | 12 ++++--------
> > >  drivers/gpu/drm/i915/display/intel_ddi.h     |  2 +-
> > >  drivers/gpu/drm/i915/display/intel_display.c |  2 --
> > >  4 files changed, 6 insertions(+), 12 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_crt.c
> > > b/drivers/gpu/drm/i915/display/intel_crt.c
> > > index 7a2d36905155..50624b8f064d 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_crt.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_crt.c
> > > @@ -278,7 +278,7 @@ static void hsw_pre_enable_crt(struct
> > > intel_encoder *encoder,
> > >  
> > >  	intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
> > >  
> > > -	dev_priv->display.fdi_link_train(crtc, crtc_state);
> > > +	hsw_fdi_link_train(encoder, crtc_state);
> > >  
> > >  	intel_ddi_enable_pipe_clock(crtc_state);
> > >  }
> > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> > > b/drivers/gpu/drm/i915/display/intel_ddi.c
> > > index 5b6f32517c75..94f8bc4cd335 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> > > @@ -1107,18 +1107,14 @@ static u32 icl_pll_to_ddi_clk_sel(struct
> > > intel_encoder *encoder,
> > >   * DDI A (which is used for eDP)
> > >   */
> > >  
> > > -void hsw_fdi_link_train(struct intel_crtc *crtc,
> > > +void hsw_fdi_link_train(struct intel_encoder *encoder,
> > >  			const struct intel_crtc_state *crtc_state)
> > >  {
> > > -	struct drm_device *dev = crtc->base.dev;
> > > -	struct drm_i915_private *dev_priv = to_i915(dev);
> > > -	struct intel_encoder *encoder;
> > > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> > > +	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> > >  	u32 temp, i, rx_ctl_val, ddi_pll_sel;
> > >  
> > > -	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
> > > -		WARN_ON(encoder->type != INTEL_OUTPUT_ANALOG);
> > > -		intel_prepare_dp_ddi_buffers(encoder, crtc_state);
> > > -	}
> > > +	intel_prepare_dp_ddi_buffers(encoder, crtc_state);
> > >  
> > >  	/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed
> > > at the
> > >  	 * mode set "sequence for CRT port" document:
> > > diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h
> > > b/drivers/gpu/drm/i915/display/intel_ddi.h
> > > index 19aeab1246ee..167c6579d972 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_ddi.h
> > > +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
> > > @@ -22,7 +22,7 @@ struct intel_encoder;
> > >  void intel_ddi_fdi_post_disable(struct intel_encoder
> > > *intel_encoder,
> > >  				const struct intel_crtc_state
> > > *old_crtc_state,
> > >  				const struct drm_connector_state
> > > *old_conn_state);
> > > -void hsw_fdi_link_train(struct intel_crtc *crtc,
> > > +void hsw_fdi_link_train(struct intel_encoder *encoder,
> > >  			const struct intel_crtc_state *crtc_state);
> > >  void intel_ddi_init(struct drm_i915_private *dev_priv, enum port
> > > port);
> > >  bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum
> > > pipe
> > > *pipe);
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> > > b/drivers/gpu/drm/i915/display/intel_display.c
> > > index 0f37f1d2026d..8aed67d2c105 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > @@ -16673,8 +16673,6 @@ void intel_init_display_hooks(struct
> > > drm_i915_private *dev_priv)
> > >  	} else if (IS_IVYBRIDGE(dev_priv)) {
> > >  		/* FIXME: detect B0+ stepping and use auto training */
> > >  		dev_priv->display.fdi_link_train =
> > > ivb_manual_fdi_link_train;
> > > -	} else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
> > > -		dev_priv->display.fdi_link_train = hsw_fdi_link_train;
> > 
> > Just missing the chunk removing fdi_link_train from
> > drm_i915_display_funcs.
> 
> Still need it for pre-hsw.

Damn, Eclipse search failed on me.
Indeed used by older platform.

> 
> > With that:
> > 
> > Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
> > 
> > >  	}
> > >  
> > >  	if (INTEL_GEN(dev_priv) >= 9)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_crt.c b/drivers/gpu/drm/i915/display/intel_crt.c
index 7a2d36905155..50624b8f064d 100644
--- a/drivers/gpu/drm/i915/display/intel_crt.c
+++ b/drivers/gpu/drm/i915/display/intel_crt.c
@@ -278,7 +278,7 @@  static void hsw_pre_enable_crt(struct intel_encoder *encoder,
 
 	intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
 
-	dev_priv->display.fdi_link_train(crtc, crtc_state);
+	hsw_fdi_link_train(encoder, crtc_state);
 
 	intel_ddi_enable_pipe_clock(crtc_state);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 5b6f32517c75..94f8bc4cd335 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -1107,18 +1107,14 @@  static u32 icl_pll_to_ddi_clk_sel(struct intel_encoder *encoder,
  * DDI A (which is used for eDP)
  */
 
-void hsw_fdi_link_train(struct intel_crtc *crtc,
+void hsw_fdi_link_train(struct intel_encoder *encoder,
 			const struct intel_crtc_state *crtc_state)
 {
-	struct drm_device *dev = crtc->base.dev;
-	struct drm_i915_private *dev_priv = to_i915(dev);
-	struct intel_encoder *encoder;
+	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	u32 temp, i, rx_ctl_val, ddi_pll_sel;
 
-	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
-		WARN_ON(encoder->type != INTEL_OUTPUT_ANALOG);
-		intel_prepare_dp_ddi_buffers(encoder, crtc_state);
-	}
+	intel_prepare_dp_ddi_buffers(encoder, crtc_state);
 
 	/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed at the
 	 * mode set "sequence for CRT port" document:
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h b/drivers/gpu/drm/i915/display/intel_ddi.h
index 19aeab1246ee..167c6579d972 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.h
+++ b/drivers/gpu/drm/i915/display/intel_ddi.h
@@ -22,7 +22,7 @@  struct intel_encoder;
 void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
 				const struct intel_crtc_state *old_crtc_state,
 				const struct drm_connector_state *old_conn_state);
-void hsw_fdi_link_train(struct intel_crtc *crtc,
+void hsw_fdi_link_train(struct intel_encoder *encoder,
 			const struct intel_crtc_state *crtc_state);
 void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port);
 bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe);
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 0f37f1d2026d..8aed67d2c105 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16673,8 +16673,6 @@  void intel_init_display_hooks(struct drm_i915_private *dev_priv)
 	} else if (IS_IVYBRIDGE(dev_priv)) {
 		/* FIXME: detect B0+ stepping and use auto training */
 		dev_priv->display.fdi_link_train = ivb_manual_fdi_link_train;
-	} else if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
-		dev_priv->display.fdi_link_train = hsw_fdi_link_train;
 	}
 
 	if (INTEL_GEN(dev_priv) >= 9)