diff mbox series

[05/11] drm/i915: Change toggle_signalling() argument to connector

Message ID 20191203173638.94919-6-sean@poorly.run (mailing list archive)
State New, archived
Headers show
Series drm/i915: Add support for HDCP 1.4 over MST connectors | expand

Commit Message

Sean Paul Dec. 3, 2019, 5:36 p.m. UTC
From: Sean Paul <seanpaul@chromium.org>

HDCP over MST requires us to toggle ddi signalling. Since we'll want to
toggle signalling on the pipe associated with the fake encoder as
opposed to the digital port's base, we need to get it from connector.

This patch converts all existing callers and implementations to use
connector instead of digital port.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/i915/display/intel_display_types.h |  2 +-
 drivers/gpu/drm/i915/display/intel_dp.c            |  2 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c          | 10 ++++------
 drivers/gpu/drm/i915/display/intel_hdmi.c          |  8 ++++----
 4 files changed, 10 insertions(+), 12 deletions(-)

Comments

Ville Syrjälä Dec. 5, 2019, 7:48 p.m. UTC | #1
On Tue, Dec 03, 2019 at 12:36:28PM -0500, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> HDCP over MST requires us to toggle ddi signalling. Since we'll want to
> toggle signalling on the pipe associated with the fake encoder as
> opposed to the digital port's base, we need to get it from connector.

I think what you want is the cpu_transcoder, which we've already stuffed
into the hdcp thing when we enabled hdcp.

> 
> This patch converts all existing callers and implementations to use
> connector instead of digital port.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/i915/display/intel_display_types.h |  2 +-
>  drivers/gpu/drm/i915/display/intel_dp.c            |  2 +-
>  drivers/gpu/drm/i915/display/intel_hdcp.c          | 10 ++++------
>  drivers/gpu/drm/i915/display/intel_hdmi.c          |  8 ++++----
>  4 files changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 4341bd66a418..bbd44772b9b0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -300,7 +300,7 @@ struct intel_hdcp_shim {
>  				 int i, u32 *part);
>  
>  	/* Enables HDCP signalling on the port */
> -	int (*toggle_signalling)(struct intel_digital_port *intel_dig_port,
> +	int (*toggle_signalling)(struct intel_connector *connector,
>  				 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 7a407c651fb2..e26fb26b1909 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -6038,7 +6038,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,
> +int intel_dp_hdcp_toggle_signalling(struct intel_connector *connector,
>  				    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 8325bf9501e4..0966a8ec47d2 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(connector, true);
>  	if (ret)
>  		return ret;
>  
> @@ -787,7 +787,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector)
>  		return -ETIMEDOUT;
>  	}
>  
> -	ret = hdcp->shim->toggle_signalling(intel_dig_port, false);
> +	ret = hdcp->shim->toggle_signalling(connector, false);
>  	if (ret) {
>  		DRM_ERROR("Failed to disable HDCP signalling\n");
>  		return ret;
> @@ -1537,7 +1537,6 @@ static int hdcp2_authenticate_sink(struct intel_connector *connector)
>  
>  static int hdcp2_enable_encryption(struct intel_connector *connector)
>  {
> -	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
>  	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>  	struct intel_hdcp *hdcp = &connector->hdcp;
>  	enum port port = connector->encoder->port;
> @@ -1547,7 +1546,7 @@ 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(connector, true);
>  		if (ret) {
>  			DRM_ERROR("Failed to enable HDCP signalling. %d\n",
>  				  ret);
> @@ -1575,7 +1574,6 @@ static int hdcp2_enable_encryption(struct intel_connector *connector)
>  
>  static int hdcp2_disable_encryption(struct intel_connector *connector)
>  {
> -	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
>  	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>  	struct intel_hdcp *hdcp = &connector->hdcp;
>  	enum port port = connector->encoder->port;
> @@ -1598,7 +1596,7 @@ 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(connector, 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 f6f5312205c4..6a1e711c4f7a 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -1475,18 +1475,18 @@ 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,
> +int intel_hdmi_hdcp_toggle_signalling(struct intel_connector *connector,
>  				      bool enable)
>  {
> -	struct intel_hdmi *hdmi = &intel_dig_port->hdmi;
> -	struct intel_connector *connector = hdmi->attached_connector;
> +	struct intel_encoder *encoder =
> +				intel_attached_encoder(&connector->base);
>  	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>  	int ret;
>  
>  	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(encoder, enable);
>  	if (ret) {
>  		DRM_ERROR("%s HDCP signalling failed (%d)\n",
>  			  enable ? "Enable" : "Disable", ret);
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 4341bd66a418..bbd44772b9b0 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -300,7 +300,7 @@  struct intel_hdcp_shim {
 				 int i, u32 *part);
 
 	/* Enables HDCP signalling on the port */
-	int (*toggle_signalling)(struct intel_digital_port *intel_dig_port,
+	int (*toggle_signalling)(struct intel_connector *connector,
 				 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 7a407c651fb2..e26fb26b1909 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -6038,7 +6038,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,
+int intel_dp_hdcp_toggle_signalling(struct intel_connector *connector,
 				    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 8325bf9501e4..0966a8ec47d2 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(connector, true);
 	if (ret)
 		return ret;
 
@@ -787,7 +787,7 @@  static int _intel_hdcp_disable(struct intel_connector *connector)
 		return -ETIMEDOUT;
 	}
 
-	ret = hdcp->shim->toggle_signalling(intel_dig_port, false);
+	ret = hdcp->shim->toggle_signalling(connector, false);
 	if (ret) {
 		DRM_ERROR("Failed to disable HDCP signalling\n");
 		return ret;
@@ -1537,7 +1537,6 @@  static int hdcp2_authenticate_sink(struct intel_connector *connector)
 
 static int hdcp2_enable_encryption(struct intel_connector *connector)
 {
-	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	struct intel_hdcp *hdcp = &connector->hdcp;
 	enum port port = connector->encoder->port;
@@ -1547,7 +1546,7 @@  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(connector, true);
 		if (ret) {
 			DRM_ERROR("Failed to enable HDCP signalling. %d\n",
 				  ret);
@@ -1575,7 +1574,6 @@  static int hdcp2_enable_encryption(struct intel_connector *connector)
 
 static int hdcp2_disable_encryption(struct intel_connector *connector)
 {
-	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	struct intel_hdcp *hdcp = &connector->hdcp;
 	enum port port = connector->encoder->port;
@@ -1598,7 +1596,7 @@  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(connector, 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 f6f5312205c4..6a1e711c4f7a 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -1475,18 +1475,18 @@  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,
+int intel_hdmi_hdcp_toggle_signalling(struct intel_connector *connector,
 				      bool enable)
 {
-	struct intel_hdmi *hdmi = &intel_dig_port->hdmi;
-	struct intel_connector *connector = hdmi->attached_connector;
+	struct intel_encoder *encoder =
+				intel_attached_encoder(&connector->base);
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	int ret;
 
 	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(encoder, enable);
 	if (ret) {
 		DRM_ERROR("%s HDCP signalling failed (%d)\n",
 			  enable ? "Enable" : "Disable", ret);