Re: [PATCH v2 2/3] Subject: [PATCH] drm/mediatek/dp: Add HDCP2.x feature for DisplayPort

From: CK Hu (胡俊光)
Date: Thu Feb 22 2024 - 02:52:02 EST


Hi, Mac:

On Mon, 2024-02-05 at 13:50 +0800, mac.shen wrote:
> Add HDCP2.x feature for DisplayPort.
> When userspace request the kernel protect future content communicated
> over the link with Content_Protection property, the feature will do
> HDCP2.x authentication if the sink support HDCP2.X.
>
> Changes in v2:
> - remove switch case, and refine code to make more clear
> - remove some definitions, and use the definitions in
> include/drm/drm_hdcp.h
> - use the struct which defined in include/drm/drm_hdcp.h
> - do HDCP2.x authentication when userspace request the
> kernel protect future content communicated
> per suggestion from the previous thread:
> https://lore.kernel.org/all/8fff59b5567449d8201dd1138c8fa
> 9218a545c46.camel@xxxxxxxxxxxx/
>
> Signed-off-by: mac.shen <mac.shen@xxxxxxxxxxxx>
> ---

[snip]

> +
> +static void dp_tx_hdcp2_err_handle(struct mtk_hdcp_info *hdcp_info,
> int err_msg, int line)
> +{
> + pr_err("2.x: MainState:%d; SubState:%d;\n", hdcp_info-
> >hdcp2_info.hdcp_handler.main_state,
> + hdcp_info->hdcp2_info.hdcp_handler.sub_state);
> +
> + switch (err_msg) {
> + case HDCP_ERR_UNKNOWN_STATE:
> + pr_err("2.x: Unknown State, line:%d\n", line);
> + dp_tx_hdcp2_set_state(hdcp_info, HDCP2_MS_H1P1,
> HDCP_2_2_AUTH_FAIL);

For each case, you just print error message and set state. It seems not
necessary to group these cases. Where error happen, just print message
there and set state there. And not print line, you should print what
the error is.

Regards,
CK

> + break;
> +
> + case HDCP_ERR_SEND_MSG_FAIL:
> + pr_err("2.x: Send Msg Fail, line:%d\n", line);
> + dp_tx_hdcp2_set_state(hdcp_info, HDCP2_MS_A0F0,
> HDCP_2_2_NULL_MSG);
> + break;
> + case HDCP_ERR_RESPONSE_TIMEROUT:
> + pr_err("2.x: Response Timeout, line:%d!\n", line);
> + dp_tx_hdcp2_set_state(hdcp_info, HDCP2_MS_A0F0,
> HDCP_2_2_NULL_MSG);
> + break;
> +
> + case HDCP_ERR_PROCESS_FAIL:
> + pr_err("2.x: Process Fail, line:%d!\n", line);
> + dp_tx_hdcp2_set_state(hdcp_info, HDCP2_MS_A0F0,
> HDCP_2_2_NULL_MSG);
> + break;
> +
> + default:
> + pr_err("2.x: NO ERROR!");
> + break;
> + }
> +}