diff mbox series

[7/7] drm/i915/hti: convert to struct intel_display

Message ID 20240813164123.2674462-7-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/7] drm/i915/display: support struct intel_atomic_state in to_intel_display() | expand

Commit Message

Jani Nikula Aug. 13, 2024, 4:41 p.m. UTC
Going forward, struct intel_display shall replace struct
drm_i915_private as the main display device data pointer type. Convert
intel_hti.[ch] to struct intel_display.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +-
 .../drm/i915/display/intel_display_driver.c   |  2 +-
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c |  3 ++-
 drivers/gpu/drm/i915/display/intel_hti.c      | 20 +++++++++----------
 drivers/gpu/drm/i915/display/intel_hti.h      |  8 ++++----
 5 files changed, 18 insertions(+), 17 deletions(-)

Comments

Rodrigo Vivi Aug. 15, 2024, 7:16 p.m. UTC | #1
On Tue, Aug 13, 2024 at 07:41:23PM +0300, Jani Nikula wrote:
> Going forward, struct intel_display shall replace struct
> drm_i915_private as the main display device data pointer type. Convert
> intel_hti.[ch] to struct intel_display.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +-
>  .../drm/i915/display/intel_display_driver.c   |  2 +-
>  drivers/gpu/drm/i915/display/intel_dpll_mgr.c |  3 ++-
>  drivers/gpu/drm/i915/display/intel_hti.c      | 20 +++++++++----------
>  drivers/gpu/drm/i915/display/intel_hti.h      |  8 ++++----
>  5 files changed, 18 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 926cf3751593..25ff3ff0ab95 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4900,7 +4900,7 @@ void intel_ddi_init(struct intel_display *display,
>  	 * driver.  In that case we should skip initializing the corresponding
>  	 * outputs.
>  	 */
> -	if (intel_hti_uses_phy(dev_priv, phy)) {
> +	if (intel_hti_uses_phy(display, phy)) {
>  		drm_dbg_kms(&dev_priv->drm, "PORT %c / PHY %c reserved by HTI\n",
>  			    port_name(port), phy_name(phy));
>  		return;
> diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
> index 328d8b5a6b66..eced20d2ce6e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> @@ -453,7 +453,7 @@ int intel_display_driver_probe_nogem(struct drm_i915_private *i915)
>  	if (i915->display.cdclk.max_cdclk_freq == 0)
>  		intel_update_max_cdclk(i915);
>  
> -	intel_hti_init(i915);
> +	intel_hti_init(display);
>  
>  	/* Just disable it once at startup */
>  	intel_vga_disable(i915);
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> index 292d163036b1..f490b2157828 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
> @@ -3339,6 +3339,7 @@ static int icl_get_combo_phy_dpll(struct intel_atomic_state *state,
>  				  struct intel_crtc *crtc,
>  				  struct intel_encoder *encoder)
>  {
> +	struct intel_display *display = to_intel_display(crtc);
>  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>  	struct intel_crtc_state *crtc_state =
>  		intel_atomic_get_new_crtc_state(state, crtc);
> @@ -3379,7 +3380,7 @@ static int icl_get_combo_phy_dpll(struct intel_atomic_state *state,
>  	}
>  
>  	/* Eliminate DPLLs from consideration if reserved by HTI */
> -	dpll_mask &= ~intel_hti_dpll_mask(i915);
> +	dpll_mask &= ~intel_hti_dpll_mask(display);
>  
>  	port_dpll->pll = intel_find_shared_dpll(state, crtc,
>  						&port_dpll->hw_state,
> diff --git a/drivers/gpu/drm/i915/display/intel_hti.c b/drivers/gpu/drm/i915/display/intel_hti.c
> index a92d008d4e6e..19d1f196d9fb 100644
> --- a/drivers/gpu/drm/i915/display/intel_hti.c
> +++ b/drivers/gpu/drm/i915/display/intel_hti.c
> @@ -9,33 +9,33 @@
>  #include "intel_hti.h"
>  #include "intel_hti_regs.h"
>  
> -void intel_hti_init(struct drm_i915_private *i915)
> +void intel_hti_init(struct intel_display *display)
>  {
>  	/*
>  	 * If the platform has HTI, we need to find out whether it has reserved
>  	 * any display resources before we create our display outputs.
>  	 */
> -	if (DISPLAY_INFO(i915)->has_hti)
> -		i915->display.hti.state = intel_de_read(i915, HDPORT_STATE);
> +	if (DISPLAY_INFO(display)->has_hti)
> +		display->hti.state = intel_de_read(display, HDPORT_STATE);
>  }
>  
> -bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy)
> +bool intel_hti_uses_phy(struct intel_display *display, enum phy phy)
>  {
> -	if (drm_WARN_ON(&i915->drm, phy == PHY_NONE))
> +	if (drm_WARN_ON(display->drm, phy == PHY_NONE))
>  		return false;
>  
> -	return i915->display.hti.state & HDPORT_ENABLED &&
> -		i915->display.hti.state & HDPORT_DDI_USED(phy);
> +	return display->hti.state & HDPORT_ENABLED &&
> +		display->hti.state & HDPORT_DDI_USED(phy);
>  }
>  
> -u32 intel_hti_dpll_mask(struct drm_i915_private *i915)
> +u32 intel_hti_dpll_mask(struct intel_display *display)
>  {
> -	if (!(i915->display.hti.state & HDPORT_ENABLED))
> +	if (!(display->hti.state & HDPORT_ENABLED))
>  		return 0;
>  
>  	/*
>  	 * Note: This is subtle. The values must coincide with what's defined
>  	 * for the platform.
>  	 */
> -	return REG_FIELD_GET(HDPORT_DPLL_USED_MASK, i915->display.hti.state);
> +	return REG_FIELD_GET(HDPORT_DPLL_USED_MASK, display->hti.state);
>  }
> diff --git a/drivers/gpu/drm/i915/display/intel_hti.h b/drivers/gpu/drm/i915/display/intel_hti.h
> index 2893d6668657..b692571c5558 100644
> --- a/drivers/gpu/drm/i915/display/intel_hti.h
> +++ b/drivers/gpu/drm/i915/display/intel_hti.h
> @@ -8,11 +8,11 @@
>  
>  #include <linux/types.h>
>  
> -struct drm_i915_private;
> +struct intel_display;
>  enum phy;
>  
> -void intel_hti_init(struct drm_i915_private *i915);
> -bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy);
> -u32 intel_hti_dpll_mask(struct drm_i915_private *i915);
> +void intel_hti_init(struct intel_display *display);
> +bool intel_hti_uses_phy(struct intel_display *display, enum phy phy);
> +u32 intel_hti_dpll_mask(struct intel_display *display);
>  
>  #endif /* __INTEL_HTI_H__ */
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 926cf3751593..25ff3ff0ab95 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4900,7 +4900,7 @@  void intel_ddi_init(struct intel_display *display,
 	 * driver.  In that case we should skip initializing the corresponding
 	 * outputs.
 	 */
-	if (intel_hti_uses_phy(dev_priv, phy)) {
+	if (intel_hti_uses_phy(display, phy)) {
 		drm_dbg_kms(&dev_priv->drm, "PORT %c / PHY %c reserved by HTI\n",
 			    port_name(port), phy_name(phy));
 		return;
diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
index 328d8b5a6b66..eced20d2ce6e 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -453,7 +453,7 @@  int intel_display_driver_probe_nogem(struct drm_i915_private *i915)
 	if (i915->display.cdclk.max_cdclk_freq == 0)
 		intel_update_max_cdclk(i915);
 
-	intel_hti_init(i915);
+	intel_hti_init(display);
 
 	/* Just disable it once at startup */
 	intel_vga_disable(i915);
diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
index 292d163036b1..f490b2157828 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
@@ -3339,6 +3339,7 @@  static int icl_get_combo_phy_dpll(struct intel_atomic_state *state,
 				  struct intel_crtc *crtc,
 				  struct intel_encoder *encoder)
 {
+	struct intel_display *display = to_intel_display(crtc);
 	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
 	struct intel_crtc_state *crtc_state =
 		intel_atomic_get_new_crtc_state(state, crtc);
@@ -3379,7 +3380,7 @@  static int icl_get_combo_phy_dpll(struct intel_atomic_state *state,
 	}
 
 	/* Eliminate DPLLs from consideration if reserved by HTI */
-	dpll_mask &= ~intel_hti_dpll_mask(i915);
+	dpll_mask &= ~intel_hti_dpll_mask(display);
 
 	port_dpll->pll = intel_find_shared_dpll(state, crtc,
 						&port_dpll->hw_state,
diff --git a/drivers/gpu/drm/i915/display/intel_hti.c b/drivers/gpu/drm/i915/display/intel_hti.c
index a92d008d4e6e..19d1f196d9fb 100644
--- a/drivers/gpu/drm/i915/display/intel_hti.c
+++ b/drivers/gpu/drm/i915/display/intel_hti.c
@@ -9,33 +9,33 @@ 
 #include "intel_hti.h"
 #include "intel_hti_regs.h"
 
-void intel_hti_init(struct drm_i915_private *i915)
+void intel_hti_init(struct intel_display *display)
 {
 	/*
 	 * If the platform has HTI, we need to find out whether it has reserved
 	 * any display resources before we create our display outputs.
 	 */
-	if (DISPLAY_INFO(i915)->has_hti)
-		i915->display.hti.state = intel_de_read(i915, HDPORT_STATE);
+	if (DISPLAY_INFO(display)->has_hti)
+		display->hti.state = intel_de_read(display, HDPORT_STATE);
 }
 
-bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy)
+bool intel_hti_uses_phy(struct intel_display *display, enum phy phy)
 {
-	if (drm_WARN_ON(&i915->drm, phy == PHY_NONE))
+	if (drm_WARN_ON(display->drm, phy == PHY_NONE))
 		return false;
 
-	return i915->display.hti.state & HDPORT_ENABLED &&
-		i915->display.hti.state & HDPORT_DDI_USED(phy);
+	return display->hti.state & HDPORT_ENABLED &&
+		display->hti.state & HDPORT_DDI_USED(phy);
 }
 
-u32 intel_hti_dpll_mask(struct drm_i915_private *i915)
+u32 intel_hti_dpll_mask(struct intel_display *display)
 {
-	if (!(i915->display.hti.state & HDPORT_ENABLED))
+	if (!(display->hti.state & HDPORT_ENABLED))
 		return 0;
 
 	/*
 	 * Note: This is subtle. The values must coincide with what's defined
 	 * for the platform.
 	 */
-	return REG_FIELD_GET(HDPORT_DPLL_USED_MASK, i915->display.hti.state);
+	return REG_FIELD_GET(HDPORT_DPLL_USED_MASK, display->hti.state);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_hti.h b/drivers/gpu/drm/i915/display/intel_hti.h
index 2893d6668657..b692571c5558 100644
--- a/drivers/gpu/drm/i915/display/intel_hti.h
+++ b/drivers/gpu/drm/i915/display/intel_hti.h
@@ -8,11 +8,11 @@ 
 
 #include <linux/types.h>
 
-struct drm_i915_private;
+struct intel_display;
 enum phy;
 
-void intel_hti_init(struct drm_i915_private *i915);
-bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy);
-u32 intel_hti_dpll_mask(struct drm_i915_private *i915);
+void intel_hti_init(struct intel_display *display);
+bool intel_hti_uses_phy(struct intel_display *display, enum phy phy);
+u32 intel_hti_dpll_mask(struct intel_display *display);
 
 #endif /* __INTEL_HTI_H__ */