const HDMI_DRIVER* HDMI_GetDriver(void)
{
	static const HDMI_DRIVER HDMI_DRV =
	{
		.set_util_funcs = hdmi_drv_set_util_funcs,
		.get_params     = hdmi_drv_get_params,
		.init           = hdmi_drv_init,
        .enter          = hdmi_drv_enter,
        .exit           = hdmi_drv_exit,
		.suspend        = hdmi_drv_suspend,
		.resume         = hdmi_drv_resume,
        .video_config   = hdmi_drv_video_config,
        .audio_config   = hdmi_drv_audio_config,
        .video_enable   = hdmi_drv_video_enable,
        .audio_enable   = hdmi_drv_audio_enable,
        .power_on       = hdmi_drv_power_on,
        .power_off      = hdmi_drv_power_off,
        .get_state      = hdmi_drv_get_state,
        .log_enable     = hdmi_drv_log_enable,
        .getedid        = hdmi_GetEdidInfo,
        .get_external_device_capablity = hdmi_drv_get_external_device_capablity,
        .force_on = hdmi_drv_force_on,
	};

    HDMI_FUNC();
	return &HDMI_DRV;
}
Exemple #2
0
static void hdmi_drv_get_params(HDMI_PARAMS *params)
{
    HDMI_FUNC();
	memset(params, 0, sizeof(HDMI_PARAMS));
    params->init_config.vformat         = HDMI_VIDEO_1280x720p_60Hz;
    params->init_config.aformat         = HDMI_AUDIO_PCM_16bit_44100;

	params->clk_pol           = HDMI_POLARITY_FALLING;
	params->de_pol            = HDMI_POLARITY_RISING;
	params->vsync_pol         = HDMI_POLARITY_RISING;
	params->hsync_pol         = HDMI_POLARITY_RISING;

	params->hsync_front_porch = 110;
	params->hsync_pulse_width = 40;
	params->hsync_back_porch  = 220;

	params->vsync_front_porch = 5;
	params->vsync_pulse_width = 5;
	params->vsync_back_porch  = 20;

	params->rgb_order         = HDMI_COLOR_ORDER_RGB;

	params->io_driving_current = IO_DRIVING_CURRENT_2MA;
	params->intermediat_buffer_num = 4;
    params->scaling_factor = 5;
}
void hdmi_drv_power_off(void)
{

	HDMI_FUNC();
	
    if(not_switch_to_d3 > 0)
    {
        HDMI_LOG("hdmi_drv_power_off direct to exit for forceon(%d_\n", not_switch_to_d3 );
        return ;
    }

    cust_hdmi_dpi_gpio_on(false);
    if(audio_enable == 0)
	    cust_hdmi_i2s_gpio_on(false);

  	return ;
	
	Mask_MHL_Intr();

    if(ReadConnectionStatus()==1){
        need_reset_usb_switch = true;
    	 ForceSwitchToD3(si_dev_context);
    }
    else
        need_reset_usb_switch = false;

	cust_hdmi_power_on(false);
	chip_inited = false;
    return ;

}
int hdmi_drv_power_on(void)
{
    int ret = 0;
	HDMI_FUNC();
	mt65xx_eint_mask(CUST_EINT_MHL_NUM);

#if 1
	SiiMhlTxHwGpioResume();
	//pmic_config_interface(0x87,0x1,0x01,0x0);
/* Vanzo:lubaoquan on: Tue, 21 May 2013 22:35:29 +0800
 * TODO: replace this line with your comment
 */
	hwPowerOn(MT65XX_POWER_LDO_VGP5, VOL_1200, "HDMI");
// End of Vanzo: lubaoquan
#endif

	//msleep(100);
    SiiMhlTxHwReset(5,5);

	//xuecheng
	HalInstallCheckDeviceCB(SiiCheckDevice);
    HalAcquireIsrLock();
    siHdmiTx_VideoSel(HDMI_720P60);
    siHdmiTx_AudioSel(I2S_44);
    ret = SiiMhlTxInitialize(EVENT_POLL_INTERVAL_MS);
    HalReleaseIsrLock();
	mt65xx_eint_unmask(CUST_EINT_MHL_NUM);
    return ret;
}
int hdmi_dst_display_path_config(bool enable)
{
    HDMI_FUNC();

    if (enable)
    {
        //FIXME: now nothing can be seen on TV if output UYVY from WDMA0

        unsigned int hdmiSourceAddr = hdmi_mva_r;// + p->hdmi_width * p->hdmi_height * hdmi_bpp * hdmi_buffer_read_id;

        struct disp_path_config_struct config = {0};

        // Config RDMA->DPI1
        config.srcWidth = 1280;
        config.srcHeight = 720;

        config.srcModule = DISP_MODULE_RDMA1;
        config.inFormat = RDMA_INPUT_FORMAT_ARGB;
        config.outFormat = RDMA_OUTPUT_FORMAT_ARGB;
        config.addr = hdmiSourceAddr;
        config.pitch = config.srcWidth * 4;

        config.dstModule = DISP_MODULE_DPI0;

        //if(-1 == dp_mutex_dst)
        //   dp_mutex_dst = disp_lock_mutex();
        dp_mutex_dst = 2;
        disp_dump_reg(DISP_MODULE_RDMA0);
        disp_dump_reg(DISP_MODULE_RDMA1);
        disp_dump_reg(DISP_MODULE_CONFIG);

        HDMI_LOG("Get mutex ID %d for RDMA1>DPI1\n", dp_mutex_dst);
        disp_path_get_mutex_(dp_mutex_dst);
        disp_path_config_(&config, dp_mutex_dst);
        disp_path_release_mutex_(dp_mutex_dst);
        disp_dump_reg(DISP_MODULE_CONFIG);
        disp_dump_reg(DISP_MODULE_RDMA0);
        disp_dump_reg(DISP_MODULE_RDMA1);
    }
    else
    {
        if (-1 != dp_mutex_dst)
        {
            //FIXME: release mutex timeout
            HDMI_LOG("Stop RDMA1>DPI1\n");
            disp_path_get_mutex_(dp_mutex_dst);

            DISP_REG_SET_FIELD(1 << dp_mutex_src , DISP_REG_CONFIG_MUTEX_INTEN,  1);
            RDMAStop(1);
            RDMAReset(1);
            disp_path_release_mutex_(dp_mutex_dst);

            //disp_unlock_mutex(dp_mutex_dst);
            dp_mutex_dst = -1;
        }
    }

    return 0;
}
Exemple #6
0
HDMI_STATE hdmi_drv_get_state(void)
{
	int ret = SiiTxReadConnectionStatus();
	HDMI_FUNC();
	HDMI_LOG("sii status:%d\n", ret);
	if(ret == 1)
		return HDMI_STATE_ACTIVE;
	else
		return HDMI_STATE_NO_DEVICE;
}
void hdmi_drv_power_off(void)
{
	HDMI_FUNC();
	SiiMhlTxHwGpioSuspend();
	SiiMhlTxHwReset(50,200);
	ForceSwitchToD3();
	//SwitchToD3();
	//SiiMhlTxHwResetKeepLow();
	//pmic_config_interface(0x87,0x0,0x01,0x0);
}
int hdmi_drv_power_on(void)
{
    int ret = 1;
	HDMI_FUNC();

/*
    if(not_switch_to_d3 > 0)
    {
        HDMI_LOG("hdmi_drv_power_on direct to exit for forceon(%d_\n", not_switch_to_d3);
        return ;
    }
*/
    
	cust_hdmi_power_on(true);	
	cust_hdmi_dpi_gpio_on(true);    
    //cust_hdmi_i2s_gpio_on(true);   
    
	if(txInitFlag == 0)
	{
		///sii_8348_tx_init(); 
		txInitFlag = 1;
	}
	
	goto power_on_exit;

/*
	MHL_Power(true);
	Mask_MHL_Intr();

	if(chip_inited == false)
	{
		if(txInitFlag == 0)
		{
			sii_8348_tx_init();
			txInitFlag = 1;
		}
		else
		{
			si_mhl_tx_post_initialize(si_dev_context, false);  
		}

		chip_inited = true;
	}
*/
power_on_exit:

    if(chip_device_id >0)
        ret = 0;
	
	Unmask_MHL_Intr();
    HDMI_LOG("status %d, chipid: %x, ret: %d--%d\n", ReadConnectionStatus() , chip_device_id, ret, need_reset_usb_switch);        

    return ret;
}
void hdmi_drv_power_on(void)
{
	HDMI_FUNC();
	mt65xx_eint_mask(CUST_EINT_HDMI_HPD_NUM);
	SiiMhlTxHwGpioResume();
	pmic_config_interface(0x87,0x1,0x01,0x0);
	//msleep(100);
    SiiMhlTxHwReset(50,200);

	//xuecheng
	HalInstallCheckDeviceCB(SiiCheckDevice);
    HalAcquireIsrLock();
    siHdmiTx_VideoSel(HDMI_720P60);
    siHdmiTx_AudioSel(I2S_44);
    SiiMhlTxInitialize(EVENT_POLL_INTERVAL_MS);
    HalReleaseIsrLock();
	mt65xx_eint_unmask(CUST_EINT_HDMI_HPD_NUM);
}
void hdmi_drv_power_off(void)
{
	HDMI_FUNC();

#if 1
	SiiMhlTxHwGpioSuspend();
#endif

	SiiMhlTxHwReset(50,200);
	ForceSwitchToD3();
	//SwitchToD3();
	//SiiMhlTxHwResetKeepLow();
	//pmic_config_interface(0x87,0x0,0x01,0x0);
/* Vanzo:lubaoquan on: Tue, 21 May 2013 22:38:24 +0800
 * TODO: replace this line with your comment
 */
    hwPowerDown(MT65XX_POWER_LDO_VGP5, "HDMI");
 // End of Vanzo: lubaoquan
}
int hdmi_allocate_hdmi_buffer(void)
{
    M4U_PORT_STRUCT m4uport;
    int hdmiPixelSize = p->hdmi_width * p->hdmi_height;
    int hdmiDataSize = hdmiPixelSize * hdmi_bpp;
    int hdmiBufferSize = hdmiDataSize * 4;

    HDMI_FUNC();

    hdmi_va = (unsigned int) vmalloc(hdmiBufferSize);

    if (((void *) hdmi_va) == NULL)
    {
        HDMI_LOG("vmalloc %dbytes fail!!!\n", hdmiBufferSize);
        return -1;
    }

    memset((void *) hdmi_va, 0x80, hdmiBufferSize);

    //RDMA1
    if (m4u_alloc_mva(M4U_CLNTMOD_RDMA, hdmi_va, hdmiBufferSize, 0, 0, &hdmi_mva_r))
    {
        HDMI_LOG("m4u_alloc_mva for hdmi_mva_r fail\n");
        return -1;
    }

    memset((void *) &m4uport, 0, sizeof(M4U_PORT_STRUCT));
    m4uport.ePortID = M4U_PORT_RDMA1;
    m4uport.Virtuality = 1;
    m4uport.domain = 0;
    m4uport.Security = 0;
    m4uport.Distance = 1;
    m4uport.Direction = 0;
    m4u_config_port(&m4uport);

    HDMI_LOG("hdmi_va=0x%08x, hdmi_mva_r=0x%08x, hdmi_mva_w=0x%08x\n", hdmi_va, hdmi_mva_r, hdmi_mva_w);

    return 0;
}
Exemple #12
0
/* Will only be used in ioctl(MTK_HDMI_AUDIO_VIDEO_ENABLE) */
static HDMI_STATUS hdmi_drv_init(void)
{
    int lcm_width, lcm_height;
    int tmpBufferSize;
		M4U_PORT_STRUCT portStruct;

    HDMI_FUNC();

    RETIF(p->output_mode == HDMI_OUTPUT_MODE_DPI_BYPASS, 0);

    p->hdmi_width = 1280;
    p->hdmi_height = 720;

    lcm_width = DISP_GetScreenWidth();
    lcm_height = DISP_GetScreenHeight();

    //printk("[hdmi]%s, hdmi_width=%d, hdmi_height=%d\n", __func__, p->hdmi_width, p->hdmi_height);
    HDMI_LOG("lcm_width=%d, lcm_height=%d\n", lcm_width, lcm_height);

    tmpBufferSize = lcm_width * lcm_height *4 * 4;

    temp_va = (unsigned int) vmalloc(tmpBufferSize);
    if (((void*) temp_va) == NULL)
    {
        HDMI_LOG("vmalloc %dbytes fail\n", tmpBufferSize);
        return -1;
    }

    // WDMA1
    if (m4u_alloc_mva(M4U_CLNTMOD_WDMA, 
						temp_va, 
						tmpBufferSize,
						0,
						0,
						&temp_mva_w))
    {
        HDMI_LOG("m4u_alloc_mva for temp_mva_w fail\n");
        return -1;
    }
		m4u_dma_cache_maint(M4U_CLNTMOD_WDMA, 
						temp_va, 
						tmpBufferSize,
						DMA_BIDIRECTIONAL);

	portStruct.ePortID = M4U_PORT_WDMA1;			 //hardware port ID, defined in M4U_PORT_ID_ENUM
	portStruct.Virtuality = 1;							 
	portStruct.Security = 0;
	portStruct.domain = 0;						//domain : 0 1 2 3
	portStruct.Distance = 1;
	portStruct.Direction = 0; 	
	m4u_config_port(&portStruct);

    HDMI_LOG("temp_va=0x%08x, temp_mva_w=0x%08x\n", temp_va, temp_mva_w);

    p->lcm_width = lcm_width;
    p->lcm_height = lcm_height;
    p->output_video_resolution = hdmi_params->init_config.vformat;
    p->output_audio_format = hdmi_params->init_config.aformat;

//#ifdef NEW_HDMI_ARCH
//    hdmi_display_path_overlay_config(true);
//#endif
	DISP_Config_Overlay_to_Memory(temp_mva_w, 1);

    //hdmi_dpi_config_clock(); // configure dpi clock

    //hdmi_dpi_power_switch(false);   // but dpi power is still off
    //hdmi_drv->suspend();

#if 0
    LCD_WaitForNotBusy();
    LCD_SetOutputMode(3); // LCD write to memory and LCM
#endif

    return HDMI_STATUS_OK;
}
Exemple #13
0
static int hdmi_drv_exit(void)
{
    HDMI_FUNC();
    return 0;
}
Exemple #14
0
static int hdmi_drv_enter(void)
{
    HDMI_FUNC();
    return 0;
}