Esempio n. 1
0
static void vNotifyAppHdmiState(u8 u1hdmistate)
{
  HDMI_EDID_INFO_T get_info;
  
  MT8193_PLUG_LOG("u1hdmistate = %d\n", u1hdmistate);

  mt8193_AppGetEdidInfo(&get_info);
  
  switch(u1hdmistate)
  {
    case HDMI_PLUG_OUT:
     hdmi_util.state_callback(HDMI_STATE_NO_DEVICE);
	 mt8193_SetPhysicCECAddress(0xffff, 0x0); 
    break;

    case HDMI_PLUG_IN_AND_SINK_POWER_ON:
     hdmi_util.state_callback(HDMI_STATE_ACTIVE);
	 mt8193_SetPhysicCECAddress(get_info.ui2_sink_cec_address, 0x4); 
    break;

    case HDMI_PLUG_IN_ONLY:
     hdmi_util.state_callback(HDMI_STATE_PLUGIN_ONLY);
	 mt8193_SetPhysicCECAddress(get_info.ui2_sink_cec_address, 0xf); 
    break;

    case HDMI_PLUG_IN_CEC:
     hdmi_util.state_callback(HDMI_STATE_CEC_UPDATE);
    break;
       
    default:
    break;

  }
}
Esempio n. 2
0
void vcheckhdmiplugstate(void)
{
   u32 bMask;
   MT8193_PLUG_FUNC();

   bMask = bReadHdmiIntMask();
   vWriteHdmiIntMask((bMask&0xfe));
   if(bCheckPordHotPlug(PORD_MODE|HOTPLUG_MODE)==FALSE)
   {

      {
        if((i4SharedInfo(SI_HDMI_RECEIVER_STATUS)== HDMI_PLUG_IN_AND_SINK_POWER_ON)||(i4SharedInfo(SI_HDMI_RECEIVER_STATUS)== HDMI_PLUG_IN_ONLY))
        { 	
          bMask = bReadHdmiIntMask();
          vWriteHdmiIntMask((bMask|0xfE));
          
          vHDCPReset();
          vTxSignalOnOff(0);
          
          vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_OUT);
          vSetHDMICtrlState(HDMI_STATE_HOT_PLUG_OUT);
        }
        else
        {
          MT8193_PLUG_LOG("plug out, no action\n");
        }
      }
   } 
   else
   {
     if((i4SharedInfo(SI_HDMI_RECEIVER_STATUS)== HDMI_PLUG_OUT)||(i4SharedInfo(SI_HDMI_RECEIVER_STATUS)== HDMI_PLUG_IN_ONLY)) 
     {	
       vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_IN_AND_SINK_POWER_ON);
       vSetHDMICtrlState(HDMI_STATE_HOT_PLUGIN_AND_POWER_ON);
     }
     else
     {
       MT8193_PLUG_LOG("plug in ok, no action\n");
     }
   }
}
Esempio n. 3
0
void mt8193_nlh_impl(void)
{
    u32 u4Data;
    u8 bData, bData1;
	u8 bMask;
	
    //read register and then assert which interrupt occured
    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
	 }
    }
	mt65xx_eint_unmask(CUST_EINT_EINT_HDMI_HPD_NUM);
}
Esempio n. 4
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
}
Esempio n. 5
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);
  }
}