コード例 #1
0
void SiiMhlTxMscDetectCharger( uint8_t data1)
{
    if ((data1 & 0x13) == 0x11) { 							 // connected to TV; and TV has power output (default 0.5A min )
        /* Turn off phone Vbus output ; */
        /* Set battery charge current=500mA; */
        /* Enable battery charger; */
        mscCmdInProgress = false;
        mhlTxConfig.mscState	  = MSC_STATE_POW_DONE;
    }

    if ((data1 & 0x03) == 0x03) {			 /* 03=dongle */

        if (Chk_Dongle_Step == 0) {

            if (!Tri_state_dongle_GPIO0()) {
                TPI_DEBUG_PRINT(("%s: faild to set as GPI\n", __func__));
                mscCmdInProgress = false;
                return;
            }

            /* GPIO0_state=3; */

            mscCmdInProgress = false;
            SiiMhlTxReadDevcap(02);		/* send ReadDevCapReg0x02 packet out; POW will be returned on next MhlCbusIsr( ) */
            mscCmdInProgress = false;
            Chk_Dongle_Step = 1;
        }

        if (Chk_Dongle_Step == 1) {

            mscCmdInProgress = false;

            if ((data1 & 0x10)) {			 /* POW bit=1=Rx has power */
                /* Turn off phone Vbus output ; */
                Low_dongle_GPIO0();

                /* GPIO0_state = 0;  */
                SiiMhlTxReadDevcap(02);			  /* send ReadDevCapReg0x02 packet out; POW will be returned on next MhlCbusIsr( ) */
                mscCmdInProgress = false;
                Chk_Dongle_Step = 2;
            } else {

                /*				Chk_Dongle_Step=3; */
                Chk_Dongle_Step = 0;

                mhlTxConfig.mscState = MSC_STATE_POW_DONE;

                /* turn on phone VBUS output.; */
                TPI_DEBUG_PRINT(("No charger!!\n"));

                if (gStatusMHL != CONNECT_TYPE_NONE) {
                    gStatusMHL = CONNECT_TYPE_NONE;
                    ProcessMhlStatus(true, false);
                }
                /*system should periodically call siiMhlTxReadDevcap(02), next siiMhlTxGetEvents( )  MhlCbusIsr( ) will on/off Vbus, set charge current here */
            }
        }

        if (Chk_Dongle_Step == 2) {			   /*GPIO0_low=true */

            mhlTxConfig.mscState = MSC_STATE_POW_DONE;				/*02 ;*/
            mscCmdInProgress = false;

            /*			Chk_Dongle_Step=3; */
            Chk_Dongle_Step = 0;

            if (data1 & 0x10) { 			 /*[bit4] POW ==1=AC charger attached*/
                /* Set charge battery current=AC charger rating-100mA ; */

                /* Enable battery charger; &*/
                TPI_DEBUG_PRINT(("1000mA charger!!\n"));
                if (gStatusMHL != CONNECT_TYPE_AC) {
                    gStatusMHL = CONNECT_TYPE_AC;
                    ProcessMhlStatus(true, false);
                }

            } else {	/* charger port only has USB source provide 5V/100mA , that just enough dongle to work, no more current to charge phone battery */
                /* turn off phone VBUS output; */
                /* at least no need to send out 5V/100mA power*/
                TPI_DEBUG_PRINT(("500mA charger!!\n"));
                if (gStatusMHL != CONNECT_TYPE_USB) {
                    gStatusMHL = CONNECT_TYPE_USB;
                    ProcessMhlStatus(true, false);
                }
            }
        }
    }
}
コード例 #2
0
ファイル: sii_mhltx.c プロジェクト: LeeDroid-/ville_u
void SiiMhlTxMscDetectCharger(uint8_t data1)
{
	/* connected to TV; and TV has power output (default 0.5A min ) */
	if ((data1 & 0x13) == 0x11) {
		mscCmdInProgress = false;
		mhlTxConfig.mscState = MSC_STATE_POW_DONE;
		Chk_Dongle_Step = 0;

		if (data1 & 0x10) {
			/* [bit4] POW ==1=AC charger attached */
			TPI_DEBUG_PRINT(("1000mA charger!!\n"));
			if (gStatusMHL != CONNECT_TYPE_AC) {
				gStatusMHL = CONNECT_TYPE_AC;
				ProcessMhlStatus(true, false);
			}
		} else {
			TPI_DEBUG_PRINT(("500mA charger!!\n"));
			if (gStatusMHL != CONNECT_TYPE_USB) {
				gStatusMHL = CONNECT_TYPE_USB;
				ProcessMhlStatus(true, false);
			}
		}
	}

	/* 03=dongle */
	if ((data1 & 0x03) == 0x03) {

		if (Chk_Dongle_Step == 0) {

			if (!Tri_state_dongle_GPIO0()) {
				TPI_DEBUG_PRINT(("%s: faild to set as GPI\n", __func__));
				mscCmdInProgress = false;
				return;
			}

			/* GPIO0_state=3; */

			mscCmdInProgress = false;
			SiiMhlTxReadDevcap(0x02);
			mscCmdInProgress = false;
			Chk_Dongle_Step = 1;
			return;
		}

		if (Chk_Dongle_Step == 1) {

			mscCmdInProgress = false;

			if (data1 & 0x10) {
				/* Turn off phone Vbus output ; */
				Low_dongle_GPIO0();

				/* GPIO0_state = 0;  */
#if 0
				SiiMhlTxReadDevcap(0x02);
#endif
				mscCmdInProgress = false;
				Chk_Dongle_Step = 2;
				return;
			} else {

				Chk_Dongle_Step = 0;

				mhlTxConfig.mscState = MSC_STATE_POW_DONE;

				/* turn on phone VBUS output.; */
				TPI_DEBUG_PRINT(("No charger!!\n"));

				if (gStatusMHL != CONNECT_TYPE_INTERNAL) {
					gStatusMHL = CONNECT_TYPE_INTERNAL;
					ProcessMhlStatus(true, false);
				}
			}
		}

		if (Chk_Dongle_Step == 2) {

			mhlTxConfig.mscState = MSC_STATE_POW_DONE;
			mscCmdInProgress = false;

			Chk_Dongle_Step = 0;

			if (data1 & 0x10) {
				/* Set charge battery current=AC charger rating-100mA ; */

				/* Enable battery charger; &*/
				TPI_DEBUG_PRINT(("1000mA charger!!\n"));
				if (gStatusMHL != CONNECT_TYPE_AC) {
					gStatusMHL = CONNECT_TYPE_AC;
					ProcessMhlStatus(true, false);
				}

			} else {
				/* turn off phone VBUS output; */
				TPI_DEBUG_PRINT(("500mA charger!!\n"));
				if (gStatusMHL != CONNECT_TYPE_USB) {
					gStatusMHL = CONNECT_TYPE_USB;
					ProcessMhlStatus(true, false);
				}
			}
		}
	}
}
コード例 #3
0
void SiiMhlTxMscDetectCharger(uint8_t data1)
{
	
	if ((data1 & 0x13) == 0x11) {
		mscCmdInProgress = false;
		mhlTxConfig.mscState = MSC_STATE_POW_DONE;
		Chk_Dongle_Step = 0;

		if (data1 & 0x10) {
			
			TPI_DEBUG_PRINT(("1000mA charger!!\n"));
			if (gStatusMHL != CONNECT_TYPE_MHL_AC) {
				gStatusMHL = CONNECT_TYPE_MHL_AC;
				ProcessMhlStatus(true, false);
			}
		} else {
			TPI_DEBUG_PRINT(("500mA charger!!\n"));
			if (gStatusMHL != CONNECT_TYPE_USB) {
				gStatusMHL = CONNECT_TYPE_USB;
				ProcessMhlStatus(true, false);
			}
		}
	}

	
	if ((data1 & 0x03) == 0x03) {

		if (Chk_Dongle_Step == 0) {

			if (!Tri_state_dongle_GPIO0()) {
				TPI_DEBUG_PRINT(("%s: faild to set as GPI\n", __func__));
				mscCmdInProgress = false;
				return;
			}

			

			mscCmdInProgress = false;
			SiiMhlTxReadDevcap(0x02);
			mscCmdInProgress = false;
			Chk_Dongle_Step = 1;
			return;
		}

		if (Chk_Dongle_Step == 1) {

			mscCmdInProgress = false;

			if (data1 & 0x10) {
				
				Low_dongle_GPIO0();

				
#if 0
				SiiMhlTxReadDevcap(0x02);
#endif
				mscCmdInProgress = false;
				Chk_Dongle_Step = 2;
				return;
			} else {

				Chk_Dongle_Step = 0;

				mhlTxConfig.mscState = MSC_STATE_POW_DONE;

				
				TPI_DEBUG_PRINT(("No charger!!\n"));

				if (gStatusMHL != CONNECT_TYPE_INTERNAL) {
					gStatusMHL = CONNECT_TYPE_INTERNAL;
					ProcessMhlStatus(true, false);
				}
			}
		}

		if (Chk_Dongle_Step == 2) {

			mhlTxConfig.mscState = MSC_STATE_POW_DONE;
			mscCmdInProgress = false;

			Chk_Dongle_Step = 0;

			if (data1 & 0x10) {
				

				
				TPI_DEBUG_PRINT(("1000mA charger!!\n"));
				if (gStatusMHL != CONNECT_TYPE_MHL_AC) {
					gStatusMHL = CONNECT_TYPE_MHL_AC;
					ProcessMhlStatus(true, false);
				}

			} else {
				
				TPI_DEBUG_PRINT(("500mA charger!!\n"));
				if (gStatusMHL != CONNECT_TYPE_USB) {
					gStatusMHL = CONNECT_TYPE_USB;
					ProcessMhlStatus(true, false);
				}
			}
		}
	}
}