void vReadKSVFIFO(void)
{
	u8 bTemp, bIndex, bDevice_Count;	/* , bBlock; */
	u8 bStatus[2], bBstatus1;
	MT8193_HDCP_FUNC();
	fgDDCDataRead(RX_ID, RX_REG_BSTATUS1 + 1, 1, &bBstatus1);
	fgDDCDataRead(RX_ID, RX_REG_BSTATUS1, 1, &bDevice_Count);

	bDevice_Count &= DEVICE_COUNT_MASK;

	if ((bDevice_Count & MAX_DEVS_EXCEEDED) || (bBstatus1 & MAX_CASCADE_EXCEEDED)) {
		vSetHDCPState(HDCP_RE_DO_AUTHENTICATION);
		vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
		return;
	}

	if (bDevice_Count > 32) {
		for (bTemp = 0; bTemp < 2; bTemp++)	/* retry 1 times */
		{
			fgDDCDataRead(RX_ID, RX_REG_BSTATUS1, 1, &bDevice_Count);
			bDevice_Count &= DEVICE_COUNT_MASK;
			if (bDevice_Count <= 32)
				break;
		}
		if (bTemp == 2) {
			bDevice_Count = 32;
		}
	}

	vSetSharedInfo(SI_REPEATER_DEVICE_COUNT, bDevice_Count);

	if (bDevice_Count == 0) {
		for (bIndex = 0; bIndex < 5; bIndex++)
			bKsv_buff[bIndex] = 0;

		for (bIndex = 0; bIndex < 2; bIndex++)
			bStatus[bIndex] = 0;

		for (bIndex = 0; bIndex < 20; bIndex++)
			bSHABuff[bIndex] = 0;
	} else {
		fgDDCDataRead(RX_ID, RX_REG_KSV_FIFO, bDevice_Count * 5, bKsv_buff);
	}

	fgDDCDataRead(RX_ID, RX_REG_BSTATUS1, 2, bStatus);
	fgDDCDataRead(RX_ID, RX_REG_REPEATER_V, 20, bSHABuff);

	if ((bDevice_Count * 5) < KSV_BUFF_SIZE)
		vHalWriteKsvListPort(bKsv_buff, bDevice_Count, bStatus);
	vHalWriteHashPort(bSHABuff);
	vEnableHashHardwrae();
	vSetHDCPState(HDCP_COMPARE_V);
	/* set time-out value as 0.5 sec */
	vSetHDCPTimeOut(HDCP_WAIT_V_RDY_TIMEOUE);

}
예제 #2
0
void vDisableHDCP(u8 fgDisableHdcp)
{
  MT8193_HDCP_FUNC();
  
  if(fgDisableHdcp)
  {
    vHDCPReset();
	
    if(fgDisableHdcp==1)
	 vMoveHDCPInternalKey(EXTERNAL_KEY);
	else if(fgDisableHdcp==2)
     vMoveHDCPInternalKey(INTERNAL_NOENCRYPT_KEY);
	else if(fgDisableHdcp==3)
	 vMoveHDCPInternalKey(INTERNAL_ENCRYPT_KEY);	
	
	_bHdcpOff = 1;
  }  
  else
  {
  	vSetHDCPState(HDCP_RE_DO_AUTHENTICATION);
  	vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
	
	_bHdcpOff = 0;
  }		

  #ifdef MTK_MT8193_HDCP_SUPPORT
  _bHdcpOff = 0;
  #else
  _bHdcpOff = 1;
  #endif
}	
예제 #3
0
void vHDCPReset(void)
{
  u8 bMask; 
  MT8193_HDCP_FUNC();
  bMask = bReadHdmiIntMask();
  vWriteHdmiIntMask((bMask|0xfe));//disable INT HDCP
  
  vHalHDCPReset();
  vSetHDCPState(HDCP_RECEIVER_NOT_READY);
}	
void vHDCPReset(void)
{
	u8 bMask;
	MT8193_HDCP_FUNC();
	bMask = bReadHdmiIntMask();
	vWriteHdmiIntMask(0xff);	/* disable INT HDCP */

	vHalHDCPReset();
	vSetHDCPState(HDCP_RECEIVER_NOT_READY);
	vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
}
void vSendAKey(u8 *prAKey)
{
	u8 bData;
	u16 ui2Index;
	MT8193_HDCP_FUNC();
	for (ui2Index = 0; ui2Index < 280; ui2Index++) {
		/* get key from flash */
		if ((ui2Index == 5) && (bCheckPordHotPlug(PORD_MODE | HOTPLUG_MODE) == FALSE)) {
			vSetHDCPState(HDCP_RECEIVER_NOT_READY);
			return;
		}
		bData = *(prAKey + ui2Index);
		vHalSendAKey(bData);
	}
}
void HdcpService(HDCP_CTRL_STATE_T e_hdcp_state)
{
	u8 bIndx, bTemp;
	u8 bMask;

	MT8193_HDCP_FUNC();

	if (_bHdcpOff == 1) {
		vSetHDCPState(HDCP_RECEIVER_NOT_READY);
		vHDMIAVUnMute();
		vWriteHdmiIntMask(0xff);
	}

	switch (e_hdcp_state) {
	case HDCP_RECEIVER_NOT_READY:
		MT8193_HDCP_LOG("HDCP_RECEIVER_NOT_READY\n");
		break;

	case HDCP_READ_EDID:
		break;

	case HDCP_WAIT_RES_CHG_OK:
		MT8193_HDCP_LOG("HDCP_WAIT_RES_CHG_OK\n");
		_bReAUTHCount = 0;
		if (fgIsHDCPCtrlTimeOut()) {
			if (_bHdcpOff == 1)	/* disable HDCP */
			{
				vSetHDCPState(HDCP_RECEIVER_NOT_READY);
				vHDMIAVUnMute();
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			} else {
				vSetHDCPState(HDCP_RE_DO_AUTHENTICATION);
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			}
		}

		break;


	case HDCP_INIT_AUTHENTICATION:
		MT8193_HDCP_LOG("HDCP_INIT_AUTHENTICATION\n");

		_bReAUTHCount++;

		vHDMIAVMute();
		vSetSharedInfo(SI_HDMI_HDCP_RESULT, 0);

		if (!fgDDCDataRead(RX_ID, RX_REG_BCAPS, 1, &bTemp)) {
			vSetHDCPTimeOut(HDCP_WAIT_300MS_TIMEOUT);
			break;
		}

		vMiAnUpdateOrFix(TRUE);

		if (fgHostKey()) {
			for (bIndx = 0; bIndx < HDCP_AKSV_COUNT; bIndx++) {
				HDMI_AKSV[bIndx] = bHdcpKeyBuff[1 + bIndx];
			}

			if ((_bReAUTHCount > 2)
			    || ((HDMI_AKSV[0] == 0) && (HDMI_AKSV[1] == 0) && (HDMI_AKSV[2] == 0)
				&& (HDMI_AKSV[3] == 0))) {
				vSetHDCPState(HDCP_RECEIVER_NOT_READY);
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
				_bReAUTHCount = 0;
				return;
			}
		} else {
			vReadAksvFromReg(&HDMI_AKSV[0]);
		}

		if ((bhdcpkey == INTERNAL_ENCRYPT_KEY) || (bhdcpkey == EXTERNAL_KEY))
			vWriteAksvKeyMask(&HDMI_AKSV[0]);

		vEnableAuthHardware();
		fgDDCDataRead(RX_ID, RX_REG_BCAPS, 1, &bTemp);
		vSetSharedInfo(SI_REPEATER_DEVICE_COUNT, 0);
		if (bTemp & RX_BIT_ADDR_RPTR) {
			_fgRepeater = TRUE;
		} else {
			_fgRepeater = FALSE;
		}

		if (fgIsRepeater()) {
			vRepeaterOnOff(TRUE);
		} else {
			vRepeaterOnOff(FALSE);
		}

		vSendAn();

		vExchangeKSVs();

		if (fgHostKey()) {
			vSendAKey(&bHdcpKeyBuff[6]);	/* around 190msec */
			vSetHDCPTimeOut(HDCP_WAIT_R0_TIMEOUT);
		} else {
			vSetHDCPTimeOut(HDCP_WAIT_R0_TIMEOUT);	/* 100 ms */
		}

		/* change state as waiting R0 */
		vSetHDCPState(HDCP_WAIT_R0);
		break;


	case HDCP_WAIT_R0:
		MT8193_HDCP_LOG("HDCP_WAIT_R0\n");
		bTemp = bCheckHDCPStatus(HDCP_STA_RI_RDY);
		if (bTemp == TRUE) {
			vSetHDCPState(HDCP_COMPARE_R0);
		} else {
			vSetHDCPState(HDCP_RE_DO_AUTHENTICATION);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			break;
		}

	case HDCP_COMPARE_R0:
		MT8193_HDCP_LOG("HDCP_COMPARE_R0\n");
		if (fgCompareRi() == TRUE) {
			vMiAnUpdateOrFix(FALSE);

			vEnableEncrpt();	/* Enabe encrption */
			vSetCTL0BeZero(TRUE);

			/* change state as check repeater */
			vSetHDCPState(HDCP_CHECK_REPEATER);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			vSetSharedInfo(SI_HDMI_HDCP_RESULT, 0x01);	/* step 1 OK. */
		} else {
			vSetHDCPState(HDCP_RE_COMPARE_R0);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			_bReCompRiCount = 0;
		}
		break;

	case HDCP_RE_COMPARE_R0:
		MT8193_HDCP_LOG("HDCP_RE_COMPARE_R0\n");
		_bReCompRiCount++;
		if (fgIsHDCPCtrlTimeOut() && _bReCompRiCount > 3) {
			vSetHDCPState(HDCP_RE_DO_AUTHENTICATION);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			_bReCompRiCount = 0;
		} else {
			if (fgCompareRi() == TRUE) {
				vMiAnUpdateOrFix(FALSE);
				vEnableEncrpt();	/* Enabe encrption */
				vSetCTL0BeZero(TRUE);

				/* change state as check repeater */
				vSetHDCPState(HDCP_CHECK_REPEATER);
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
				vSetSharedInfo(SI_HDMI_HDCP_RESULT, 0x01);	/* step 1 OK. */
			} else {
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			}

		}
		break;

	case HDCP_CHECK_REPEATER:
		MT8193_HDCP_LOG("HDCP_CHECK_REPEATER\n");
		/* if the device is a Repeater, */
		if (fgIsRepeater()) {
			_bReCheckReadyBit = 0;
			vSetHDCPState(HDCP_WAIT_KSV_LIST);
			vSetHDCPTimeOut(HDCP_WAIT_KSV_LIST_TIMEOUT);
		} else {
			vSetHDCPState(HDCP_WAIT_RI);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
		}

		break;

	case HDCP_WAIT_KSV_LIST:
		MT8193_HDCP_LOG("HDCP_WAIT_KSV_LIST\n");
		fgDDCDataRead(RX_ID, RX_REG_BCAPS, 1, &bTemp);
		if ((bTemp & RX_BIT_ADDR_READY)) {
			_bReCheckReadyBit = 0;
			vSetHDCPState(HDCP_READ_KSV_LIST);
		} else if (_bReCheckReadyBit > HDCP_CHECK_KSV_LIST_RDY_RETRY_COUNT) {
			vSetHDCPState(HDCP_RE_DO_AUTHENTICATION);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			_bReCheckReadyBit = 0;
			break;
		} else {
			_bReCheckReadyBit++;
			vSetHDCPState(HDCP_WAIT_KSV_LIST);
			vSetHDCPTimeOut(HDCP_WAIT_KSV_LIST_RETRY_TIMEOUT);
			break;
		}

	case HDCP_READ_KSV_LIST:
		MT8193_HDCP_LOG("HDCP_READ_KSV_LIST\n");
		vReadKSVFIFO();
		break;

	case HDCP_COMPARE_V:
		MT8193_HDCP_LOG("HDCP_COMPARE_V\n");
		bTemp = bReadHDCPStatus();
		if ((bTemp & HDCP_STA_V_MATCH) || (bTemp & HDCP_STA_V_RDY)) {
			if ((bTemp & HDCP_STA_V_MATCH))	/* for Simplay #7-20-5 */
			{
				vSetHDCPState(HDCP_WAIT_RI);
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
				vSetSharedInfo(SI_HDMI_HDCP_RESULT, (i4SharedInfo(SI_HDMI_HDCP_RESULT) | 0x02));	/* step 2 OK. */
			} else {
				vSetHDCPState(HDCP_RE_DO_AUTHENTICATION);
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			}
		}
		break;

	case HDCP_WAIT_RI:
		MT8193_HDCP_LOG("HDCP_WAIT_RI\n");
		vHDMIAVUnMute();

		bMask = bReadHdmiIntMask();
		vWriteHdmiIntMask(0xfd);
		break;

	case HDCP_CHECK_LINK_INTEGRITY:
		MT8193_HDCP_LOG("HDCP_CHECK_LINK_INTEGRITY\n");
		if (fgCompareRi() == TRUE) {
			vSetSharedInfo(SI_HDMI_HDCP_RESULT, (i4SharedInfo(SI_HDMI_HDCP_RESULT) | 0x04));	/* step 3 OK. */
			if (fgIsRepeater()) {
				if (i4SharedInfo(SI_HDMI_HDCP_RESULT) == 0x07)	/* step 1, 2, 3. */
				{
					vSetSharedInfo(SI_HDMI_HDCP_RESULT, (i4SharedInfo(SI_HDMI_HDCP_RESULT) | 0x08));	/* all ok. */
				}
			} else	/* not repeater, don't need step 2. */
			{
				if (i4SharedInfo(SI_HDMI_HDCP_RESULT) == 0x05)	/* step 1, 3. */
				{
					vSetSharedInfo(SI_HDMI_HDCP_RESULT, (i4SharedInfo(SI_HDMI_HDCP_RESULT) | 0x08));	/* all ok. */
				}
			}
		} else {
			bMask = bReadHdmiIntMask();
			vWriteHdmiIntMask(0xff);	/* disable INT HDCP */
			_bReCompRiCount = 0;
			vSetHDCPState(HDCP_RE_COMPARE_RI);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
		}
		break;

	case HDCP_RE_COMPARE_RI:
		MT8193_HDCP_LOG("HDCP_RE_COMPARE_RI\n");
		_bReCompRiCount++;
		if (_bReCompRiCount > 5) {
			vSetHDCPState(HDCP_RE_DO_AUTHENTICATION);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			_bReCompRiCount = 0;
		} else {
			if (fgCompareRi() == TRUE) {
				_bReCompRiCount = 0;
				vSetHDCPState(HDCP_CHECK_LINK_INTEGRITY);
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
				vSetSharedInfo(SI_HDMI_HDCP_RESULT, (i4SharedInfo(SI_HDMI_HDCP_RESULT) | 0x04));	/* step 3 OK. */
				if (fgIsRepeater()) {
					if (i4SharedInfo(SI_HDMI_HDCP_RESULT) == 0x07)	/* step 1, 2, 3. */
					{
						vSetSharedInfo(SI_HDMI_HDCP_RESULT, (i4SharedInfo(SI_HDMI_HDCP_RESULT) | 0x08));	/* all ok. */
					}
				} else {
					if (i4SharedInfo(SI_HDMI_HDCP_RESULT) == 0x05)	/* step 1, 3. */
					{
						vSetSharedInfo(SI_HDMI_HDCP_RESULT, (i4SharedInfo(SI_HDMI_HDCP_RESULT) | 0x08));	/* all ok. */
					}
				}

				bMask = bReadHdmiIntMask();
				vWriteHdmiIntMask(0xfd);
			} else {
				vSetHDCPState(HDCP_RE_COMPARE_RI);
				vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
			}
		}
		break;

	case HDCP_RE_DO_AUTHENTICATION:
		MT8193_HDCP_LOG("HDCP_RE_DO_AUTHENTICATION\n");
		vHDMIAVMute();
		vHDCPReset();
		if (i4SharedInfo(SI_HDMI_RECEIVER_STATUS) != HDMI_PLUG_IN_AND_SINK_POWER_ON) {
			vSetHDCPState(HDCP_RECEIVER_NOT_READY);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
		} else {
			vSetHDCPState(HDCP_WAIT_RESET_OK);
			vSetHDCPTimeOut(HDCP_WAIT_RE_DO_AUTHENTICATION);
		}
		break;

	case HDCP_WAIT_RESET_OK:
		MT8193_HDCP_LOG("HDCP_WAIT_RESET_OK\n");
		if (fgIsHDCPCtrlTimeOut()) {
			vSetHDCPState(HDCP_INIT_AUTHENTICATION);
			vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
		}
		break;

	default:
		break;
	}
}
void vHDCPInitAuth(void)
{
	MT8193_HDCP_FUNC();
	vSetHDCPTimeOut(HDCP_WAIT_RES_CHG_OK_TIMEOUE);	/* 100 ms */
	vSetHDCPState(HDCP_WAIT_RES_CHG_OK);
}
예제 #8
0
void hdmi_timer_impl(void)
{
	if (mt8193_hdmiinit == 0) {
		mt8193_hdmiinit = 1;
		/* mt8193_power_off(); */
		vInitAvInfoVar();
		return;
	}

	if (mt8193_hotinit != 1)
		mt8193_hdmiinit++;

#if defined(CONFIG_HAS_EARLYSUSPEND)
	if (mt8193_hdmiearlysuspend == 1) {
#else
	{
#endif
		if (((mt8193_hdmiinit > 5) || (mt8193_hotinit == 0)) && (mt8193_hotinit != 1)) {
			if (bCheckPordHotPlug(PORD_MODE | HOTPLUG_MODE) == FALSE) {
				if ((mt8193_hotplugstate == HDMI_STATE_HOT_PLUGIN_AND_POWER_ON)
				    && (mt8193_hotinit == 2)) {
					vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_OUT);
					mt8193_hotplugstate = HDMI_STATE_HOT_PLUG_OUT;
					vPlugDetectService(HDMI_STATE_HOT_PLUG_OUT);
					MT8193_PLUG_LOG
					    ("[detectcable1] mt8193_hotinit = %d,mt8193_hdmiinit=%d\n",
					     mt8193_hotinit, mt8193_hdmiinit);
				}
#if 1
				if ((mt8193_hotinit == 0)
				    && (bCheckPordHotPlug(HOTPLUG_MODE) == TRUE)) {
					vSetSharedInfo(SI_HDMI_RECEIVER_STATUS,
						       HDMI_PLUG_IN_AND_SINK_POWER_ON);
					mt8193_hotinit = 2;
					mt8193_hotplugstate = HDMI_STATE_HOT_PLUGIN_AND_POWER_ON;
					vPlugDetectService(HDMI_STATE_HOT_PLUGIN_AND_POWER_ON);
					vWriteHdmiIntMask(0xff);	/* INT mask MDI */
					MT8193_PLUG_LOG
					    ("[detectcable2] mt8193_hotinit = %d,mt8193_hdmiinit=%d\n",
					     mt8193_hotinit, mt8193_hdmiinit);
				}
#endif
				if ((mt8193_hotinit == 0)
				    && (bCheckPordHotPlug(HOTPLUG_MODE) == FALSE)) {
					vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_OUT);
					mt8193_hotinit = 2;

					vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_OUT);
					mt8193_hotplugstate = HDMI_STATE_HOT_PLUG_OUT;
					vPlugDetectService(HDMI_STATE_HOT_PLUG_OUT);
					MT8193_PLUG_LOG
					    ("[detectcable1] mt8193_hotinit = %d,mt8193_hdmiinit=%d\n",
					     mt8193_hotinit, mt8193_hdmiinit);
				}

			} else if ((mt8193_hotplugstate == HDMI_STATE_HOT_PLUG_OUT)
				   && (bCheckPordHotPlug(PORD_MODE | HOTPLUG_MODE) == TRUE)) {
				vSetSharedInfo(SI_HDMI_RECEIVER_STATUS,
					       HDMI_PLUG_IN_AND_SINK_POWER_ON);
				mt8193_hotplugstate = HDMI_STATE_HOT_PLUGIN_AND_POWER_ON;
				mt8193_hotinit = 2;
				vPlugDetectService(HDMI_STATE_HOT_PLUGIN_AND_POWER_ON);
				vWriteHdmiIntMask(0xff);	/* INT mask MDI */
				MT8193_PLUG_LOG
				    ("[detectcable3] mt8193_hotinit = %d,mt8193_hdmiinit=%d\n",
				     mt8193_hotinit, mt8193_hdmiinit);
			} else if ((mt8193_hotplugstate == HDMI_STATE_HOT_PLUGIN_AND_POWER_ON)
				   && ((e_hdcp_ctrl_state == HDCP_WAIT_RI)
				       || (e_hdcp_ctrl_state == HDCP_CHECK_LINK_INTEGRITY))) {
				if (bCheckHDCPStatus(HDCP_STA_RI_RDY)) {
					vSetHDCPState(HDCP_CHECK_LINK_INTEGRITY);
					vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
				}
			}
			mt8193_hdmiinit = 1;
		}
	}

	if (mt8193_hdmiCmd == HDMI_PLUG_DETECT_CMD) {
		vClearHdmiCmd();
		/* vcheckhdmiplugstate(); */
		/* vPlugDetectService(e_hdmi_ctrl_state); */
	} else if (mt8193_hdmiCmd == HDMI_HDCP_PROTOCAL_CMD) {
		vClearHdmiCmd();
		HdcpService(e_hdcp_ctrl_state);
	}
}

