int mt8193_power_on(void) { MT8193_DRV_FUNC(); #if defined(CONFIG_HAS_EARLYSUSPEND) if(mt8193_hdmiearlysuspend==0) return 0; #endif mt8193_hotinit = 0; mt_set_gpio_mode(GPIO_HDMI_POWER_CONTROL, GPIO_MODE_00); mt_set_gpio_dir(GPIO_HDMI_POWER_CONTROL, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_HDMI_POWER_CONTROL, GPIO_OUT_ONE); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_power_turnon, hdmi_power_turnon); vWriteHdmiSYSMsk(HDMI_SYS_PWR_RST_B, hdmi_pwr_sys_sw_unreset, hdmi_pwr_sys_sw_unreset); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_iso_dis, hdmi_iso_en); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_clock_on, hdmi_clock_off); vWriteHdmiSYSMsk(HDMI_SYS_CFG1C, ANLG_ON|HDMI_ON, ANLG_ON|HDMI_ON); mt8193_i2c_write(0x1500, 0x20); vHotPlugPinInit(); vInitHdcpKeyGetMethod(NON_HOST_ACCESS_FROM_EEPROM); vWriteHdmiIntMask(0xFF); return 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 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"); } } }
void vHDMIResetGenReg(u8 ui1resindex, u8 ui1colorspace) { MT8193_DRV_FUNC(); vResetHDMI(1); vHDMIVideoOutput(ui1resindex, ui1colorspace); vResetHDMI(0); vEnableNotice(TRUE); vWriteHdmiIntMask(0xfe); vSetHDMIDataEnable(ui1resindex); vSetHDMISyncDelay(ui1resindex); vEnableHdmiMode(TRUE); vEnableNCTSAutoWrite(); vHDMISettingColorSpace(ui1colorspace); }
int mt8193_power_on(void) { struct device_node *dn; int bus_switch_pin; HDMI_DEF_LOG("[hdmi]mt8193_power_on_\n"); if (hdmi_powerenable == 1) { HDMI_DEF_LOG("[hdmi]already power on, return\n"); return 0; } hdmi_powerenable = 1; #if defined(CONFIG_HAS_EARLYSUSPEND) if (mt8193_hdmiearlysuspend == 0) return 0; #endif mt8193_hotinit = 0; mt8193_hotplugstate = HDMI_STATE_HOT_PLUG_OUT; is_hdmi_plug_out_flag = 0; #ifdef GPIO_HDMI_POWER_CONTROL mt_set_gpio_mode(GPIO_HDMI_POWER_CONTROL, GPIO_MODE_00); mt_set_gpio_dir(GPIO_HDMI_POWER_CONTROL, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_HDMI_POWER_CONTROL, GPIO_OUT_ONE); HDMI_DEF_LOG("[hdmi]hdmi_5v_on\n"); #endif dn = of_find_compatible_node(NULL, NULL, "mediatek,mt8193-hdmi"); bus_switch_pin = of_get_named_gpio(dn, "hdmi_power_gpios", 0); gpio_direction_output(bus_switch_pin, 1); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_power_turnon, hdmi_power_turnon); vWriteHdmiSYSMsk(HDMI_SYS_PWR_RST_B, hdmi_pwr_sys_sw_unreset, hdmi_pwr_sys_sw_unreset); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_iso_dis, hdmi_iso_en); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_clock_on, hdmi_clock_off); vWriteHdmiSYSMsk(HDMI_SYS_CFG1C, ANLG_ON | HDMI_ON, ANLG_ON | HDMI_ON); mt8193_i2c_write(0x1500, 0x20); vHotPlugPinInit(); vInitHdcpKeyGetMethod(NON_HOST_ACCESS_FROM_EEPROM); vWriteHdmiIntMask(0xFF); mod_timer(&r_hdmi_timer, jiffies + gHDMI_CHK_INTERVAL / (1000 / HZ)); mod_timer(&r_cec_timer, jiffies + gCEC_CHK_INTERVAL / (1000 / HZ)); return 0; }
void vHDMIResetGenReg(u8 ui1resindex, u8 ui1colorspace) { MT8193_DRV_FUNC(); vResetHDMI(1); vHDMIVideoOutput(ui1resindex, ui1colorspace); vResetHDMI(0); vEnableNotice(TRUE); vWriteHdmiIntMask(0xff); vSetHDMIDataEnable(ui1resindex); vSetHDMISyncDelay(ui1resindex); if (i4SharedInfo(SI_EDID_VSDB_EXIST) == TRUE) vEnableHdmiMode(TRUE); else vEnableHdmiMode(FALSE); vEnableNCTSAutoWrite(); vHDMISettingColorSpace(ui1colorspace); }
void mt8193_power_off(void) { MT8193_DRV_FUNC(); mt8193_hotinit = 1; mt8193_hotplugstate = HDMI_STATE_HOT_PLUG_OUT; vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_OUT); vWriteHdmiIntMask(0xFF); vWriteHdmiSYSMsk(HDMI_SYS_CFG1C, 0, ANLG_ON|HDMI_ON); mt_set_gpio_mode(GPIO_HDMI_POWER_CONTROL, GPIO_MODE_00); mt_set_gpio_dir(GPIO_HDMI_POWER_CONTROL, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_HDMI_POWER_CONTROL, GPIO_OUT_ZERO); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_clock_off, hdmi_clock_off); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_iso_en, hdmi_iso_en); vWriteHdmiSYSMsk(HDMI_SYS_PWR_RST_B, hdmi_pwr_sys_sw_reset, hdmi_pwr_sys_sw_unreset); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_power_turnoff, hdmi_power_turnon); }
void mt8193_power_off(void) { struct device_node *dn; int bus_switch_pin; HDMI_DEF_LOG("[hdmi]mt8193_power_off\n"); if (hdmi_powerenable == 0) { HDMI_DEF_LOG("[hdmi]already power off, return\n"); return; } hdmi_powerenable = 0; is_hdmi_plug_out_flag = 1; mt8193_hotinit = 1; mt8193_hotplugstate = HDMI_STATE_HOT_PLUG_OUT; #if defined(CONFIG_HAS_EARLYSUSPEND) if (mt8193_hdmiearlysuspend == 1) is_hdmi_plug_out_flag = 1; else is_hdmi_plug_out_flag = 0; #endif vSetSharedInfo(SI_HDMI_RECEIVER_STATUS, HDMI_PLUG_OUT); vWriteHdmiIntMask(0xFF); vWriteHdmiSYSMsk(HDMI_SYS_CFG1C, 0, ANLG_ON | HDMI_ON); #ifdef GPIO_HDMI_POWER_CONTROL mt_set_gpio_mode(GPIO_HDMI_POWER_CONTROL, GPIO_MODE_00); mt_set_gpio_dir(GPIO_HDMI_POWER_CONTROL, GPIO_DIR_OUT); mt_set_gpio_out(GPIO_HDMI_POWER_CONTROL, GPIO_OUT_ZERO); HDMI_DEF_LOG("[hdmi]hdmi_5v_off\n"); #endif dn = of_find_compatible_node(NULL, NULL, "mediatek,mt8193-hdmi"); bus_switch_pin = of_get_named_gpio(dn, "hdmi_power_gpios", 0); gpio_direction_output(bus_switch_pin, 0); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_clock_off, hdmi_clock_off); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_iso_en, hdmi_iso_en); vWriteHdmiSYSMsk(HDMI_SYS_PWR_RST_B, hdmi_pwr_sys_sw_reset, hdmi_pwr_sys_sw_unreset); vWriteHdmiSYSMsk(HDMI_PWR_CTRL, hdmi_power_turnoff, hdmi_power_turnon); }
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 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); } }