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

CK Hu (胡俊光) ck.hu at mediatek.com
Thu Nov 30 18:56:17 PST 2023


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 at mediatek.com>
> 

[snip]

> +
> +int mdrv_dp_tx_hdcp2_fsm(struct mtk_hdcp_info *hdcp_info)
> +{
> +	static u32 timeout_value;
> +	static u8 pre_main;
> +	static u8 pre_sub;
> +	static u32 pre_time;
> +	int err_code = HDCP_ERR_NONE;
> +	bool stored = false;
> +	u32 time;
> +	int ret = 0;
> +	bool tmp = false;
> +
> +	if (pre_main != hdcp_info->hdcp2_info.hdcp_handler.main_state
> ||
> +	    hdcp_info->hdcp2_info.hdcp_handler.sub_state != pre_sub) {
> +		DPTXHDCPMSG("Port(M : S)= (%d, %d)", hdcp_info-
> >hdcp2_info.hdcp_handler.main_state,
> +			    hdcp_info-
> >hdcp2_info.hdcp_handler.sub_state);
> +		pre_main = hdcp_info-
> >hdcp2_info.hdcp_handler.main_state;
> +		pre_sub = hdcp_info->hdcp2_info.hdcp_handler.sub_state;
> +	}
> +
> +	switch (hdcp_info->hdcp2_info.hdcp_handler.main_state) {
> +	case HDCP2_MS_H1P1:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_ZERO:
> +			break;
> +		case HDCP2_MSG_AUTH_FAIL:
> +			pr_err("HDCP2.x Authentication Fail\n");
> +			mdrv_dp_tx_hdcp2_enable_auth(hdcp_info, false);
> +			hdcp_info->auth_status = AUTH_FAIL;
> +			break;
> +		}
> +		break;
> +	case HDCP2_MS_A0F0:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_ZERO:
> +			if (hdcp_info->hdcp2_info.enable) {
> +				mdrv_dp_tx_hdcp2_init(hdcp_info);
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> +							   HDCP2_MSG_ZE
> RO);
> +				DPTXHDCPMSG("Sink Support Hdcp2x!\n");
> +			} else {
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_H1P1,
> +							   HDCP2_MSG_AU
> TH_FAIL);
> +				DPTXHDCPMSG("Sink Doesn't Support
> Hdcp2x!\n");
> +			}
> +			break;
> +		}
> +		break;
> +
> +	case HDCP2_MS_A1F1:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_ZERO:
> +			if (hdcp_info->hdcp2_info.retry_count
> +				< HDCP2_TX_RETRY_CNT) {
> +				hdcp_info->hdcp2_info.retry_count++;
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> +							   HDCP2_MSG_AK
> E_INIT);
> +			} else {
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_H1P1,
> +							   HDCP2_MSG_AU
> TH_FAIL);
> +				pr_err("Try Max Count\n");
> +			}
> +			break;
> +

I think you could get rid of switch case and add comment or label to
indicate the state like this:

/* HDCP2_MS_A1F1 */
/* HDCP2_MSG_ZERO */
if (hdcp_info->hdcp2_info.retry_count >= HDCP2_TX_RETRY_CNT)
    goto HDCP2_MSG_AUTH_FAIL:

hdcp_info->hdcp2_info.retry_count++;

/* HDCP2_MSG_AKE_INIT */


HDCP2_MSG_AUTH_FAIL:


The code looks more clear.

Regards,
CK