void cec_timer_impl(void)
{
	if (mt8193_cecinit == 0) {
		mt8193_cecinit = 1;
		mt8193_cec_init();
		return;
	}

	if (mt8193_cec_on == 1)
		mt8193_cec_mainloop(mt8193_rxcecmode);

}

void mt8193_nlh_impl(void)
{
	unsigned int u4Data;
	unsigned char bData;
	unsigned char bMask;

	/*read register and then assert which interrupt occurred*/
	mt8193_i2c_read(0x1508, &u4Data);
	mt8193_i2c_write(0x1504, 0xffffffff);

	MT8193_DRV_LOG("0x1508 = 0x%08x\n", u4Data);

	if (u4Data & 0x20) {
		MT8193_CEC_LOG("cec interrupt\n");

		if (mt8193_cec_on == 1) {
			if (mt8193_cec_isrprocess(mt8193_rxcecmode))
				vNotifyAppHdmiState(HDMI_PLUG_IN_CEC);

		}
	}

	if (u4Data & 0x4) {
		bCheckHDCPStatus(0xfb);
		bData = bReadGRLInt();

		if (bData & INT_HDCP) {
			MT8193_HDCP_LOG("hdcp interrupt\n");
			bClearGRLInt(INT_HDCP);

		} else if (bData & INT_MDI) {
			MT8193_PLUG_LOG("hdmi interrupt\n");
			bClearGRLInt(INT_MDI);
			bMask = bReadHdmiIntMask();
			/* vWriteHdmiIntMask((0xfd));//INT mask MDI */
		}
	}
#ifdef CUST_EINT_EINT_HDMI_HPD_NUM
	mt65xx_eint_unmask(CUST_EINT_EINT_HDMI_HPD_NUM);
#endif
}
예제 #9
0
void hdmi_timer_impl(void)
{
  if(mt8193_hdmiinit==0)
  {
    mt8193_hdmiinit = 1;
	mt8193_power_off();
    vInitAvInfoVar();
	return;
  }

  if(mt8193_hotinit!=1)
  mt8193_hdmiinit++;
  
  #if defined(CONFIG_HAS_EARLYSUSPEND)
  if(mt8193_hdmiearlysuspend==1)
  #endif
  {
   if(((mt8193_hdmiinit>5)||(mt8193_hotinit==0))&&(mt8193_hotinit!=1))
   {
    if(bCheckPordHotPlug(PORD_MODE|HOTPLUG_MODE)==FALSE)
    {
      if((mt8193_hotplugstate == HDMI_STATE_HOT_PLUGIN_AND_POWER_ON)&&(mt8193_hotinit==2))
      {
	   vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_OUT);
       vPlugDetectService(HDMI_STATE_HOT_PLUG_OUT);
	   mt8193_hotplugstate = HDMI_STATE_HOT_PLUG_OUT;
	   MT8193_PLUG_LOG("[hotplug1] mt8193_hotinit = %d,mt8193_hdmiinit=%d\n", mt8193_hotinit, mt8193_hdmiinit);
      }

	  if((mt8193_hotinit==0)&&(bCheckPordHotPlug(HOTPLUG_MODE)==TRUE))
	  {
	   vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_IN_AND_SINK_POWER_ON);
	   vPlugDetectService(HDMI_STATE_HOT_PLUGIN_AND_POWER_ON);
	   mt8193_hotinit = 2;
	   mt8193_hotplugstate = HDMI_STATE_HOT_PLUGIN_AND_POWER_ON;
	   vWriteHdmiIntMask(0xff);//INT mask MDI
	   MT8193_PLUG_LOG("[hotplug2] mt8193_hotinit = %d,mt8193_hdmiinit=%d\n", mt8193_hotinit, mt8193_hdmiinit);
	  }
     
    }
    else if((mt8193_hotplugstate == HDMI_STATE_HOT_PLUG_OUT)&&(bCheckPordHotPlug(PORD_MODE|HOTPLUG_MODE)==TRUE))
    {
	   vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_IN_AND_SINK_POWER_ON);
       vPlugDetectService(HDMI_STATE_HOT_PLUGIN_AND_POWER_ON);
       mt8193_hotplugstate = HDMI_STATE_HOT_PLUGIN_AND_POWER_ON;
	   mt8193_hotinit = 2;
	   vWriteHdmiIntMask(0xff);//INT mask MDI
	   MT8193_PLUG_LOG("[hotplug3] mt8193_hotinit = %d,mt8193_hdmiinit=%d\n", mt8193_hotinit, mt8193_hdmiinit);
    }
	else if((mt8193_hotplugstate == HDMI_STATE_HOT_PLUGIN_AND_POWER_ON)&&((e_hdcp_ctrl_state==HDCP_WAIT_RI)||(e_hdcp_ctrl_state==HDCP_CHECK_LINK_INTEGRITY)))
    {
   	  if(bCheckHDCPStatus(HDCP_STA_RI_RDY))
   	  {
   		vSetHDCPState(HDCP_CHECK_LINK_INTEGRITY);
   		vSendHdmiCmd(HDMI_HDCP_PROTOCAL_CMD);
   	  }  
    } 
    mt8193_hdmiinit = 1;
   }
  }
  
  if(mt8193_hdmiCmd==HDMI_PLUG_DETECT_CMD)
  {
    vClearHdmiCmd();
	//vcheckhdmiplugstate();
    //vPlugDetectService(e_hdmi_ctrl_state);
  }
  else if(mt8193_hdmiCmd==HDMI_HDCP_PROTOCAL_CMD)
  {
    vClearHdmiCmd();
    HdcpService(e_hdcp_ctrl_state);
  }
}