static void OnMHDCableConnected(void)
{

    TPI_DEBUG_PRINT(("[SIMG] MHD Connected\n"));

    if (txPowerState == TX_POWER_STATE_D3) {
        /* start tpi */
        WriteByteTPI(TPI_ENABLE, 0x00);	/* Write "0" to 72:C7 to
						   start HW TPI mode */
        /* enable interrupts */
        WriteIndexedRegister(INDEXED_PAGE_0, 0x78, 0x01);

        TxPowerStateD0();
    }

    mobileHdCableConnected = TRUE;

    WriteIndexedRegister(INDEXED_PAGE_0, 0xA0, 0x10);

    TPI_DEBUG_PRINT(("[SIMG] Setting DDC Burst Mode\n"));
    /* Increase DDC translation layer timer (burst mode) */
    WriteByteCBUS(0x07, DDC_XLTN_TIMEOUT_MAX_VAL | 0x0E);
    WriteByteCBUS(0x47, 0x03);
    WriteByteCBUS(0x21, 0x01); /* Heartbeat Disable */
}
Beispiel #2
0
void HotPlugService (void) {
	DisableInterrupts(0xFF);
	Active9232();
	if ((HDCP_TxSupports == true)) {
		if (HDCP_AksvValid == true) {
			// AV MUTE
			TPI_DEBUG_PRINT (("TMDS -> Enabled (Video Muted)\n"));

			ReadModifyWriteTPI(0x1A, BIT_6 | BIT_4	| BIT_3,
				0x40 | 0x00 | 0x08);

			tmdsPoweredUp = true;

			EnableInterrupts(BIT_0 | 0x02 | 0x10 | 0x20 | 0x40 | 0x80);
		}

	} else {
		TPI_DEBUG_PRINT (("TMDS -> Enabled\n"));
		ReadModifyWriteTPI(0x1A, 
			BIT_6 | BIT_4 | BIT_3,
				0x40 | 0x00 | 0x08);
		tmdsPoweredUp = TRUE;
		EnableInterrupts(0x01 | 0x02 | 0x10 | 0x40);
	}
	TxPowerStateD0();

	I2C_WriteByte(TPI_SLAVE_ADDR, 0xcd, 0x0);
	I2C_WriteByte(TPI_SLAVE_ADDR, 0x19, 0x0);
}
Beispiel #3
0
void	SiiMhlTxGotMhlStatus(uint8_t status_0, uint8_t status_1)
{
	uint8_t StatusChangeBitMask0,StatusChangeBitMask1;
    StatusChangeBitMask0 = status_0 ^ mhlTxConfig.status_0;
    StatusChangeBitMask1 = status_1 ^ mhlTxConfig.status_1;
	// Remember the event.   (other code checks the saved values, so save the values early, but not before the XOR operations above)
	mhlTxConfig.status_0 = status_0;
	mhlTxConfig.status_1 = status_1;

	TPI_DEBUG_PRINT(("MhlTx: STATUS Arrived.%02X,%02X\n", (int) status_0, (int) status_1));

	if(MHL_STATUS_DCAP_RDY & StatusChangeBitMask0)
	{
		if(MHL_STATUS_DCAP_RDY & status_0)
		{
			mhlTxConfig.mscState	 = MSC_STATE_BEGIN;
		}
	}

	if(MHL_STATUS_PATH_ENABLED & StatusChangeBitMask1)
    {
        TPI_DEBUG_PRINT(("MhlTx: PATH_EN changed\n"));
		if(MHL_STATUS_PATH_ENABLED & status_1)
		{
			SiiMhlTxSetPathEn();
		}
		else
		{
			SiiMhlTxClrPathEn();
		}
	}
}
Beispiel #4
0
void	SiiMhlTxMscCommandDone(uint8_t data1)
{
	TPI_DEBUG_PRINT(("MhlTx: SiiMhlTxMscCommandDone. data1 =%02X\n", (int) data1));

	if ((MHL_READ_DEVCAP == mhlTxConfig.mscLastCommand) &&
		(0x02 == mhlTxConfig.mscLastOffset)) {

#ifdef CONFIG_INTERNAL_CHARGING_SUPPORT
		SiiMhlTxMscDetectCharger(data1);
#else
		mhlTxConfig.mscState	= MSC_STATE_POW_DONE;
#endif
	} else if ((MHL_READ_DEVCAP == mhlTxConfig.mscLastCommand) &&
			(0x0A == mhlTxConfig.mscLastOffset)) {
		mhlTxConfig.mscState	= MSC_STATE_RCP_READY;

		mhlTxConfig.mscFeatureFlag = data1;

		mhlTxConfig.mhlConnectionEvent = true;
		mhlTxConfig.mhlConnected = MHL_TX_EVENT_RCP_READY;

		mhlTxConfig.mscLastCommand = 0;
		mhlTxConfig.mscLastOffset  = 0;

		TPI_DEBUG_PRINT(("MhlTx: Peer's Feature Flag =%02X\n", (int) data1));
	} else if (MHL_MSC_MSG_RCPE == mhlTxConfig.mscMsgLastCommand) {
		if (SiiMhlTxRcpkSend(mhlTxConfig.mscSaveRcpKeyCode)) {
			mhlTxConfig.mscMsgLastCommand = 0;
			mhlTxConfig.mscMsgLastData = 0;
		}
	}
}
void	SiiMhlTxGotMhlStatus(uint8_t status_0, uint8_t status_1)
{
	uint8_t StatusChangeBitMask0,StatusChangeBitMask1;
    StatusChangeBitMask0 = status_0 ^ mhlTxConfig.status_0;
    StatusChangeBitMask1 = status_1 ^ mhlTxConfig.status_1;
	
	mhlTxConfig.status_0 = status_0;
	mhlTxConfig.status_1 = status_1;

	TPI_DEBUG_PRINT(("MhlTx: STATUS Arrived.%02X,%02X\n", (int) status_0, (int) status_1));

	if(MHL_STATUS_DCAP_RDY & StatusChangeBitMask0)
	{
		if(MHL_STATUS_DCAP_RDY & status_0)
		{
			mhlTxConfig.mscState	 = MSC_STATE_BEGIN;
		}
	}

	if(MHL_STATUS_PATH_ENABLED & StatusChangeBitMask1)
    {
        TPI_DEBUG_PRINT(("MhlTx: PATH_EN changed\n"));
		if(MHL_STATUS_PATH_ENABLED & status_1)
		{
			SiiMhlTxSetPathEn();
		}
		else
		{
			SiiMhlTxClrPathEn();
		}
	}
}
Beispiel #6
0
void	SiiMhlTxNotifyDsHpdChange(uint8_t dsHpdStatus)
{
	if (0 == dsHpdStatus) {
		TPI_DEBUG_PRINT(("MhlTx: Disable TMDS - fake\n"));
		/*mhlTxConfig.mhlHpdRSENflags &= ~MHL_HPD;*/
		/*SiiMhlTxDrvTmdsControl(false);*/
	} else {
		TPI_DEBUG_PRINT(("MhlTx: Enable TMDS\n"));
		TPI_DEBUG_PRINT(("MhlTx: DsHPD ON\n"));
		mhlTxConfig.mhlHpdRSENflags |= MHL_HPD;
		SiiMhlTxTmdsEnable();
	}
}
void OnDownstreamRxPoweredDown(void)
{

    TPI_DEBUG_PRINT(("[SIMG] DSRX -> Powered Down\n"));

    dsRxPoweredUp = FALSE;

    /* disable TMDS */
    TPI_DEBUG_PRINT(("[SIMG] TMDS -> Disabled\n"));
    ReadModifyWriteTPI(TPI_SYSTEM_CONTROL_DATA_REG,
                       TMDS_OUTPUT_CONTROL_MASK,
                       TMDS_OUTPUT_CONTROL_POWER_DOWN);
    tmdsPoweredUp = FALSE;
}
Beispiel #8
0
bool SiiMhlTxSetPathEn(void )
{
	TPI_DEBUG_PRINT(("MhlTx:SiiMhlTxSetPathEn\n"));
    SiiMhlTxTmdsEnable();
    mhlTxConfig.linkMode |= MHL_STATUS_PATH_ENABLED;     // update local copy
    return SiiMhlTxSetStatus( MHL_STATUS_REG_LINK_MODE, mhlTxConfig.linkMode);
}
Beispiel #9
0
void DisableTMDS(void)
{
	TPI_DEBUG_PRINT(("TMDS -> Disabled\n"));
	ReadModifyWriteTPI(0x1A, BIT_4 | BIT_3,
		 0x10 | 0x08);
	tmdsPoweredUp = false;
}
Beispiel #10
0
void EnableTMDS(void) 
{
	TPI_DEBUG_PRINT(("TMDS -> Enabled\n"));
	ReadModifyWriteTPI(0x1A, BIT_4, 
		0x00);
	tmdsPoweredUp = true;
}
Beispiel #11
0
///////////////////////////////////////////////////////////////////////////////
//
// SiiMhlTxClrPathEn
//
bool SiiMhlTxClrPathEn( void )
{
	TPI_DEBUG_PRINT(("MhlTx: SiiMhlTxClrPathEn\n"));
    SiiMhlTxDrvTmdsControl( false );
    mhlTxConfig.linkMode &= ~MHL_STATUS_PATH_ENABLED;    // update local copy
    return SiiMhlTxSetStatus( MHL_STATUS_REG_LINK_MODE, mhlTxConfig.linkMode);
}
Beispiel #12
0
static void WakeUpFromD3(void) 
{
	TPI_DEBUG_PRINT(("Waking up...\n"));

	InitializeStateVariables();
	WriteInitialRegisterValues();
}
static void TxPowerStateD0 (void)
{

    ReadModifyWriteTPI(TPI_DEVICE_POWER_STATE_CTRL_REG, TX_POWER_STATE_MASK, 0x00);
    TPI_DEBUG_PRINT(("[SIMG] TX Power State D0\n"));
    txPowerState = TX_POWER_STATE_D0;
}
void DisableTMDS (void)
{

    TPI_DEBUG_PRINT(("[SIMG] TMDS -> Disabled\n"));
    ReadModifyWriteTPI(TPI_SYSTEM_CONTROL_DATA_REG, TMDS_OUTPUT_CONTROL_MASK, TMDS_OUTPUT_CONTROL_POWER_DOWN);
    tmdsPoweredUp = FALSE;
}
Beispiel #15
0
static void TxPowerStateD0(void) 
{
	ReadModifyWriteTPI(0x1E, BIT_1 | BIT_0, 0x00);
	TPI_DEBUG_PRINT(("TX Power State D0\n"));
	ReadModifyWriteIndexedRegister(0x01, 0x94, BIT_0 | BIT_1, 0x01);
	ReadModifyWriteIndexedRegister(0x01, 0x93, 0xF0, 0x80);

}
void OnHdmiCableDisconnected (void)
{

    TPI_DEBUG_PRINT (("[SIMG] HDMI Disconnected\n"));

    hdmiCableConnected = FALSE;
    OnDownstreamRxPoweredDown();
}
Beispiel #17
0
void	SiiMhlTxGotMhlIntr(uint8_t intr_0, uint8_t intr_1)
{
	TPI_DEBUG_PRINT(("MhlTx: INTERRUPT Arrived. %02X, %02X\n", (int) intr_0, (int) intr_1));
	if (BIT_0 & intr_0)
		SiiMhlTxReadDevcap(0x02);
	else if (BIT_1 & intr_1)
		SiiMhlTxDrvNotifyEdidChange();
}
void OnDownstreamRxPoweredDown (void)
{

    TPI_DEBUG_PRINT (("[SIMG] DSRX -> Powered Down\n"));

    dsRxPoweredUp = FALSE;
    DisableTMDS();
}
Beispiel #19
0
static bool ProductID_Read(void)
{
	uint8_t devID = 0x00;
	uint16_t wID = 0x0000;

	devID = ReadIndexedRegister(0x01, 0x03);
	wID = devID;
	wID <<= 8;
	devID = ReadIndexedRegister(0x01, 0x02);
	wID |= devID;
	TPI_DEBUG_PRINT(("SiI %04X\n", (int) wID));

	if (wID == SiI9232_PRODUCT_ID) {
		return true;
	}	
	TPI_DEBUG_PRINT(("Unsupported TX\n"));
	return false;
}
Beispiel #20
0
static void TxPowerStateD3(void)
{
	ReadModifyWriteIndexedRegister(0x01, 0x94, BIT_0 | BIT_1, 0x00);
	ReadModifyWriteIndexedRegister(0x01, 0x93, BIT_3 | BIT_4 | BIT_5 | BIT_7, BIT_3);
	ReadModifyWriteIndexedRegister(0x02, 0x3D, BIT_0, 0x00);
	bInTpiMode = false;
	TPI_DEBUG_PRINT(("TX Power State D3\n"));
    	CLEAR_CBUS_TOGGLE(); 
}
void	SiiMhlTxGotMhlStatus(uint8_t status_0, uint8_t status_1)
{
	TPI_DEBUG_PRINT(("MhlTx: STATUS Arrived.%02X,%02X\n", (int) status_0, (int) status_1));

	if (BIT_0 & status_0)
		mhlTxConfig.mscState	 = MSC_STATE_BEGIN;
	mhlTxConfig.status_0 = status_0;
	mhlTxConfig.status_1 = status_1;
}
Beispiel #22
0
bool TPI_Init(void)
{
	TPI_DEBUG_PRINT(("9232 SK "));
	TPI_DEBUG_PRINT(("(X04)"));
	TPI_DEBUG_PRINT((" FW 0.22\n"));

	txPowerState = TX_POWER_STATE_D0;

	InitializeStateVariables();
	TxHW_Reset();
	WriteInitialRegisterValues();
	I2C_WriteByte(TPI_SLAVE_ADDR, 0x7A, 0x14);
	if (!StartTPI()) {
		return false;
	}

	if (!ProductID_Read()) {
		return false;
	}

       hdcp_init(mhl_tpi_info);

	MHLCableConnected = FALSE;
	hdmiCableConnected = false;
	OnDownstreamRxPoweredDown();
	WriteIndexedRegister(0x01, 0xA0, 0xD0);

        TPI_DEBUG_PRINT(("\ncalling CpCbusInitialize\n\n"));
        CpCbusInitialize(mhl_tpi_info);

	hdcp_off();

	TxPowerStateD3();

	MHLCableConnected = false;
	hdmiCableConnected = false;
	dsRxPoweredUp = false;
   	bInTpiMode =false;	

        txPowerState = txpsD3;
	return true;
}
Beispiel #23
0
static bool SiiMhlTxSetStatus(uint8_t regToWrite, uint8_t value)
{
	cbus_req_t	req;

	req.retryCount  = 2;
	req.command     = MHL_WRITE_STAT;
	req.offsetData  = regToWrite;
	req.payload_u.msgData[0]  = value;

	TPI_DEBUG_PRINT(("MhlTx:SiiMhlTxSetStatus\n"));
	return( SiiMhlTxDrvSendCbusCommand( &req  ));
}
Beispiel #24
0
void CheckTxFifoStable(void)
{
	uint8_t bTemp;

	bTemp = ReadIndexedRegister(0x01, 0x3E);
	if ((bTemp & (BIT_7 | BIT_6)) != 0x00) {
		TPI_DEBUG_PRINT(("FIFO Overrun / Underrun\n"));
		WriteIndexedRegister(0x01, 0x05, BIT_4 | ASR_VALUE);
		DelayMS(1);
		WriteIndexedRegister(0x01, 0x05, ASR_VALUE);
	}
}
Beispiel #25
0
void SiiMhlTxInitialize(bool interruptDriven, uint8_t pollIntervalMs)
{
	TPI_DEBUG_PRINT(("MhlTx: SiiMhlTxInitialize\n"));
	mhlTxConfig.interruptDriven = interruptDriven;
	mhlTxConfig.pollIntervalMs  = pollIntervalMs;

	MhlTxResetStates();

#ifdef CONFIG_INTERNAL_CHARGING_SUPPORT
	Chk_Dongle_Step = 0;
#endif

}
static bool SiiMhlTxSetStatus(uint8_t regToWrite, uint8_t value)
{
	cbus_req_t	req;
	bool retVal;

	req.retryCount  = 2;
	req.command     = MHL_WRITE_STAT;
	req.offsetData  = regToWrite;
	req.payload_u.msgData[0]  = value;

	TPI_DEBUG_PRINT(("MhlTx:SiiMhlTxSetStatus\n"));
	retVal = PutNextCBusTransaction(&req);
	return retVal;
}
void OnMHDCableConnected (void)
{

    TPI_DEBUG_PRINT (("[SIMG] MHD Connected\n"));

    if (txPowerState == TX_POWER_STATE_D3)
    {
        sii9234_start_tpi();
        EnableInterrupts();
        TxPowerStateD0();
    }

    mobileHdCableConnected = TRUE;

    WriteIndexedRegister(INDEXED_PAGE_0, 0xA0, 0x10);

    TPI_DEBUG_PRINT (("[SIMG] Setting DDC Burst Mode\n"));
    WriteByteCBUS(0x07, DDC_XLTN_TIMEOUT_MAX_VAL | 0x0E); 	// Increase DDC translation layer timer (burst mode)
    WriteByteCBUS(0x47, 0x03);

    WriteByteCBUS(0x21, 0x01); // Heartbeat Disable

}
void CheckTxFifoStable (void)
{

    byte bTemp;

    bTemp = ReadIndexedRegister(INDEXED_PAGE_0, 0x3E);
    if ((bTemp & (SI_BIT_7 | SI_BIT_6)) != 0x00)
    {
        TPI_DEBUG_PRINT(("[SIMG] FIFO Overrun / Underrun\n"));
        WriteIndexedRegister(INDEXED_PAGE_0, 0x05, SI_BIT_4 | ASR_VALUE);	// Assert MHD FIFO Reset
        delay_ms(1);
        WriteIndexedRegister(INDEXED_PAGE_0, 0x05, ASR_VALUE);			// Deassert MHD FIFO Reset
    }
}
Beispiel #29
0
void tpi_clear_pending_event(void)
{
	int retry = 100;

	while (retry--) {
		WriteByteTPI(0x3c, 1);
		WriteByteTPI(0x3d, 1);
		if (ReadByteTPI(0x3d) & 0x01)
			DelayMS(1);
		else
			break;
	}
	if (retry < 19) TPI_DEBUG_PRINT(("%s: retry=%d\n", __func__, 19 - retry));
}
Beispiel #30
0
static void SiiMhlTxTmdsEnable(void)
{
	TPI_DEBUG_PRINT(("MhlTx:SiiMhlTxTmdsEnable\n"));
	/*if (MHL_RSEN & mhlTxConfig.mhlHpdRSENflags) {
		TPI_DEBUG_PRINT(("\tMHL_RSEN\n"));
		if (MHL_HPD & mhlTxConfig.mhlHpdRSENflags) {
			TPI_DEBUG_PRINT(("\t\tMHL_HPD\n"));
			if (MHL_STATUS_PATH_ENABLED & mhlTxConfig.status_1) {
				TPI_DEBUG_PRINT(("\t\t\tMHL_STATUS_PATH_ENABLED\n")); */
				SiiMhlTxDrvTmdsControl(true);
	/*		}
		}
	} */
}