> +		case HDCP2_MSG_AKE_INIT:
> +			tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> HDCP2_MSG_AKE_INIT);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_SEND_MSG_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +			mdrv_dp_tx_hdcp2_rest_variable(hdcp_info);
> +			hdcp_info->hdcp2_info.read_certrx = true;
> +
> +			hdcp_info-
> >hdcp2_info.hdcp_handler.send_ake_init = true;
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> +						   HDCP2_MSG_AKE_SEND_C
> ERT);
> +			pre_time = get_system_time();
> +			break;
> +
> +		case HDCP2_MSG_AKE_SEND_CERT:
> +			time = get_time_diff(pre_time);
> +			if (time < HDCP2_AKESENDCERT_WDT) {
> +				msleep(20);
> +				break;
> +			}
> +			if (hdcp_info->hdcp2_info.read_certrx)
> +				mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> HDCP2_MSG_AKE_SEND_CERT);
> +
> +			if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> +				break;
> +
> +			ret = tee_ake_certificate(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_rx.cert,
> +						  &stored,
> +				hdcp_info-
> >hdcp2_info.stored_pairing_info.m,
> +				hdcp_info-
> >hdcp2_info.stored_pairing_info.ekh_km);
> +
> +			if (ret != RET_COMPARE_PASS) {
> +				err_code = HDCP_ERR_PROCESS_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			hdcp_info->hdcp2_info.hdcp_handler.stored_km =
> stored;
> +			hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> +						   hdcp_info-
> >hdcp2_info.hdcp_handler.stored_km ?
> +					HDCP2_MSG_AKE_STORED_KM :
> +					HDCP2_MSG_AKE_NO_STORED_KM);
> +			break;
> +
> +		case HDCP2_MSG_AKE_NO_STORED_KM:
> +			DPTXHDCPMSG("4. Get Km, derive Ekpub(km)\n");
> +
> +			tee_enc_rsaes_oaep(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_tx.ekpub_km);
> +			/* Prepare ekpub_km to send */
> +			tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> +							 HDCP2_MSG_AKE_
> NO_STORED_KM);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_SEND_MSG_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> +						   HDCP2_MSG_AKE_SEND_H
> _PRIME);
> +			timeout_value =
> HDCP2_AKESENDHPRIME_NO_STORED_WDT;
> +			hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> +			pre_time = get_system_time();
> +			break;
> +		case HDCP2_MSG_AKE_STORED_KM:
> +			/* Prepare ekh_km & M to send */
> +			tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> HDCP2_MSG_AKE_STORED_KM);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_SEND_MSG_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			err_code = HDCP_ERR_NONE;
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> +						   HDCP2_MSG_AKE_SEND_H
> _PRIME);
> +			timeout_value = HDCP2_AKESENDHPRIME_STORED_WDT;
> +			hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> +			pre_time = get_system_time();
> +			break;
> +
> +		case HDCP2_MSG_AKE_SEND_H_PRIME:
> +			if (hdcp_info->hdcp2_info.read_h_prime) {
> +				mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> +							  HDCP2_MSG_AKE
> _SEND_H_PRIME);
> +				}
> +			time = get_time_diff(pre_time);
> +			if (time > timeout_value) {
> +				err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> +				break;
> +
> +			ret = tee_ake_h_prime(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_tx.rtx,
> +					      hdcp_info-
> >hdcp2_info.hdcp_rx.rrx,
> +				hdcp_info->hdcp2_info.hdcp_rx.rx_caps,
> +				hdcp_info->hdcp2_info.hdcp_tx.tx_caps,
> +				hdcp_info->hdcp2_info.hdcp_rx.h_prime,
> +				HDCP2_HPRIME_SIZE);
> +			if (ret != RET_COMPARE_PASS) {
> +				if (hdcp_info-
> >hdcp2_info.hdcp_handler.stored_km)
> +					tee_clear_paring(hdcp_info);
> +				err_code = HDCP_ERR_PROCESS_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			if (hdcp_info-
> >hdcp2_info.hdcp_handler.stored_km)
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A2F2,
> +							   HDCP2_MSG_LC
> _INIT);
> +			else
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A1F1,
> +							   HDCP2_MSG_AK
> E_SEND_PAIRING_INFO);
> +
> +			pre_time = get_system_time();
> +			hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> +			break;
> +
> +		case HDCP2_MSG_AKE_SEND_PAIRING_INFO:
> +			if (hdcp_info->hdcp2_info.read_pairing)
> +				mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> +							  HDCP2_MSG_AKE
> _SEND_PAIRING_INFO);
> +
> +			/* Ekh_Km must be available less than 200ms,
> Give mode time for some Rx */
> +			time = get_time_diff(pre_time);
> +			if (time >	HDCP2_AKESENDPAIRINGINFO_WDT
> * 2) {
> +				err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> +				break;
> +
> +			/* Store m, km, Ekh(km) */
> +			tee_ake_paring(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_rx.ekh_km);
> +
> +			hdcp_info->hdcp2_info.hdcp_handler.send_pair =
> true;
> +			hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A2F2, HDCP2_MSG_LC_INIT);
> +			pre_time = get_system_time();
> +			break;
> +		}
> +		break;
> +
> +	case HDCP2_MS_A2F2:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_LC_INIT:
> +			/* prepare Rn to send */
> +			tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> HDCP2_MSG_LC_INIT);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_SEND_MSG_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +			hdcp_info->hdcp2_info.hdcp_handler.send_lc_init 
> = true;
> +
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A2F2,
> +						   HDCP2_MSG_LC_SEND_L_
> PRIME);
> +			pre_time = get_system_time();
> +			break;
> +
> +		case HDCP2_MSG_LC_SEND_L_PRIME:
> +			time = get_time_diff(pre_time);
> +			if (time < HDCP2_LCSENDLPRIME_WDT)
> +				break;
> +
> +			if (hdcp_info->hdcp2_info.read_l_prime)
> +				mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> +							  HDCP2_MSG_LC_
> SEND_L_PRIME);
> +
> +			if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> +				break;
> +
> +			ret = tee_lc_l_prime(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_tx.rn,
> +					     hdcp_info-
> >hdcp2_info.hdcp_rx.l_prime,
> +				HDCP2_LPRIME_SIZE);
> +			if (ret != RET_COMPARE_PASS) {
> +				err_code = HDCP_ERR_PROCESS_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			DPTXHDCPMSG("L' is PASS!!\n");
> +			hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A3F3, HDCP2_MSG_ZERO);
> +			pre_time = get_system_time();
> +			break;
> +		}
> +		break;
> +
> +	case HDCP2_MS_A3F3:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_ZERO:
> +			tee_ske_enc_ks(hdcp_info, hdcp_info-
> >hdcp2_info.hdcp_tx.riv,
> +				       hdcp_info-
> >hdcp2_info.hdcp_tx.eks);
> +
> +			tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> HDCP2_MSG_SKE_SEND_EKS);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_SEND_MSG_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A3F3,
> +						   HDCP2_MSG_SKE_SEND_E
> KS);
> +			pre_time = get_system_time();
> +			break;
> +
> +		case HDCP2_MSG_SKE_SEND_EKS:
> +			time = get_time_diff(pre_time);
> +			if (time >= HDCP2_ENC_EN_TIMER) {
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A4F4,
> +							   HDCP2_MSG_ZE
> RO);
> +			}
> +			break;
> +		}
> +		break;
> +
> +	case HDCP2_MS_A4F4:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_ZERO:
> +			if (!hdcp_info->hdcp2_info.repeater) {
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A5F5,
> +							   HDCP2_MSG_AU
> TH_DONE);
> +			} else {
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A6F6,
> +							   HDCP2_MSG_RE
> PAUTH_SEND_RECVID_LIST);
> +				hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg = false;
> +				pre_time = get_system_time();
> +			}
> +			break;
> +		}
> +		break;
> +
> +	case HDCP2_MS_A5F5:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_ZERO:
> +			break;
> +		case HDCP2_MSG_AUTH_DONE:
> +			DPTXHDCPMSG("HDCP2.x Authentication done.\n");
> +			hdcp_info->auth_status = AUTH_PASS;
> +			hdcp_info->hdcp2_info.retry_count = 0;
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A5F5, HDCP2_MSG_ZERO);
> +			mdrv_dp_tx_hdcp2_enable_auth(hdcp_info, true);
> +			break;
> +		}
> +		break;
> +	case HDCP2_MS_A6F6:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_REPAUTH_SEND_RECVID_LIST:
> +			if (hdcp_info->hdcp2_info.read_v_prime)
> +				mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> +							  HDCP2_MSG_REP
> AUTH_SEND_RECVID_LIST);
> +
> +			time = get_time_diff(pre_time);
> +			if (time > HDCP2_REPAUTHSENDRECVID_WDT) {
> +				err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg)
> +				break;
> +
> +			pre_time = get_system_time();
> +			hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A7F7,
> +						   HDCP2_MSG_REPAUTH_VE
> RIFY_RECVID_LIST);
> +			break;
> +		}
> +		break;
> +
> +	case HDCP2_MS_A7F7:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_REPAUTH_VERIFY_RECVID_LIST:
> +			if ((hdcp_info->hdcp2_info.hdcp_rx.rx_info[1] &
> (BIT(2) | BIT(3))) != 0) {
> +				pr_err("DEVS_EXCEEDED or
> CASCADE_EXCEDDED!\n");
> +				err_code = HDCP_ERR_PROCESS_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			/* check seqNumV here */
> +			tmp =
> mdrv_dp_tx_hdcp2_check_seq_num_v(hdcp_info);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_PROCESS_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			tmp =
> mdrv_dp_tx_hdcp2_recv_rep_auth_send_recv_id_list(hdcp_info);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_PROCESS_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A8F8,
> +						   HDCP2_MSG_REPAUTH_SE
> ND_ACK);
> +			break;
> +		}
> +		break;
> +
> +	case HDCP2_MS_A8F8:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_REPAUTH_SEND_ACK:
> +			tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> +							 HDCP2_MSG_REPA
> UTH_SEND_ACK);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_SEND_MSG_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			time = get_time_diff(pre_time);
> +			if (time > HDCP2_REP_SEND_ACK) {
> +				err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A9F9,
> +						   HDCP2_MSG_REPAUTH_ST
> REAM_MANAGE);
> +			hdcp_info->hdcp2_info.hdcp_handler.retry_cnt =
> 0;
> +			break;
> +		}
> +		break;
> +
> +	case HDCP2_MS_A9F9:
> +		switch (hdcp_info->hdcp2_info.hdcp_handler.sub_state) {
> +		case HDCP2_MSG_REPAUTH_STREAM_MANAGE:
> +			tmp =
> mdrv_dp_tx_hdcp2_process_rep_auth_stream_manage(hdcp_info);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_PROCESS_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			tmp = mdrv_dp_tx_hdcp2_write_msg(hdcp_info,
> +							 HDCP2_MSG_REPA
> UTH_STREAM_MANAGE);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_SEND_MSG_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			pre_time = get_system_time();
> +			hdcp_info->hdcp2_info.hdcp_handler.recv_msg =
> false;
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A9F9,
> +						   HDCP2_MSG_REPAUTH_ST
> REAM_READY);
> +			break;
> +		case HDCP2_MSG_REPAUTH_STREAM_READY:
> +			time = get_time_diff(pre_time);
> +			if (time > HDCP2_REPAUTHSTREAMRDY_WDT / 2)
> +				mdrv_dp_tx_hdcp2_read_msg(hdcp_info,
> +							  HDCP2_MSG_REP
> AUTH_STREAM_READY);
> +			else
> +				break;
> +
> +			time = get_time_diff(pre_time);
> +			if (time > HDCP2_REPAUTHSTREAMRDY_WDT) {
> +				err_code = HDCP_ERR_RESPONSE_TIMEROUT;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			} else if (!hdcp_info-
> >hdcp2_info.hdcp_handler.recv_msg) {
> +				if (hdcp_info-
> >hdcp2_info.hdcp_handler.retry_cnt
> +					>=
> HDCP2_STREAM_MANAGE_RETRY_CNT) {
> +					err_code =
> HDCP_ERR_RESPONSE_TIMEROUT;
> +					mdrv_dp_tx_hdcp2_err_handle(hdc
> p_info, err_code, __LINE__);
> +					break;
> +				}
> +
> +				hdcp_info-
> >hdcp2_info.hdcp_handler.retry_cnt++;
> +
> +				mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A9F9,
> +							   HDCP2_MSG_RE
> PAUTH_STREAM_READY);
> +				break;
> +			}
> +
> +			tmp =
> mdrv_dp_tx_hdcp2_recv_rep_auth_stream_ready(hdcp_info);
> +			if (!tmp) {
> +				err_code = HDCP_ERR_PROCESS_FAIL;
> +				mdrv_dp_tx_hdcp2_err_handle(hdcp_info,
> err_code, __LINE__);
> +				break;
> +			}
> +
> +			mdrv_dp_tx_hdcp2_set_state(hdcp_info,
> HDCP2_MS_A5F5,
> +						   HDCP2_MSG_AUTH_DONE)
> ;
> +			break;
> +		}
> +		break;
> +	default:
> +		err_code = HDCP_ERR_UNKNOWN_STATE;
> +		mdrv_dp_tx_hdcp2_err_handle(hdcp_info, err_code,
> __LINE__);
> +		break;
> +	}
> +
> +	return err_code;
> +}
> +


More information about the linux-arm-kernel mailing list