[PATCH 6/6] drm/i915/hdcp: Read Rxcaps for robustibility

Nautiyal, Ankit K ankit.k.nautiyal at intel.com
Tue Jan 30 09:08:13 UTC 2024


On 1/27/2024 12:46 PM, Suraj Kandpal wrote:
> We see some monitors and docks report incorrect hdcp version
> and capability in first few reads so we read rx_caps three times
> before we conclude the monitor's or docks HDCP capability
>
> Signed-off-by: Suraj Kandpal <suraj.kandpal at intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 22 ++++++++++++--------
>   1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> index 5b724bd89329..f1b96bb3b727 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c
> @@ -640,7 +640,7 @@ int intel_dp_hdcp2_capable(struct intel_connector *connector,
>   	struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
>   	struct drm_dp_aux *aux;
>   	u8 rx_caps[3];
> -	int ret;
> +	int ret, i;
>   
>   	if (remote_req)
>   		aux = &connector->port->aux;
> @@ -648,15 +648,19 @@ int intel_dp_hdcp2_capable(struct intel_connector *connector,
>   		aux = &dig_port->dp.aux;
>   
>   	*capable = false;
> -	ret = drm_dp_dpcd_read(aux,
> -			       DP_HDCP_2_2_REG_RX_CAPS_OFFSET,
> -			       rx_caps, HDCP_2_2_RXCAPS_LEN);
> -	if (ret != HDCP_2_2_RXCAPS_LEN)
> -		return ret >= 0 ? -EIO : ret;
> +	for (i = 0; i < 3; i++) {

I think it would be good to document the rationale behind retrying 3 
times in comments too.

Otherwise LGTM.

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>


Regards,

Ankit



> +		ret = drm_dp_dpcd_read(aux,
> +				       DP_HDCP_2_2_REG_RX_CAPS_OFFSET,
> +				       rx_caps, HDCP_2_2_RXCAPS_LEN);
> +		if (ret != HDCP_2_2_RXCAPS_LEN)
> +			return ret >= 0 ? -EIO : ret;
>   
> -	if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
> -	    HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2]))
> -		*capable = true;
> +		if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
> +		    HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2])) {
> +			*capable = true;
> +			break;
> +		}
> +	}
>   
>   	return 0;
>   }


More information about the Intel-gfx mailing list