[2/5] drm/i915: Nuke .post_pll_disable() for DDI platforms
diff mbox series

Message ID 20191213195217.15168-2-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>

HSW+ platforms call encoder .post_disable() and .post_pll_disable()
back to back. And since we don't even disable the PLL in between
let's just move everything into .post_disable().

intel_dp_mst does forward the .post_disable() call to intel_ddi at
the very end of its own .post_disable() hook, so this time MST
I shouldn't even break MST by accident.

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_ddi.c     | 29 +++++++-------------
 drivers/gpu/drm/i915/display/intel_display.c |  2 --
 drivers/gpu/drm/i915/display/intel_dp_mst.c  | 15 ----------
 3 files changed, 10 insertions(+), 36 deletions(-)

Comments

Souza, Jose Dec. 16, 2019, 8:42 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>
> 
> HSW+ platforms call encoder .post_disable() and .post_pll_disable()
> back to back. And since we don't even disable the PLL in between
> let's just move everything into .post_disable().
> 
> intel_dp_mst does forward the .post_disable() call to intel_ddi at
> the very end of its own .post_disable() hook, so this time MST
> I shouldn't even break MST by accident.

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

> 
> 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_ddi.c     | 29 +++++++-----------
> --
>  drivers/gpu/drm/i915/display/intel_display.c |  2 --
>  drivers/gpu/drm/i915/display/intel_dp_mst.c  | 15 ----------
>  3 files changed, 10 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 94f8bc4cd335..cac0be47e500 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3856,6 +3856,9 @@ static void intel_ddi_post_disable(struct
> intel_encoder *encoder,
>  				   const struct drm_connector_state
> *old_conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder-
> >base);
> +	enum phy phy = intel_port_to_phy(dev_priv, encoder->port);
> +	bool is_tc_port = intel_phy_is_tc(dev_priv, phy);
>  
>  	/*
>  	 * When called from DP MST code:
> @@ -3879,6 +3882,13 @@ static void intel_ddi_post_disable(struct
> intel_encoder *encoder,
>  
>  	if (INTEL_GEN(dev_priv) >= 11)
>  		icl_unmap_plls_to_ports(encoder);
> +
> +	if (intel_crtc_has_dp_encoder(old_crtc_state) || is_tc_port)
> +		intel_display_power_put_unchecked(dev_priv,
> +						  intel_ddi_main_link_a
> ux_domain(dig_port));
> +
> +	if (is_tc_port)
> +		intel_tc_port_put_link(dig_port);
>  }
>  
>  void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,
> @@ -4191,24 +4201,6 @@ intel_ddi_pre_pll_enable(struct intel_encoder
> *encoder,
>  						crtc_state-
> >lane_lat_optim_mask);
>  }
>  
> -static void
> -intel_ddi_post_pll_disable(struct intel_encoder *encoder,
> -			   const struct intel_crtc_state *crtc_state,
> -			   const struct drm_connector_state
> *conn_state)
> -{
> -	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> -	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder-
> >base);
> -	enum phy phy = intel_port_to_phy(dev_priv, encoder->port);
> -	bool is_tc_port = intel_phy_is_tc(dev_priv, phy);
> -
> -	if (intel_crtc_has_dp_encoder(crtc_state) || is_tc_port)
> -		intel_display_power_put_unchecked(dev_priv,
> -						  intel_ddi_main_link_a
> ux_domain(dig_port));
> -
> -	if (is_tc_port)
> -		intel_tc_port_put_link(dig_port);
> -}
> -
>  static void intel_ddi_prepare_link_retrain(struct intel_dp
> *intel_dp)
>  {
>  	struct intel_digital_port *intel_dig_port =
> dp_to_dig_port(intel_dp);
> @@ -4795,7 +4787,6 @@ void intel_ddi_init(struct drm_i915_private
> *dev_priv, enum port port)
>  	encoder->compute_config = intel_ddi_compute_config;
>  	encoder->enable = intel_enable_ddi;
>  	encoder->pre_pll_enable = intel_ddi_pre_pll_enable;
> -	encoder->post_pll_disable = intel_ddi_post_pll_disable;
>  	encoder->pre_enable = intel_ddi_pre_enable;
>  	encoder->disable = intel_disable_ddi;
>  	encoder->post_disable = intel_ddi_post_disable;
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 8aed67d2c105..4adcd751384e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -6767,8 +6767,6 @@ static void haswell_crtc_disable(struct
> intel_atomic_state *state,
>  		ironlake_pfit_disable(old_crtc_state);
>  
>  	intel_encoders_post_disable(state, crtc);
> -
> -	intel_encoders_post_pll_disable(state, crtc);
>  }
>  
>  static void i9xx_pfit_enable(const struct intel_crtc_state
> *crtc_state)
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 926e49f449a6..8bdbb15799ee 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -286,20 +286,6 @@ static void intel_mst_pre_pll_enable_dp(struct
> intel_encoder *encoder,
>  						    pipe_config, NULL);
>  }
>  
> -static void intel_mst_post_pll_disable_dp(struct intel_encoder
> *encoder,
> -					  const struct intel_crtc_state
> *old_crtc_state,
> -					  const struct
> drm_connector_state *old_conn_state)
> -{
> -	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder-
> >base);
> -	struct intel_digital_port *intel_dig_port = intel_mst->primary;
> -	struct intel_dp *intel_dp = &intel_dig_port->dp;
> -
> -	if (intel_dp->active_mst_links == 0)
> -		intel_dig_port->base.post_pll_disable(&intel_dig_port-
> >base,
> -						      old_crtc_state,
> -						      old_conn_state);
> -}
> -
>  static void intel_mst_pre_enable_dp(struct intel_encoder *encoder,
>  				    const struct intel_crtc_state
> *pipe_config,
>  				    const struct drm_connector_state
> *conn_state)
> @@ -656,7 +642,6 @@ intel_dp_create_fake_mst_encoder(struct
> intel_digital_port *intel_dig_port, enum
>  	intel_encoder->disable = intel_mst_disable_dp;
>  	intel_encoder->post_disable = intel_mst_post_disable_dp;
>  	intel_encoder->pre_pll_enable = intel_mst_pre_pll_enable_dp;
> -	intel_encoder->post_pll_disable =
> intel_mst_post_pll_disable_dp;
>  	intel_encoder->pre_enable = intel_mst_pre_enable_dp;
>  	intel_encoder->enable = intel_mst_enable_dp;
>  	intel_encoder->get_hw_state = intel_dp_mst_enc_get_hw_state;

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 94f8bc4cd335..cac0be47e500 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3856,6 +3856,9 @@  static void intel_ddi_post_disable(struct intel_encoder *encoder,
 				   const struct drm_connector_state *old_conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	enum phy phy = intel_port_to_phy(dev_priv, encoder->port);
+	bool is_tc_port = intel_phy_is_tc(dev_priv, phy);
 
 	/*
 	 * When called from DP MST code:
@@ -3879,6 +3882,13 @@  static void intel_ddi_post_disable(struct intel_encoder *encoder,
 
 	if (INTEL_GEN(dev_priv) >= 11)
 		icl_unmap_plls_to_ports(encoder);
+
+	if (intel_crtc_has_dp_encoder(old_crtc_state) || is_tc_port)
+		intel_display_power_put_unchecked(dev_priv,
+						  intel_ddi_main_link_aux_domain(dig_port));
+
+	if (is_tc_port)
+		intel_tc_port_put_link(dig_port);
 }
 
 void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,
@@ -4191,24 +4201,6 @@  intel_ddi_pre_pll_enable(struct intel_encoder *encoder,
 						crtc_state->lane_lat_optim_mask);
 }
 
-static void
-intel_ddi_post_pll_disable(struct intel_encoder *encoder,
-			   const struct intel_crtc_state *crtc_state,
-			   const struct drm_connector_state *conn_state)
-{
-	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
-	enum phy phy = intel_port_to_phy(dev_priv, encoder->port);
-	bool is_tc_port = intel_phy_is_tc(dev_priv, phy);
-
-	if (intel_crtc_has_dp_encoder(crtc_state) || is_tc_port)
-		intel_display_power_put_unchecked(dev_priv,
-						  intel_ddi_main_link_aux_domain(dig_port));
-
-	if (is_tc_port)
-		intel_tc_port_put_link(dig_port);
-}
-
 static void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp)
 {
 	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
@@ -4795,7 +4787,6 @@  void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	encoder->compute_config = intel_ddi_compute_config;
 	encoder->enable = intel_enable_ddi;
 	encoder->pre_pll_enable = intel_ddi_pre_pll_enable;
-	encoder->post_pll_disable = intel_ddi_post_pll_disable;
 	encoder->pre_enable = intel_ddi_pre_enable;
 	encoder->disable = intel_disable_ddi;
 	encoder->post_disable = intel_ddi_post_disable;
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 8aed67d2c105..4adcd751384e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -6767,8 +6767,6 @@  static void haswell_crtc_disable(struct intel_atomic_state *state,
 		ironlake_pfit_disable(old_crtc_state);
 
 	intel_encoders_post_disable(state, crtc);
-
-	intel_encoders_post_pll_disable(state, crtc);
 }
 
 static void i9xx_pfit_enable(const struct intel_crtc_state *crtc_state)
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 926e49f449a6..8bdbb15799ee 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -286,20 +286,6 @@  static void intel_mst_pre_pll_enable_dp(struct intel_encoder *encoder,
 						    pipe_config, NULL);
 }
 
-static void intel_mst_post_pll_disable_dp(struct intel_encoder *encoder,
-					  const struct intel_crtc_state *old_crtc_state,
-					  const struct drm_connector_state *old_conn_state)
-{
-	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
-	struct intel_digital_port *intel_dig_port = intel_mst->primary;
-	struct intel_dp *intel_dp = &intel_dig_port->dp;
-
-	if (intel_dp->active_mst_links == 0)
-		intel_dig_port->base.post_pll_disable(&intel_dig_port->base,
-						      old_crtc_state,
-						      old_conn_state);
-}
-
 static void intel_mst_pre_enable_dp(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *pipe_config,
 				    const struct drm_connector_state *conn_state)
@@ -656,7 +642,6 @@  intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum
 	intel_encoder->disable = intel_mst_disable_dp;
 	intel_encoder->post_disable = intel_mst_post_disable_dp;
 	intel_encoder->pre_pll_enable = intel_mst_pre_pll_enable_dp;
-	intel_encoder->post_pll_disable = intel_mst_post_pll_disable_dp;
 	intel_encoder->pre_enable = intel_mst_pre_enable_dp;
 	intel_encoder->enable = intel_mst_enable_dp;
 	intel_encoder->get_hw_state = intel_dp_mst_enc_get_hw_state;