int32_t StopMhlTxDevice(void)
{
	halReturn_t		halStatus;
	printk("Stopping %s\n", MHL_PART_NAME);
	HalRemoveIrqHandler();
    //HalRemoveSilMonRequestIrqHandler();
#ifdef RGB_BOARD
    //HalRemoveSilExtDeviceIrqHandler();
#endif
	halStatus = HalCloseI2cDevice();
    if (halStatus != HAL_RET_SUCCESS)
    {
    	SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,
    			"Closing of I2c device failed, error code: %d\n",halStatus);
    	return -EIO;
    }
	halStatus = HalTerm();
    if (halStatus != HAL_RET_SUCCESS)
    {
    	SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,
    			"Termination of HAL failed, error code: %d\n",halStatus);
    	return -EIO;
    }
	SiiOsTerm();
	return 0;
}
Example #2
0
static int hdmi_drv_init(void)
{
    halReturn_t     halStatus;
    SiiOsStatus_t osalStatus;
    printk("Starting %s\n", MHL_PART_NAME);

    if(!SiiCraInitialize())
    {
        SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Initialization of CRA layer failed!\n");
        return -EIO;
    }
    osalStatus = SiiOsInit(0);
    if (osalStatus != SII_OS_STATUS_SUCCESS)
    {
        SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Initialization of OSAL failed, error code: %d\n",osalStatus);
        return -EIO;
    }
    halStatus = HalInit();
    if (halStatus != HAL_RET_SUCCESS)
    {
        SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Initialization of HAL failed, error code: %d\n",halStatus);
        SiiOsTerm();
        return -EIO;
    }

//#if MTK_project
    //xuecheng
    //I2c_Init();
//#endif

    halStatus = HalOpenI2cDevice(MHL_PART_NAME, MHL_DRIVER_NAME);
    if (halStatus != HAL_RET_SUCCESS)
    {
        SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Opening of I2c device %s failed, error code: %d\n",
                MHL_PART_NAME, halStatus);
        HalTerm();
        SiiOsTerm();
        return -EIO;
    }


    //msleep(200);
#ifdef SiI8338DRIVER_INTERRUPT_MODE
    halStatus = HalInstallIrqHandler(SiiMhlTxDeviceIsr);
    if (halStatus != HAL_RET_SUCCESS)
    {
        SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Initialization of HAL interrupt support failed, error code: %d\n",
                halStatus);
        HalCloseI2cDevice();
        HalTerm();
        SiiOsTerm();
        return -EIO;
    }

#else
    StartEventThread();     /* begin monitoring for events if using polling mode*/
#endif

    mhl_init_rmt_input_dev();

    return 0;
}
int32_t StartMhlTxDevice(void)
{
	halReturn_t		halStatus;
	SiiOsStatus_t	osalStatus;
    printk("Starting %s\n", MHL_PART_NAME);

	SiiMhlTxHwReset(10,200);  
    if(!SiiCraInitialize())
    {
    	SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Initialization of CRA layer failed!\n");
    	return -EIO;
    }
    osalStatus = SiiOsInit(0);
    if (osalStatus != SII_OS_STATUS_SUCCESS)
    {
    	SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Initialization of OSAL failed, error code: %d\n",osalStatus);
    	return -EIO;
    }
    halStatus = HalInit();
    if (halStatus != HAL_RET_SUCCESS)
    {
    	SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Initialization of HAL failed, error code: %d\n",halStatus);
    	SiiOsTerm();
    	return -EIO;
    }

//#if MTK_project
    //xuecheng
    //I2c_Init();
//#endif
  
    halStatus = HalOpenI2cDevice(MHL_PART_NAME, MHL_DRIVER_NAME);
    if (halStatus != HAL_RET_SUCCESS)
    {
    	SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Opening of I2c device %s failed, error code: %d\n",
    			MHL_PART_NAME, halStatus);
    	HalTerm();
    	SiiOsTerm();
    	return -EIO;
    }
		

	msleep(200);
	
#ifdef SiI8338DRIVER_INTERRUPT_MODE
    halStatus = HalInstallIrqHandler(SiiMhlTxDeviceIsr);
    if (halStatus != HAL_RET_SUCCESS)
    {
    	SII_DEBUG_PRINT(SII_OSAL_DEBUG_TRACE,"Initialization of HAL interrupt support failed, error code: %d\n",
    			halStatus);
    	HalCloseI2cDevice();
    	HalTerm();
    	SiiOsTerm();
    	return -EIO;
    }

#else
		StartEventThread();		/* begin monitoring for events if using polling mode*/
#endif
    //xuecheng

    HalInstallCheckDeviceCB(SiiCheckDevice);
	HalAcquireIsrLock();
	siHdmiTx_VideoSel(HDMI_720P60);
	siHdmiTx_AudioSel(I2S_44);
    SiiMhlTxInitialize(EVENT_POLL_INTERVAL_MS);
    HalReleaseIsrLock();
    return 0;
}