diff mbox series

[10/21] drm/i915: split fdi link training from display vtable.

Message ID 20210908003944.2972024-11-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series i915/display: split and constify vtable | expand

Commit Message

Dave Airlie Sept. 8, 2021, 12:39 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

It may make sense to merge this with display again later,
however the fdi use of the vtable is limited to only a
few generations.
---
 drivers/gpu/drm/i915/display/intel_display.c |  2 +-
 drivers/gpu/drm/i915/display/intel_fdi.c     |  6 +++---
 drivers/gpu/drm/i915/i915_drv.h              | 11 ++++++++---
 3 files changed, 12 insertions(+), 7 deletions(-)

Comments

Jani Nikula Sept. 8, 2021, 10:02 a.m. UTC | #1
On Wed, 08 Sep 2021, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> It may make sense to merge this with display again later,
> however the fdi use of the vtable is limited to only a
> few generations.
> ---
>  drivers/gpu/drm/i915/display/intel_display.c |  2 +-
>  drivers/gpu/drm/i915/display/intel_fdi.c     |  6 +++---
>  drivers/gpu/drm/i915/i915_drv.h              | 11 ++++++++---
>  3 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index ccd0332e7945..b981a923cc2f 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2100,7 +2100,7 @@ static void ilk_pch_enable(const struct intel_atomic_state *state,
>  	assert_pch_transcoder_disabled(dev_priv, pipe);
>  
>  	/* For PCH output, training FDI link */
> -	dev_priv->display.fdi_link_train(crtc, crtc_state);
> +	dev_priv->fdi_funcs.fdi_link_train(crtc, crtc_state);

Nitpick, I'd add a wrapper intel_fdi_link_train to call this.

>  
>  	/* We need to program the right clock selection before writing the pixel
>  	 * mutliplier into the DPLL. */
> diff --git a/drivers/gpu/drm/i915/display/intel_fdi.c b/drivers/gpu/drm/i915/display/intel_fdi.c
> index fc09b781f15f..d9f952e0c67f 100644
> --- a/drivers/gpu/drm/i915/display/intel_fdi.c
> +++ b/drivers/gpu/drm/i915/display/intel_fdi.c
> @@ -1009,11 +1009,11 @@ void
>  intel_fdi_init_hook(struct drm_i915_private *dev_priv)
>  {
>  	if (IS_IRONLAKE(dev_priv)) {
> -		dev_priv->display.fdi_link_train = ilk_fdi_link_train;
> +		dev_priv->fdi_funcs.fdi_link_train = ilk_fdi_link_train;
>  	} else if (IS_SANDYBRIDGE(dev_priv)) {
> -		dev_priv->display.fdi_link_train = gen6_fdi_link_train;
> +		dev_priv->fdi_funcs.fdi_link_train = gen6_fdi_link_train;
>  	} 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;
> +		dev_priv->fdi_funcs.fdi_link_train = ivb_manual_fdi_link_train;
>  	}
>  }
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index ece23401cb46..49b23ea46475 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -388,6 +388,11 @@ struct drm_i915_irq_funcs {
>  	void (*hpd_irq_setup)(struct drm_i915_private *dev_priv);
>  };
>  
> +struct drm_i915_fdi_link_train_funcs {

Nitpick, intel_fdi_funcs.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> +	void (*fdi_link_train)(struct intel_crtc *crtc,
> +			       const struct intel_crtc_state *crtc_state);
> +};
> +
>  struct drm_i915_display_funcs {
>  	/* Returns the active state of the crtc, and if the crtc is active,
>  	 * fills out the pipe-config with the hw state. */
> @@ -403,9 +408,6 @@ struct drm_i915_display_funcs {
>  	void (*commit_modeset_enables)(struct intel_atomic_state *state);
>  	void (*commit_modeset_disables)(struct intel_atomic_state *state);
>  
> -	void (*fdi_link_train)(struct intel_crtc *crtc,
> -			       const struct intel_crtc_state *crtc_state);
> -
>  	/* clock updates for mode set */
>  	/* cursor updates */
>  	/* render clock increase/decrease */
> @@ -1000,6 +1002,9 @@ struct drm_i915_private {
>  	/* irq display functions */
>  	struct drm_i915_irq_funcs irq_funcs;
>  
> +	/* fdi display functions */
> +	struct drm_i915_fdi_link_train_funcs fdi_funcs;
> +
>  	/* Display functions */
>  	struct drm_i915_display_funcs display;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index ccd0332e7945..b981a923cc2f 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2100,7 +2100,7 @@  static void ilk_pch_enable(const struct intel_atomic_state *state,
 	assert_pch_transcoder_disabled(dev_priv, pipe);
 
 	/* For PCH output, training FDI link */
-	dev_priv->display.fdi_link_train(crtc, crtc_state);
+	dev_priv->fdi_funcs.fdi_link_train(crtc, crtc_state);
 
 	/* We need to program the right clock selection before writing the pixel
 	 * mutliplier into the DPLL. */
diff --git a/drivers/gpu/drm/i915/display/intel_fdi.c b/drivers/gpu/drm/i915/display/intel_fdi.c
index fc09b781f15f..d9f952e0c67f 100644
--- a/drivers/gpu/drm/i915/display/intel_fdi.c
+++ b/drivers/gpu/drm/i915/display/intel_fdi.c
@@ -1009,11 +1009,11 @@  void
 intel_fdi_init_hook(struct drm_i915_private *dev_priv)
 {
 	if (IS_IRONLAKE(dev_priv)) {
-		dev_priv->display.fdi_link_train = ilk_fdi_link_train;
+		dev_priv->fdi_funcs.fdi_link_train = ilk_fdi_link_train;
 	} else if (IS_SANDYBRIDGE(dev_priv)) {
-		dev_priv->display.fdi_link_train = gen6_fdi_link_train;
+		dev_priv->fdi_funcs.fdi_link_train = gen6_fdi_link_train;
 	} 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;
+		dev_priv->fdi_funcs.fdi_link_train = ivb_manual_fdi_link_train;
 	}
 }
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ece23401cb46..49b23ea46475 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -388,6 +388,11 @@  struct drm_i915_irq_funcs {
 	void (*hpd_irq_setup)(struct drm_i915_private *dev_priv);
 };
 
+struct drm_i915_fdi_link_train_funcs {
+	void (*fdi_link_train)(struct intel_crtc *crtc,
+			       const struct intel_crtc_state *crtc_state);
+};
+
 struct drm_i915_display_funcs {
 	/* Returns the active state of the crtc, and if the crtc is active,
 	 * fills out the pipe-config with the hw state. */
@@ -403,9 +408,6 @@  struct drm_i915_display_funcs {
 	void (*commit_modeset_enables)(struct intel_atomic_state *state);
 	void (*commit_modeset_disables)(struct intel_atomic_state *state);
 
-	void (*fdi_link_train)(struct intel_crtc *crtc,
-			       const struct intel_crtc_state *crtc_state);
-
 	/* clock updates for mode set */
 	/* cursor updates */
 	/* render clock increase/decrease */
@@ -1000,6 +1002,9 @@  struct drm_i915_private {
 	/* irq display functions */
 	struct drm_i915_irq_funcs irq_funcs;
 
+	/* fdi display functions */
+	struct drm_i915_fdi_link_train_funcs fdi_funcs;
+
 	/* Display functions */
 	struct drm_i915_display_funcs display;