Re: [PATCH 30/43] drm/i915: Enable and Disable HDCP2.2 port encryption

Ramalingam C
2018-02-14T14:58:27Z

On Wednesday 14 February 2018 08:08 PM, Chris Wilson wrote:
> Quoting Ramalingam C (2018-02-14 14:13:45)
>> Implements the enable and disable functions for HDCP2.2 encryption
>> of the PORT.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>> drivers/gpu/drm/i915/intel_hdcp.c | 50 +++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 50 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
>> index 0cd637dd3f6b..6a0506cdefd5 100644
>> --- a/drivers/gpu/drm/i915/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
>> @@ -20,6 +20,7 @@
>> (enum physical_port) (port))
>> #define KEY_LOAD_TRIES 5
>> #define HDCP2_LC_RETRY_CNT 3
>> +#define TIME_FOR_ENCRYPT_STATUS_CHANGE 32
>>
>> static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
>> const struct intel_hdcp_shim *shim)
>> @@ -1336,3 +1337,52 @@ static int hdcp2_authenticate_sink(struct intel_hdcp *hdcp)
>>
>> return ret;
>> }
>> +
>> +static int hdcp2_enable_encryption(struct intel_hdcp *hdcp)
>> +{
>> + struct intel_digital_port *intel_dig_port =
>> + conn_to_dig_port(hdcp->connector);
>> + struct drm_i915_private *dev_priv = to_i915(hdcp->connector->base.dev);
>> + enum port port = hdcp->connector->encoder->port;
>> + int ret;
>> +
>> + if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_ENCRYPTION_STATUS)
>> + return 0;
>> +
>> + if (hdcp->hdcp2_shim->toggle_signalling)
>> + hdcp->hdcp2_shim->toggle_signalling(intel_dig_port, true);
>> +
>> + if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_AUTH_STATUS) {
>> +
>> + /* Link is Authenticated. Now set for Encryption */
>> + I915_WRITE(HDCP2_CTR_DDI(port),
>> + I915_READ(HDCP2_CTR_DDI(port)) |
>> + CTL_LINK_ENCRYPTION_REQ);
>> + }
>> +
>> + ret = wait_for(I915_READ(HDCP2_STATUS_DDI(port)) &
>> + LINK_ENCRYPTION_STATUS, TIME_FOR_ENCRYPT_STATUS_CHANGE);
> Both of these wait_for are intel_wait_for_register. As a rule of thumb
> avoid new (and definitely not repeated) use of wait_for().
> -Chris
I will change them into intel_wait_for_register.

Thanks
--Ram