Re: [PATCH v2 05/12] drm/i915: Use the cpu_transcoder in intel_hdcp to toggle HDCP signalling

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

 



On 2019-12-12 at 14:02:23 -0500, Sean Paul wrote:
> From: Sean Paul <seanpaul@xxxxxxxxxxxx>
> 
> Instead of using intel_dig_port's encoder pipe to determine which
> transcoder to toggle signalling on, use the cpu_transcoder field already
> stored in intel_hdmi.
you mean intel_hdcp

LGTM.

Reviewed-by: Ramalingam C <ramalingam.c@xxxxxxxxx>
> 
> This is particularly important for MST.
> 
> Suggested-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Signed-off-by: Sean Paul <seanpaul@xxxxxxxxxxxx>
> 
> Changes in v2:
> - Added to the set
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c         | 13 ++++---------
>  drivers/gpu/drm/i915/display/intel_ddi.h         |  2 ++
>  .../gpu/drm/i915/display/intel_display_types.h   |  1 +
>  drivers/gpu/drm/i915/display/intel_dp.c          |  1 +
>  drivers/gpu/drm/i915/display/intel_hdcp.c        | 11 +++++++----
>  drivers/gpu/drm/i915/display/intel_hdmi.c        | 16 +++++++++++-----
>  6 files changed, 26 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 4a5bdf3ef51d..bbdaa6d1deec 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -1971,12 +1971,12 @@ void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state
>  }
>  
>  int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
> +				     enum transcoder cpu_transcoder,
>  				     bool enable)
>  {
>  	struct drm_device *dev = intel_encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	intel_wakeref_t wakeref;
> -	enum pipe pipe = 0;
>  	int ret = 0;
>  	u32 tmp;
>  
> @@ -1985,18 +1985,13 @@ int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
>  	if (WARN_ON(!wakeref))
>  		return -ENXIO;
>  
> -	if (WARN_ON(!intel_encoder->get_hw_state(intel_encoder, &pipe))) {
> -		ret = -EIO;
> -		goto out;
> -	}
> -
> -	tmp = I915_READ(TRANS_DDI_FUNC_CTL(pipe));
> +	tmp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
>  	if (enable)
>  		tmp |= TRANS_DDI_HDCP_SIGNALLING;
>  	else
>  		tmp &= ~TRANS_DDI_HDCP_SIGNALLING;
> -	I915_WRITE(TRANS_DDI_FUNC_CTL(pipe), tmp);
> -out:
> +	I915_WRITE(TRANS_DDI_FUNC_CTL(cpu_transcoder), tmp);
> +
>  	intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref);
>  	return ret;
>  }
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.h b/drivers/gpu/drm/i915/display/intel_ddi.h
> index 19aeab1246ee..0644edaa7542 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.h
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.h
> @@ -18,6 +18,7 @@ struct intel_crtc_state;
>  struct intel_dp;
>  struct intel_dpll_hw_state;
>  struct intel_encoder;
> +enum transcoder;
>  
>  void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
>  				const struct intel_crtc_state *old_crtc_state,
> @@ -45,6 +46,7 @@ u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder);
>  u8 intel_ddi_dp_pre_emphasis_max(struct intel_encoder *encoder,
>  				 u8 voltage_swing);
>  int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder,
> +				     enum transcoder cpu_transcoder,
>  				     bool enable);
>  void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder);
>  int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 83ea04149b77..687768a913f6 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -301,6 +301,7 @@ struct intel_hdcp_shim {
>  
>  	/* Enables HDCP signalling on the port */
>  	int (*toggle_signalling)(struct intel_digital_port *intel_dig_port,
> +				 enum transcoder cpu_transcoder,
>  				 bool enable);
>  
>  	/* Ensures the link is still protected */
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 5576193b4fed..c1a228b5f879 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -6083,6 +6083,7 @@ int intel_dp_hdcp_read_v_prime_part(struct intel_digital_port *intel_dig_port,
>  
>  static
>  int intel_dp_hdcp_toggle_signalling(struct intel_digital_port *intel_dig_port,
> +				    enum transcoder cpu_transcoder,
>  				    bool enable)
>  {
>  	/* Not used for single stream DisplayPort setups */
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index c4394c8e10eb..f8d56d3b2ddb 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -693,7 +693,7 @@ static int intel_hdcp_auth(struct intel_connector *connector)
>  			   intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder,
>  						       port));
>  
> -	ret = shim->toggle_signalling(intel_dig_port, true);
> +	ret = shim->toggle_signalling(intel_dig_port, cpu_transcoder, true);
>  	if (ret)
>  		return ret;
>  
> @@ -792,7 +792,8 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
>  						   port);
>  	I915_WRITE(HDCP_REP_CTL, I915_READ(HDCP_REP_CTL) & ~repeater_ctl);
>  
> -	ret = hdcp->shim->toggle_signalling(intel_dig_port, false);
> +	ret = hdcp->shim->toggle_signalling(intel_dig_port, cpu_transcoder,
> +					    false);
>  	if (ret) {
>  		DRM_ERROR("Failed to disable HDCP signalling\n");
>  		return ret;
> @@ -1552,7 +1553,8 @@ static int hdcp2_enable_encryption(struct intel_connector *connector)
>  	WARN_ON(I915_READ(HDCP2_STATUS(dev_priv, cpu_transcoder, port)) &
>  		LINK_ENCRYPTION_STATUS);
>  	if (hdcp->shim->toggle_signalling) {
> -		ret = hdcp->shim->toggle_signalling(intel_dig_port, true);
> +		ret = hdcp->shim->toggle_signalling(intel_dig_port,
> +						    cpu_transcoder, true);
>  		if (ret) {
>  			DRM_ERROR("Failed to enable HDCP signalling. %d\n",
>  				  ret);
> @@ -1603,7 +1605,8 @@ static int hdcp2_disable_encryption(struct intel_connector *connector)
>  		DRM_DEBUG_KMS("Disable Encryption Timedout");
>  
>  	if (hdcp->shim->toggle_signalling) {
> -		ret = hdcp->shim->toggle_signalling(intel_dig_port, false);
> +		ret = hdcp->shim->toggle_signalling(intel_dig_port,
> +						    cpu_transcoder, false);
>  		if (ret) {
>  			DRM_ERROR("Failed to disable HDCP signalling. %d\n",
>  				  ret);
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index a89a09b25260..5066efadca85 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -1443,7 +1443,8 @@ int intel_hdmi_hdcp_read_v_prime_part(struct intel_digital_port *intel_dig_port,
>  	return ret;
>  }
>  
> -static int kbl_repositioning_enc_en_signal(struct intel_connector *connector)
> +static int kbl_repositioning_enc_en_signal(struct intel_connector *connector,
> +					   enum transcoder cpu_transcoder)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>  	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
> @@ -1460,12 +1461,14 @@ static int kbl_repositioning_enc_en_signal(struct intel_connector *connector)
>  		usleep_range(25, 50);
>  	}
>  
> -	ret = intel_ddi_toggle_hdcp_signalling(&intel_dig_port->base, false);
> +	ret = intel_ddi_toggle_hdcp_signalling(&intel_dig_port->base,
> +					       cpu_transcoder, false);
>  	if (ret) {
>  		DRM_ERROR("Disable HDCP signalling failed (%d)\n", ret);
>  		return ret;
>  	}
> -	ret = intel_ddi_toggle_hdcp_signalling(&intel_dig_port->base, true);
> +	ret = intel_ddi_toggle_hdcp_signalling(&intel_dig_port->base,
> +					       cpu_transcoder, true);
>  	if (ret) {
>  		DRM_ERROR("Enable HDCP signalling failed (%d)\n", ret);
>  		return ret;
> @@ -1476,6 +1479,7 @@ static int kbl_repositioning_enc_en_signal(struct intel_connector *connector)
>  
>  static
>  int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *intel_dig_port,
> +				      enum transcoder cpu_transcoder,
>  				      bool enable)
>  {
>  	struct intel_hdmi *hdmi = &intel_dig_port->hdmi;
> @@ -1486,7 +1490,8 @@ int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *intel_dig_port,
>  	if (!enable)
>  		usleep_range(6, 60); /* Bspec says >= 6us */
>  
> -	ret = intel_ddi_toggle_hdcp_signalling(&intel_dig_port->base, enable);
> +	ret = intel_ddi_toggle_hdcp_signalling(&intel_dig_port->base,
> +					       cpu_transcoder, enable);
>  	if (ret) {
>  		DRM_ERROR("%s HDCP signalling failed (%d)\n",
>  			  enable ? "Enable" : "Disable", ret);
> @@ -1498,7 +1503,8 @@ int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *intel_dig_port,
>  	 * opportunity and enc_en signalling in KABYLAKE.
>  	 */
>  	if (IS_KABYLAKE(dev_priv) && enable)
> -		return kbl_repositioning_enc_en_signal(connector);
> +		return kbl_repositioning_enc_en_signal(connector,
> +						       cpu_transcoder);
>  
>  	return 0;
>  }
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS
> 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux