Re: [PATCH 08/29] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
> From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>
> To clean up the mess in intel_ddi_post_disable() split it into two
> clean variants for HDMI and DP.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

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

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 69 +++++++++++++++++++++++-----------------
>  1 file changed, 40 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index bbb08c6f0bba..c38cbdc87545 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2261,47 +2261,58 @@ static void intel_disable_ddi_buf(struct intel_encoder *encoder)
>  		intel_wait_ddi_buf_idle(dev_priv, port);
>  }
>  
> -static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
> -				   const struct intel_crtc_state *old_crtc_state,
> -				   const struct drm_connector_state *old_conn_state)
> +static void intel_ddi_post_disable_dp(struct intel_encoder *encoder,
> +				      const struct intel_crtc_state *old_crtc_state,
> +				      const struct drm_connector_state *old_conn_state)
>  {
> -	struct drm_encoder *encoder = &intel_encoder->base;
> -	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
> -	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> -	int type = intel_encoder->type;
> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
> +	struct intel_dp *intel_dp = &dig_port->dp;
>  
> -	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
> +	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
>  
> -	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
> -		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> +	intel_disable_ddi_buf(encoder);
>  
> -		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
> -	}
> +	intel_edp_panel_vdd_on(intel_dp);
> +	intel_edp_panel_off(intel_dp);
>  
> -	intel_disable_ddi_buf(intel_encoder);
> +	intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
>  
> -	if (type == INTEL_OUTPUT_HDMI) {
> -		dig_port->set_infoframes(encoder, false,
> -					 old_crtc_state, old_conn_state);
> -	}
> +	intel_ddi_clk_disable(encoder);
> +}
>  
> -	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
> -		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> +static void intel_ddi_post_disable_hdmi(struct intel_encoder *encoder,
> +					const struct intel_crtc_state *old_crtc_state,
> +					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);
> +	struct intel_hdmi *intel_hdmi = &dig_port->hdmi;
>  
> -		intel_edp_panel_vdd_on(intel_dp);
> -		intel_edp_panel_off(intel_dp);
> -	}
> +	intel_disable_ddi_buf(encoder);
>  
> -	if (dig_port)
> -		intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
> +	dig_port->set_infoframes(&encoder->base, false,
> +				 old_crtc_state, old_conn_state);
>  
> -	intel_ddi_clk_disable(intel_encoder);
> +	intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
>  
> -	if (type == INTEL_OUTPUT_HDMI) {
> -		struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
> +	intel_ddi_clk_disable(encoder);
>  
> -		intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
> -	}
> +	intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
> +}
> +
> +static void intel_ddi_post_disable(struct intel_encoder *encoder,
> +				   const struct intel_crtc_state *old_crtc_state,
> +				   const struct drm_connector_state *old_conn_state)
> +{
> +	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
> +	if (old_crtc_state &&
> +	    intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
> +		intel_ddi_post_disable_hdmi(encoder,
> +					    old_crtc_state, old_conn_state);
> +	else
> +		intel_ddi_post_disable_dp(encoder,
> +					  old_crtc_state, old_conn_state);
>  }
>  
>  void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux