Re: [PATCH] drm/mediatek/dp: Add the HDCP feature for DisplayPort

From: CK Hu (胡俊光)
Date: Mon Jan 08 2024 - 01:00:48 EST


Hi, Mac:

On Fri, 2023-11-24 at 16:53 +0800, mac.shen wrote:
> Add tee client application, HDCP 1.x and 2.x authentication for
> DisplayPort
> to support the HDCP feature.
>
> Signed-off-by: mac.shen <mac.shen@xxxxxxxxxxxx>
> ---

[snip]

> +
> +bool mdrv_dp_tx_hdcp2_support(struct mtk_hdcp_info *hdcp_info)
> +{
> + u8 temp_buffer[3];
> + int ret;
> +
> + drm_dp_dpcd_read(hdcp_info->aux,
> DP_HDCP_2_2_REG_RX_CAPS_OFFSET, temp_buffer, 0x3);
> +
> + if ((temp_buffer[2] & BIT(1)) && temp_buffer[0] == 0x02) {

Use defined symbol instead of magic number. According to [1], this
could be:

if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL &&
HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2]))


[1]
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/i915/display/intel_dp_hdcp.c?h=next-20240108#n667

Regards,
CK

> + hdcp_info->hdcp2_info.enable = true;
> + hdcp_info->hdcp2_info.repeater = temp_buffer[2] &
> BIT(0);
> + } else {
> + hdcp_info->hdcp2_info.enable = false;
> + }
> +
> + DPTXHDCPMSG("HDCP.2x CAPABLE: %d, Reapeater: %d\n",
> + hdcp_info->hdcp2_info.enable,
> + hdcp_info->hdcp2_info.repeater);
> +
> + if (!hdcp_info->hdcp2_info.enable)
> + return false;
> +
> + ret = tee_add_device(hdcp_info, HDCP_VERSION_2X);
> + if (ret != RET_SUCCESS) {
> + pr_err("HDCP TA has some error\n");
> + hdcp_info->hdcp2_info.enable = false;
> + }
> +
> + return hdcp_info->hdcp2_info.enable;
> +}
> +