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 }
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); } }