Exemplo n.º 1
0
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn)
{
   if (isDpiPoweredOn) {
      _BackupDPIRegisters();
   } else {
      _ResetBackupedDPIRegisterValues();
   }
   
   DPI_PowerOn();

#if ENABLE_DPI_INTERRUPT
   if (request_irq(MT65XX_DPI_IRQ_ID,
        _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0)
   {
      DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n"); 
      return DPI_STATUS_ERROR;
   }

   {
      DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE;
      enInt.VSYNC = 1;
      OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt));
   }
#endif

   return DPI_STATUS_OK;
}
Exemplo n.º 2
0
static DISP_STATUS dbi_init_old(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
	printf("%s\n", __func__);
    if (!disp_drv_dbi_init_context()) 
        return DISP_STATUS_NOT_IMPLEMENTED;
    init_io_pad();
	init_io_driving_current();
    init_lcd();
		printf("%s, %d\n", __func__, __LINE__);

    if (NULL != lcm_drv->init && !isLcmInited) {
        lcm_drv->init();
    }
		printf("%s, %d\n", __func__, __LINE__);

    init_lcd_te_control();
		// what the hell???
		#if 0
    DPI_PowerOn();
    DPI_PowerOff();
    DSI_PowerOn();
    DSI_PowerOff();
		#endif
		printf("%s, %d\n", __func__, __LINE__);

    return DISP_STATUS_OK;
}
Exemplo n.º 3
0
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn)
{
    //DPI_REG_CNTL cntl;
    //DPI_REG_EMBSYNC_SETTING embsync;

    if (isDpiPoweredOn) {
        DPI_BackupRegisters();
    } else {
        _ResetBackupedDPIRegisterValues();
    }

    DPI_PowerOn();

#if ENABLE_DPI_INTERRUPT
    if (request_irq(MT_DISP_DPI_IRQ_ID,
        _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0)
    {
        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n"); 
        return DPI_STATUS_ERROR;
    }

    {
        DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE;
        enInt.VSYNC = 1;
        OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt));
    }
#endif

   LCD_W2M_NeedLimiteSpeed(TRUE);

   return DPI_STATUS_OK;
}
Exemplo n.º 4
0
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn)
{
    _BackupDPIRegisters();
    DPI_PowerOn();
        
#if 0
    // gpio setting
    OUTREG32(0xf0005000 + 0xCC4, 0x0000000f);
    OUTREG32(0xf0005000 + 0xB18, 0x00000ff0);
    OUTREG32(0xf0005000 + 0xB14, 0x00000660);
    OUTREG32(0xf0005000 + 0xB28, 0x000000ff);
    OUTREG32(0xf0005000 + 0xB24, 0x00000066);
#endif

#if ENABLE_DPI_INTERRUPT
    if (request_irq(MT_DISP_DPI0_IRQ_ID,
        _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0)
    {
        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n");
        return DPI_STATUS_ERROR;
    }

    {
        DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE;
        enInt.VSYNC = 1;
        OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt));
    }
#endif
	///LCD_W2M_NeedLimiteSpeed(TRUE);
    return DPI_STATUS_OK;
}
Exemplo n.º 5
0
static DISP_STATUS dsi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
	if (!disp_drv_dsi_init_context())
		return DISP_STATUS_NOT_IMPLEMENTED;

	if(lcm_params->dsi.mode == CMD_MODE)
	{
		init_dsi(isLcmInited);
		MASKREG32(DSI_BASE + 0x10, 0x2, 0x2);
		if (NULL != lcm_drv->init && !isLcmInited)
		{
			lcm_drv->init();
			DSI_LP_Reset();
		}

		DSI_clk_HS_mode(1);

		DSI_SetMode(lcm_params->dsi.mode);
	}
	else {
        if (!isLcmInited)
        {
	        	//DSI_SetMode(0);
	       	 	//mdelay(100);
	        	//DSI_Stop();
        }
        else
        {
            is_video_mode_running = true;
        }
		
	init_dsi(isLcmInited);

	MASKREG32(DSI_BASE + 0x10, 0x2, 0x2);
	if (NULL != lcm_drv->init && !isLcmInited)
	{
		lcm_drv->init();
		DSI_LP_Reset();
	}

	DSI_SetMode(lcm_params->dsi.mode);
	}

	RDMASetTargetLine(0, lcm_params->height*4/5);

    dsi_config_ddp(fbPA);
	DPI_PowerOn();
	DPI_PowerOff();
#ifdef SPM_SODI_ENABLED
    if(lcm_params->dsi.mode == CMD_MODE)
    {
        spm_sodi_lcm_video_mode(FALSE);
    }
    else
    {
        spm_sodi_lcm_video_mode(TRUE);
    }
#endif
	return DISP_STATUS_OK;
}
Exemplo n.º 6
0
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn)
{
    DPI_REG_CNTL cntl;

    if (isDpiPoweredOn) {
        _BackupDPIRegisters();
    } else {
        _ResetBackupedDPIRegisterValues();
    }

    DPI_PowerOn();
    // Always enable frame shift protection and recovery
    cntl = DPI_REG->CNTL;
    cntl.FS_PROT_EN = 1;
    cntl.FS_RC_EN = 1;

    // Enable adaptive FIFO high/low threshold control
    cntl.ADP_EN = 1;
     
    OUTREG32(&DPI_REG->CNTL, AS_UINT32(&cntl));

    // Config ultra high threshold water mark
    {
        DPI_REG_FIFO_TH th = DPI_REG->FIFO_TH;

        th.LOW = 512;
        th.HIGH = 512;

        OUTREG32(&DPI_REG->FIFO_TH, AS_UINT32(&th));
        DPI_REG->FIFO_INC.FIFO_TH_INC = 8;
		DPI_REG->FIFO_INC.FIFO_TH_DEC = 8;
    }

#if ENABLE_DPI_INTERRUPT
    if (request_irq(MT_DPI_IRQ_ID,
        _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0)
    {
        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n"); 
        return DPI_STATUS_ERROR;
    }
//    init_waitqueue_head(&_vsync_wait_queue_dpi);
    {
        DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE;
        enInt.FIFO_EMPTY = 1;
		enInt.FIFO_FULL = 0;
        enInt.OUT_EMPTY = 0;
		enInt.CNT_OVERFLOW = 0;
        enInt.LINE_ERR = 0;
        enInt.VSYNC = 1;
        OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt));
    }
#endif
#ifndef BUILD_UBOOT
	init_waitqueue_head(&_vsync_wait_queue_dpi);
#endif
    OUTREG32(&DPI_REG->GMC_CNTL, 0x41);
	LCD_W2M_NeedLimiteSpeed(TRUE);
    return DPI_STATUS_OK;
}
Exemplo n.º 7
0
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn)
{
    DPI_REG_CNTL cntl;

    if (isDpiPoweredOn) {
        _BackupDPIRegisters();
//        s_isDpiPowerOn = TRUE;
    } else {
        _ResetBackupedDPIRegisterValues();
//        DPI_PowerOn();
    }
    DPI_PowerOn();

    // Always enable frame shift protection and recovery
    cntl = DPI_REG->CNTL;
    cntl.FS_PROT_EN = 1;
    cntl.FS_RC_EN = 1;

    // Enable adaptive FIFO high/low threshold control
    cntl.ADP_EN = 1;
     
    OUTREG32(&DPI_REG->CNTL, AS_UINT32(&cntl));

    // Config ultra high threshold water mark
    {
        DPI_REG_FIFO_TH th = DPI_REG->FIFO_TH;

        th.LOW = 64;
        th.HIGH = 128;

        OUTREG32(&DPI_REG->FIFO_TH, AS_UINT32(&th));
        DPI_REG->FIFO_INC = 8;
    }

#if ENABLE_DPI_INTERRUPT
    if (request_irq(MT6573_DPI_IRQ_LINE,
        _DPI_InterruptHandler, 0, MTKFB_DRIVER, NULL) < 0)
    {
        printk("[DPI][ERROR] fail to request DPI irq\n"); 
        return DPI_STATUS_ERROR;
    }

    {
        DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE;
        enInt.FIFO_EMPTY = 1;
        enInt.VSYNC = 1;
        OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt));
    }
#endif

    return DPI_STATUS_OK;
}
Exemplo n.º 8
0
static DISP_STATUS dpi_enable_power(BOOL enable)
{
    if (enable) {
        DPI_CHECK_RET(DPI_PowerOn());

        init_mipi_pll();//for MT6573 and later chip, Must re-init mipi pll for dpi, because pll register have located in
		                //MMSYS1 except MT6516
        init_io_pad();
        LCD_CHECK_RET(LCD_PowerOn());
        DPI_CHECK_RET(DPI_EnableClk());
    } else {
        DPI_CHECK_RET(DPI_DisableClk());
        DPI_CHECK_RET(DPI_PowerOff());
        LCD_CHECK_RET(LCD_PowerOff());
        DPI_mipi_switch(false);
    }
    return DISP_STATUS_OK;
}
Exemplo n.º 9
0
static DISP_STATUS dbi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
    if (!disp_drv_dbi_init_context()) 
        return DISP_STATUS_NOT_IMPLEMENTED;
    init_io_pad();
	init_io_driving_current();
    init_lcd();

    if (NULL != lcm_drv->init && !isLcmInited) {
        lcm_drv->init();
    }

    init_lcd_te_control();
    DPI_PowerOn();
    DPI_PowerOff();
    DSI_PowerOn();
    DSI_PowerOff();

    return DISP_STATUS_OK;
}
Exemplo n.º 10
0
DPI_STATUS DPI_Init(BOOL isDpiPoweredOn)
{
    //DPI_REG_CNTL cntl;

    if (isDpiPoweredOn) {
        _BackupDPIRegisters();
    } else {
        _ResetBackupedDPIRegisterValues();
    }

    DPI_PowerOn();
	
    //unsigned int reg_value = 0;

	
	OUTREG32(0x1400f000,0x1);
	OUTREG32(0x1400f000,0x41);
	
	OUTREG32(DPI_BASE+ 0x64, 0x400);//
	OUTREG32(DPI_BASE+ 0x6C, 0x400);//
	OUTREG32(DPI_BASE+ 0x74, 0x400);//
	OUTREG32(DPI_BASE+ 0x8C, 0x0FFF0000);//
	OUTREG32(DPI_BASE+ 0x90, 0x0FFF0000);//
	MASKREG32(DISPSYS_BASE + 0x60, 0x1, 0x1);
#if ENABLE_DPI_INTERRUPT
    if (request_irq(MT6589_DPI_IRQ_ID,
        _DPI_InterruptHandler, IRQF_TRIGGER_LOW, "mtkdpi", NULL) < 0)
    {
        DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "[ERROR] fail to request DPI irq\n"); 
        return DPI_STATUS_ERROR;
    }

    {
        DPI_REG_INTERRUPT enInt = DPI_REG->INT_ENABLE;
        enInt.VSYNC = 1;
        OUTREG32(&DPI_REG->INT_ENABLE, AS_UINT32(&enInt));
    }
#endif
	LCD_W2M_NeedLimiteSpeed(TRUE);
    return DPI_STATUS_OK;
}
Exemplo n.º 11
0
// protected by sem_early_suspend, sem_update_screen
static DISP_STATUS dsi_enable_power(BOOL enable)
{
    disp_drv_dsi_init_context();

    if(lcm_params->dsi.mode == CMD_MODE) {

        if (enable) {
#if 0
            // Switch bus to MIPI TX.
            DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));
            DSI_PHY_clk_switch(1);
            DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
            DSI_CHECK_RET(DSI_PowerOn());
            DSI_WaitForNotBusy();
            DSI_clk_HS_mode(0);
            DSI_clk_ULP_mode(0);
            DSI_lane0_ULP_mode(0);
            DSI_Reset();
            LCD_CHECK_RET(LCD_PowerOn());
#else

            DSI_PHY_clk_switch(1);
            DSI_CHECK_RET(DSI_PowerOn());
            if(Need_Wait_ULPS())
                Wait_ULPS_Mode();

            DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
            DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));

            Wait_WakeUp();

            LCD_CHECK_RET(LCD_PowerOn());

#endif
        } else {
            LCD_CHECK_RET(LCD_PowerOff());
            DSI_clk_HS_mode(0);
            DSI_lane0_ULP_mode(1);
            DSI_clk_ULP_mode(1);
            DSI_CHECK_RET(DSI_PowerOff());
            DSI_PHY_clk_switch(0);
            // Switch bus to GPIO, then power level will be decided by GPIO setting.
            DSI_CHECK_RET(DSI_enable_MIPI_txio(FALSE));
        }
    } else {
#if 0
#ifndef BUILD_UBOOT
        spin_lock(&g_handle_esd_lock);
#endif
#endif
        if (enable) {
#if 0
            // Switch bus to MIPI TX.
            DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));
            DSI_PHY_clk_switch(1);
            DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
            DSI_CHECK_RET(DSI_PowerOn());
            DSI_clk_ULP_mode(0);
            DSI_lane0_ULP_mode(0);
            DSI_clk_HS_mode(0);
            DSI_Reset();
            DPI_CHECK_RET(DPI_PowerOn());
            LCD_CHECK_RET(LCD_PowerOn());
#else
            DSI_PHY_clk_switch(1);
            DSI_CHECK_RET(DSI_PowerOn());
            if(Need_Wait_ULPS())
                Wait_ULPS_Mode();

            DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
            DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));

            Wait_WakeUp();

            DPI_CHECK_RET(DPI_PowerOn());
            LCD_CHECK_RET(LCD_PowerOn());
#endif
        } else {

#ifndef BUILD_UBOOT
            dsi_vdo_streaming = false;

            if(lcm_params->dsi.noncont_clock)
                DSI_set_noncont_clk(false, lcm_params->dsi.noncont_clock_period);

            if(lcm_params->dsi.lcm_int_te_monitor)
                DSI_set_int_TE(false, lcm_params->dsi.lcm_int_te_period);
#endif
            LCD_CHECK_RET(LCD_PowerOff());
            DPI_CHECK_RET(DPI_PowerOff());

            DSI_lane0_ULP_mode(1);
            DSI_clk_ULP_mode(1);
            DSI_CHECK_RET(DSI_PowerOff());

            DSI_PHY_clk_switch(0);
            // Switch bus to GPIO, then power level will be decided by GPIO setting.
            DSI_CHECK_RET(DSI_enable_MIPI_txio(FALSE));
        }
#if 0
#ifndef BUILD_UBOOT
        spin_unlock(&g_handle_esd_lock);
#endif
#endif
    }

    return DISP_STATUS_OK;
}
Exemplo n.º 12
0
static DISP_STATUS dsi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
    if (!disp_drv_dsi_init_context())
        return DISP_STATUS_NOT_IMPLEMENTED;

    if(lcm_params->dsi.mode == CMD_MODE) {

        init_lcd();
        init_dsi(isLcmInited);

        if (NULL != lcm_drv->init && !isLcmInited)
        {
            lcm_drv->init();
        }

        DSI_clk_HS_mode(0);

        DSI_SetMode(lcm_params->dsi.mode);

        DPI_PowerOn();
        DPI_PowerOff();

        init_lcd_te_control();
    }
    else {

#ifndef BUILD_UBOOT
        spin_lock(&g_handle_esd_lock);
#endif

        init_intermediate_buffers(fbPA);

        init_lcd();
        init_dpi(isLcmInited);
        init_dsi(isLcmInited);

        if (NULL != lcm_drv->init && !isLcmInited) {
            lcm_drv->init();
        }

        DSI_SetMode(lcm_params->dsi.mode);

#ifndef BUILD_UBOOT
        if(lcm_params->dsi.lcm_ext_te_monitor)
        {
            dsi_vdo_streaming = false;
            LCD_TE_SetMode(LCD_TE_MODE_VSYNC_ONLY);
            LCD_TE_SetEdgePolarity(LCM_POLARITY_RISING);
            LCD_TE_Enable(FALSE);
        }

        if(lcm_params->dsi.noncont_clock)
            DSI_set_noncont_clk(false, lcm_params->dsi.noncont_clock_period);

        if(lcm_params->dsi.lcm_int_te_monitor)
            DSI_set_int_TE(false, lcm_params->dsi.lcm_int_te_period);

        spin_unlock(&g_handle_esd_lock);
#endif
    }

    return DISP_STATUS_OK;
}
Exemplo n.º 13
0
// protected by sem_early_suspend, sem_update_screen
static DISP_STATUS dsi_enable_power(BOOL enable)
{
    disp_drv_dsi_init_context();
    
    if(lcm_params->dsi.mode == CMD_MODE) {
    
        if (enable) {
            #if 0
                // Switch bus to MIPI TX.
                DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));
                DSI_PHY_clk_switch(TRUE, lcm_params);
                DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
                DSI_CHECK_RET(DSI_PowerOn());
                DSI_WaitForNotBusy();		
                DSI_clk_HS_mode(0);
                DSI_clk_ULP_mode(0);			
                DSI_lane0_ULP_mode(0);	
                DSI_Reset();
                LCD_CHECK_RET(LCD_PowerOn());

            #else
                #ifndef MT65XX_NEW_DISP
                    DSI_PHY_clk_switch(TRUE, lcm_params); 
                    DSI_CHECK_RET(DSI_PowerOn());
                    if(Need_Wait_ULPS())
                        Wait_ULPS_Mode();
                    
                    DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);

                #else
                    // enable MMSYS CG
                    DSI_CHECK_RET(DSI_PowerOn());

                    // initialize clock setting
                    DSI_PHY_clk_setting(lcm_params);
					
					// initialize dsi timing
                    DSI_PHY_TIMCONFIG(lcm_params);

                    // restore dsi register
                    DSI_CHECK_RET(DSI_RestoreRegisters());

                    // enable sleep-out mode
                    DSI_CHECK_RET(DSI_SleepOut());

                    // enter HS mode
                    DSI_PHY_clk_switch(TRUE, lcm_params); 

                    // enter wakeup
                    DSI_CHECK_RET(DSI_Wakeup());

                    // enable clock
                    DSI_CHECK_RET(DSI_EnableClk());

                    // engine reset
                    DSI_Reset();
                #endif
                DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));
                
                #ifndef MT65XX_NEW_DISP
                    Wait_WakeUp();
                #endif
            
            #endif
        }
        else {
            // backup dsi register
            DSI_CHECK_RET(DSI_WaitForEngineNotBusy());
            DSI_CHECK_RET(DSI_BackupRegisters());

            // enter ULPS mode
            DSI_clk_ULP_mode(1);
            DSI_lane0_ULP_mode(1);
            mdelay(1);
            
            // disable engine clock
            DSI_CHECK_RET(DSI_DisableClk());
            
            // disable CG
            DSI_CHECK_RET(DSI_PowerOff());

            // disable mipi pll
            DSI_PHY_clk_switch(FALSE, lcm_params);

            // Switch bus to GPIO, then power level will be decided by GPIO setting.
            DSI_CHECK_RET(DSI_enable_MIPI_txio(FALSE));
        }
    } 
    else {
        if (enable) {
            #if 0
                // Switch bus to MIPI TX.
                DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));
                DSI_PHY_clk_switch(TRUE, lcm_params);
                DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
                DSI_CHECK_RET(DSI_PowerOn());			
                DSI_clk_ULP_mode(0);			
                DSI_lane0_ULP_mode(0);
                DSI_clk_HS_mode(0);	
                DSI_Reset();
                DPI_CHECK_RET(DPI_PowerOn());
                LCD_CHECK_RET(LCD_PowerOn());
            #else
                #ifndef MT65XX_NEW_DISP
                    DSI_PHY_clk_switch(TRUE, lcm_params); 
                    DSI_CHECK_RET(DSI_PowerOn());
                    if(Need_Wait_ULPS())
                        Wait_ULPS_Mode();
                    
                    DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
                #else
                    needStartDSI = true;

                    // enable MMSYS CG
                    DSI_CHECK_RET(DSI_PowerOn());

                    // initialize clock setting
                    DSI_PHY_clk_setting(lcm_params);
					
					// initialize dsi timing
                    DSI_PHY_TIMCONFIG(lcm_params);

                    // restore dsi register
                    DSI_CHECK_RET(DSI_RestoreRegisters());

                    // enable sleep-out mode
                    DSI_CHECK_RET(DSI_SleepOut());
                    
                    // enter HS mode
                    DSI_PHY_clk_switch(TRUE, lcm_params); 

                    // enter wakeup
                    DSI_CHECK_RET(DSI_Wakeup());

                    // enable clock
                    DSI_CHECK_RET(DSI_EnableClk());

                    // engine reset
                    DSI_Reset();

                #endif
                DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));
                
                #ifndef MT65XX_NEW_DISP
                    Wait_WakeUp();
                #endif
            #endif
        }
        else {
            #ifndef BUILD_UBOOT
                is_video_mode_running = false;
                
                if(lcm_params->dsi.noncont_clock)
                    DSI_set_noncont_clk(false, lcm_params->dsi.noncont_clock_period);
                
                if(lcm_params->dsi.lcm_int_te_monitor)
                    DSI_set_int_TE(false, lcm_params->dsi.lcm_int_te_period);
            #endif

            // backup dsi register
            DSI_CHECK_RET(DSI_WaitForEngineNotBusy());
            DSI_CHECK_RET(DSI_BackupRegisters());

            // enter ULPS mode
            DSI_clk_ULP_mode(1);
            DSI_lane0_ULP_mode(1);
            mdelay(1);

            // disable engine clock
            DSI_CHECK_RET(DSI_DisableClk());

            // disable CG
            DSI_CHECK_RET(DSI_PowerOff());

            // disable mipi pll
            DSI_PHY_clk_switch(FALSE, lcm_params);

            // Switch bus to GPIO, then power level will be decided by GPIO setting.
            DSI_CHECK_RET(DSI_enable_MIPI_txio(FALSE));
        }
    }
    
    return DISP_STATUS_OK;
}
Exemplo n.º 14
0
static void process_dbg_opt(const char *opt)
{
    if (0 == strncmp(opt, "hdmion", 6))
    {
	hdmi_force_init();
    }
    else if (0 == strncmp(opt, "fps:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            dbg_opt.en_fps_log = 1;
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            dbg_opt.en_fps_log = 0;
        } else {
            goto Error;
        }
        reset_fps_logger();
    }
    else if (0 == strncmp(opt, "tl:", 3))
    {
        if (0 == strncmp(opt + 3, "on", 2)) {
            dbg_opt.en_touch_latency_log = 1;
        } else if (0 == strncmp(opt + 3, "off", 3)) {
            dbg_opt.en_touch_latency_log = 0;
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "black", 5))
    {
	mtkfb_clear_lcm();
    }
    else if (0 == strncmp(opt, "suspend", 4))
    {
        DISP_PanelEnable(FALSE);
        DISP_PowerEnable(FALSE);
    }
    else if (0 == strncmp(opt, "resume", 4))
    {
        DISP_PowerEnable(TRUE);
        DISP_PanelEnable(TRUE);
    }
    else if (0 == strncmp(opt, "lcm:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DISP_PanelEnable(TRUE);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DISP_PanelEnable(FALSE);
        }
		else if (0 == strncmp(opt + 4, "init", 4)) {
			if (NULL != lcm_drv && NULL != lcm_drv->init) {
        		lcm_drv->init();
    		}
        }else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "cabc:", 5))
    {
        if (0 == strncmp(opt + 5, "ui", 2)) {
			mtkfb_set_backlight_mode(1);
        }else if (0 == strncmp(opt + 5, "mov", 3)) {
			mtkfb_set_backlight_mode(3);
        }else if (0 == strncmp(opt + 5, "still", 5)) {
			mtkfb_set_backlight_mode(2);
        }else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "lcd:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DISP_PowerEnable(TRUE);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DISP_PowerEnable(FALSE);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dbi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            LCD_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            LCD_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dpi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DPI_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DPI_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dsi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DSI_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DSI_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "te:", 3))
    {
        if (0 == strncmp(opt + 3, "on", 2)) {
            LCD_TE_Enable(TRUE);
			DSI_TE_Enable(TRUE);
        } else if (0 == strncmp(opt + 3, "off", 3)) {
            LCD_TE_Enable(FALSE);
			DSI_TE_Enable(FALSE);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "vsynclog:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2))
        {
            EnableVSyncLog = 1;
        } else if (0 == strncmp(opt + 9, "off", 3)) 
        {
            EnableVSyncLog = 0;
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "layer", 5))
    {
        dump_lcd_layer_info();
    }
    else if (0 == strncmp(opt, "reg:", 4))
    {
        if (0 == strncmp(opt + 4, "lcd", 3)) {
            LCD_DumpRegisters();
        }else if (0 == strncmp(opt + 4, "dpi1", 4)) {
            DPI1_DumpRegisters();
        }else if (0 == strncmp(opt + 4, "dpi", 3)) {
            DPI_DumpRegisters();
        } else if (0 == strncmp(opt + 4, "dsi", 3)) {
            DSI_DumpRegisters();
#if defined(MTK_TVOUT_SUPPORT)
        } else if (0 == strncmp(opt + 4, "tvc", 3)) {
            TVC_DumpRegisters();
        } else if (0 == strncmp(opt + 4, "tve", 3)) {
            TVE_DumpRegisters();
        } else if (0 == strncmp(opt + 4, "tvr", 3)) {
            TVR_DumpRegisters();
#endif		
        } else {
            goto Error;
        }
    }

#if defined(MTK_TVOUT_SUPPORT)
    else if (0 == strncmp(opt, "tv:", 3))
    {
        if (0 == strncmp(opt + 3, "on", 2)) {
            TVOUT_TvCablePlugIn();
        } else if (0 == strncmp(opt +3, "off", 3)) {
            TVOUT_TvCablePlugOut();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvforce:", 8))
    {
        if (0 == strncmp(opt + 8, "on", 2)) {
            TVOUT_TvCablePlugIn_Directly();
        } else if (0 == strncmp(opt +8, "off", 3)) {
            TVOUT_TvCablePlugOut_Directly();
        } else {
            goto Error;
        }
    }
	else if (0 == strncmp(opt, "tvsys:", 6))
    {
        if (0 == strncmp(opt + 6, "ntsc", 4)) {
            TVOUT_SetTvSystem(TVOUT_SYSTEM_NTSC);
        } else if (0 == strncmp(opt + 6, "pal", 3)) {
            TVOUT_SetTvSystem(TVOUT_SYSTEM_PAL);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvrot:", 6))
    {
        if (0 == strncmp(opt + 6, "on", 2)) {
            TVOUT_SetOrientation(TVOUT_ROT_270);
        } else if (0 == strncmp(opt + 6, "off", 3)) {
            TVOUT_SetOrientation(TVOUT_ROT_0);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvcb:", 5))
    {
        if (0 == strncmp(opt + 5, "on", 2)) {
            TVOUT_EnableColorBar(TRUE);
        } else if (0 == strncmp(opt + 5, "off", 3)) {
            TVOUT_EnableColorBar(FALSE);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvvm:", 5))
    {
        if (0 == strncmp(opt + 5, "on", 2)) {
            TVOUT_DisableVideoMode(false);
        } else if (0 == strncmp(opt + 5, "off", 3)) {
            TVOUT_DisableVideoMode(true);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvlog:", 6))
    {
        if (0 == strncmp(opt + 6, "on", 2)) {
            TVOUT_EnableLog(true);
        } else if (0 == strncmp(opt + 6, "off", 3)) {
            TVOUT_EnableLog(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvtime:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            TVOUT_EnableTimeProfiling(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            TVOUT_EnableTimeProfiling(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvcap:", 6))
    {
        if (0 == strncmp(opt + 6, "on", 2)) {
            capture_tv_buffer = true;
        } else if (0 == strncmp(opt + 6, "off", 3)) {
            capture_tv_buffer = false;
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvcam:", 6))
    {
        if (0 == strncmp(opt + 6, "on", 2)) {
            TVOUT_ForceClose();
        } else if (0 == strncmp(opt + 6, "off", 3)) {
            TVOUT_RestoreOpen();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvuser:"******"on", 2)) {
            TVOUT_TurnOn(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            TVOUT_TurnOn(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "tvcoffset:", 10))
    {
        char *p = (char *)opt + 10;
        unsigned long offset = simple_strtoul(p, &p, 10);
        TVC_SetCheckLineOffset(offset);
    }
#endif
    else if (0 == strncmp(opt, "regw:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned long addr = simple_strtoul(p, &p, 16);
        unsigned long val  = simple_strtoul(p + 1, &p, 16);

        if (addr) {
            OUTREG32(addr, val);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "regr:", 5))
    {
        char *p = (char *)opt + 5;
        unsigned int addr = (unsigned int) simple_strtoul(p, &p, 16);

        if (addr) {
            DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "Read register 0x%08x: 0x%08x\n", addr, INREG32(addr));
        } else {
            goto Error;
        }
    }
	else if(0 == strncmp(opt, "bkl:", 4))
	{
		char *p = (char *)opt + 4;
		unsigned int level = (unsigned int) simple_strtoul(p, &p, 10);
		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "process_dbg_opt(), set backlight level = %d\n", level);
		DISP_SetBacklight(level);
	}
	else if(0 == strncmp(opt, "dither:", 7))
	{
		unsigned lrs, lgs, lbs, dbr, dbg, dbb;
		char *p = (char *)opt + 7;
		lrs = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		lgs = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		lbs = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		dbr = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		dbg = (unsigned int) simple_strtoul(p, &p, 16);
		p++;
		dbb = (unsigned int) simple_strtoul(p, &p, 16);

		DISP_LOG_PRINT(ANDROID_LOG_INFO, "DBG", "process_dbg_opt(), %d %d %d %d %d %d\n", lrs, lgs, lbs, dbr, dbg, dbb);
#if 0 //defined(CONFIG_ARCH_MT6573)
		LCD_WaitForNotBusy();
		LCD_ConfigDither(lrs, lgs, lbs, dbr, dbg, dbb);
		LCD_StartTransfer(true);
#endif
	}
    else if (0 == strncmp(opt, "mtkfblog:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2)) {
            mtkfb_log_enable(true);
        } else if (0 == strncmp(opt + 9, "off", 3)) {
            mtkfb_log_enable(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "displog:", 8))
    {
        if (0 == strncmp(opt + 8, "on", 2)) {
            disp_log_enable(true);
        } else if (0 == strncmp(opt + 8, "off", 3)) {
            disp_log_enable(false);
        } else {
            goto Error;
        }
    }

    else if (0 == strncmp(opt, "lcdlog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            dbi_log_enable(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            dbi_log_enable(false);
        } else {
            goto Error;
        }
    }

	else if (0 == strncmp(opt, "dsilog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            DSI_Enable_Log(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            DSI_Enable_Log(false);
        } else {
            goto Error;
        }
    }

	else if (0 == strncmp(opt, "glitchlog:", 10))
    {
        if (0 == strncmp(opt + 10, "on", 2)) {
            Glitch_Enable_Log(true);
        } else if (0 == strncmp(opt + 10, "off", 3)) {
            Glitch_Enable_Log(false);
        } else {
            goto Error;
        }
    }
	
	else if(0 == strncmp(opt, "glitch_times:", 13))
	{
		char *p = (char *)opt + 13;
		unsigned int level = (unsigned int) simple_strtoul(p, &p, 10);
		Glitch_times(level);
	}
	else if (0 == strncmp(opt, "mtkfb_vsynclog:", 15))
    {
        if (0 == strncmp(opt + 15, "on", 2)) {
            mtkfb_vsync_log_enable(true);
        } else if (0 == strncmp(opt + 15, "off", 3)) {
            mtkfb_vsync_log_enable(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dpilog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            //dpi_log_enable(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            //dpi_log_enable(false);
        } else {
            goto Error;
        }
    }

    else if (0 == strncmp(opt, "log:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
			mtkfb_log_enable(true);
			disp_log_enable(true);

			dbi_log_enable(true);

            //dpi_log_enable(true);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            mtkfb_log_enable(false);
			disp_log_enable(false);

			dbi_log_enable(false);

			//dpi_log_enable(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "update", 6))
    {
		DISP_UpdateScreen(0, 0, DISP_GetScreenWidth(), DISP_GetScreenHeight());
    }
    else if (0 == strncmp(opt, "pan_disp", 8))
    {
		mtkfb_pan_disp_test();
    }
    else if (0 == strncmp(opt, "sem_cnt", 7))
    {
		mtkfb_show_sem_cnt();
		LCD_GetVsyncCnt();
    }
    else if (0 == strncmp(opt, "hang:", 5))
    {
        if (0 == strncmp(opt + 5, "on", 2)) {
            mtkfb_hang_test(true);
        } else if (0 == strncmp(opt + 5, "off", 3)) {
            mtkfb_hang_test(false);
        } else{
            goto Error;
        }
	}
 #if defined(MTK_M4U_SUPPORT)
    else if (0 == strncmp(opt, "m4u:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            mtkfb_m4u_switch(true);
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            mtkfb_m4u_switch(false);
        } else if (0 == strncmp(opt + 4, "dump", 4)) {
            mtkfb_m4u_dump();
        } else{
            goto Error;
        }
	}
#endif
    else if (0 == strncmp(opt, "cpfbonly:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2))
        {
            mtkfb_capture_fb_only(true);
        }
        else if (0 == strncmp(opt + 9, "off", 3))
        {
            mtkfb_capture_fb_only(false);
        }
    }
    else if (0 == strncmp(opt, "esd:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2))
        {
            esd_recovery_pause(FALSE);
        }
        else if (0 == strncmp(opt + 4, "off", 3))
        {
            esd_recovery_pause(TRUE);
        }
    }
    else if (0 == strncmp(opt, "HQA:", 4))
    {
        if (0 == strncmp(opt + 4, "NormalToFactory", 15))
        {
            mtkfb_switch_normal_to_factory();
        }
        else if (0 == strncmp(opt + 4, "FactoryToNormal", 15))
        {
            mtkfb_switch_factory_to_normal();
        }
    }
    else if (0 == strncmp(opt, "mmp", 3))
    {
        init_mtkfb_mmp_events();
    }
    else if (0 == strncmp(opt, "dump_layer:", 11))
    {
        if (0 == strncmp(opt + 11, "on", 2))
        {
            char *p = (char *)opt + 14;
            gCaptureLayerDownX = simple_strtoul(p, &p, 10);
            gCaptureLayerDownY = simple_strtoul(p+1, &p, 10);
            gCaptureLayerEnable = 1;
        }
        else if (0 == strncmp(opt + 11, "off", 3))
        {
            gCaptureLayerEnable = 0;
        }
    }
    else if (0 == strncmp(opt, "dump_ovl:", 9))
    {
        if (0 == strncmp(opt + 9, "on", 2))
        {
            char *p = (char *)opt + 12;
            gCaptureOvlDownX = simple_strtoul(p, &p, 10);
            gCaptureOvlDownY = simple_strtoul(p+1, &p, 10);
            gCaptureOvlThreadEnable = 1;
			wake_up_process(captureovl_task);
        }
        else if (0 == strncmp(opt + 9, "off", 3))
        {
            gCaptureOvlThreadEnable = 0;
        }
    }
    else if (0 == strncmp(opt, "dump_fb:", 8))
    {
        if (0 == strncmp(opt + 8, "on", 2))
        {
            char *p = (char *)opt + 11;
            gCaptureFBDownX = simple_strtoul(p, &p, 10);
            gCaptureFBDownY = simple_strtoul(p+1, &p, 10);
            gCaptureFBPeriod = simple_strtoul(p+1, &p, 10);
            gCaptureFBEnable = 1;
			wake_up_interruptible(&gCaptureFBWQ);
        }
        else if (0 == strncmp(opt + 8, "off", 3))
        {
            gCaptureFBEnable = 0;
        }   
    }
    else
	{
		goto Error;
	}

    return;

Error:
    DISP_LOG_PRINT(ANDROID_LOG_INFO, "ERROR", "parse command error!\n\n%s", STR_HELP);
}
Exemplo n.º 15
0
// protected by sem_early_suspend, sem_update_screen
static DISP_STATUS dsi_enable_power(BOOL enable)
{
	disp_drv_dsi_init_context();
	
	if(lcm_params->dsi.mode == CMD_MODE) {

		if (enable) {
#if 0
			// Switch bus to MIPI TX.
			DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));
			DSI_PHY_clk_switch(1);
			DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
			DSI_CHECK_RET(DSI_PowerOn());
			DSI_WaitForNotBusy();		
			DSI_clk_HS_mode(0);
			DSI_clk_ULP_mode(0);			
			DSI_lane0_ULP_mode(0);	
			DSI_Reset();
			LCD_CHECK_RET(LCD_PowerOn());
#else

			DSI_PHY_clk_switch(1); 
#ifndef MT65XX_NEW_DISP
			DSI_CHECK_RET(DSI_PowerOn());
			if(Need_Wait_ULPS())
				Wait_ULPS_Mode();
			
			DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
#else	
			if(lcm_params->dsi.pll_select == 1)
			{
					ASSERT(0 == enable_pll(LVDSPLL,"mtk_dsi"));
  		  }
			DSI_PHY_clk_setting(lcm_params);
			DSI_CHECK_RET(DSI_PowerOn());
			DSI_clk_ULP_mode(0);			
			DSI_lane0_ULP_mode(0);
//			DSI_clk_HS_mode(1);	
#endif
			DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));

#ifndef MT65XX_NEW_DISP
			Wait_WakeUp();
			LCD_CHECK_RET(LCD_PowerOn());		
#endif

#endif
		} else {
#ifndef MT65XX_NEW_DISP
			LCD_CHECK_RET(LCD_PowerOff());
#endif
			DSI_clk_HS_mode(0);
			DSI_lane0_ULP_mode(1);
			DSI_clk_ULP_mode(1);
//			DSI_CHECK_RET(DSI_PowerOff());
			DSI_PHY_clk_switch(0);
			DSI_CHECK_RET(DSI_PowerOff());
			// Switch bus to GPIO, then power level will be decided by GPIO setting.
			DSI_CHECK_RET(DSI_enable_MIPI_txio(FALSE));
			if(lcm_params->dsi.pll_select == 1)
				ASSERT(0 == disable_pll(LVDSPLL,"mtk_dsi"));
		}
	} else {
	    if (enable) {
#if 0
			// Switch bus to MIPI TX.
			DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));
			DSI_PHY_clk_switch(1);
			DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
			DSI_CHECK_RET(DSI_PowerOn());			
			DSI_clk_ULP_mode(0);			
			DSI_lane0_ULP_mode(0);
			DSI_clk_HS_mode(0);	
			DSI_Reset();
			DPI_CHECK_RET(DPI_PowerOn());
			LCD_CHECK_RET(LCD_PowerOn());
#else
			DSI_PHY_clk_switch(1); 
#ifndef MT65XX_NEW_DISP
			DSI_CHECK_RET(DSI_PowerOn());
			if(Need_Wait_ULPS())
				Wait_ULPS_Mode();
			
			DSI_PHY_clk_setting(lcm_params->dsi.pll_div1, lcm_params->dsi.pll_div2, lcm_params->dsi.LANE_NUM);
#else
			needStartDSI = true;
			if(lcm_params->dsi.pll_select == 1)
			{
					ASSERT(0 == enable_pll(LVDSPLL,"mtk_dsi"));
			}
			DSI_PHY_clk_setting(lcm_params);
			DSI_CHECK_RET(DSI_PowerOn());
			DSI_clk_ULP_mode(0);			
			DSI_lane0_ULP_mode(0);
			DSI_clk_HS_mode(0);	
#endif
			DSI_CHECK_RET(DSI_enable_MIPI_txio(TRUE));

#ifndef MT65XX_NEW_DISP
			Wait_WakeUp();
			DPI_CHECK_RET(DPI_PowerOn());
			LCD_CHECK_RET(LCD_PowerOn());		
#endif
#endif
	    } else {
#ifndef BUILD_UBOOT
			is_video_mode_running = false;
#ifndef MT65XX_NEW_DISP
			if(lcm_params->dsi.noncont_clock)
				DSI_set_noncont_clk(false, lcm_params->dsi.noncont_clock_period);
			
			if(lcm_params->dsi.lcm_int_te_monitor)
				DSI_set_int_TE(false, lcm_params->dsi.lcm_int_te_period);
#endif
#endif
#ifndef MT65XX_NEW_DISP
			LCD_CHECK_RET(LCD_PowerOff());		
			DPI_CHECK_RET(DPI_PowerOff());
#endif
#if 1
			DSI_lane0_ULP_mode(1);
			DSI_clk_ULP_mode(1);	
			DSI_CHECK_RET(DSI_PowerOff());
#endif			
			DSI_PHY_clk_switch(0);
			// Switch bus to GPIO, then power level will be decided by GPIO setting.
			DSI_CHECK_RET(DSI_enable_MIPI_txio(FALSE));
			if(lcm_params->dsi.pll_select == 1)
				ASSERT(0 == disable_pll(LVDSPLL,"mtk_dsi"));
	    }
	}

    return DISP_STATUS_OK;
}
Exemplo n.º 16
0
static DISP_STATUS dsi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
	if (!disp_drv_dsi_init_context()) 
		return DISP_STATUS_NOT_IMPLEMENTED;

	if(lcm_params->dsi.mode == CMD_MODE) {
#ifndef MT65XX_NEW_DISP
		init_lcd();
#endif
		init_dsi(isLcmInited);

		if (NULL != lcm_drv->init && !isLcmInited) 
		{
			lcm_drv->init();
			DSI_LP_Reset();
		}
#ifndef MT65XX_NEW_DISP
		DSI_clk_HS_mode(0);
#else
		DSI_clk_HS_mode(1);
#endif
		DSI_SetMode(lcm_params->dsi.mode);
#ifndef MT65XX_NEW_DISP
		DPI_PowerOn();
		DPI_PowerOff();

		init_lcd_te_control();
#endif
	}
	else {
#ifndef MT65XX_NEW_DISP
		init_intermediate_buffers(fbPA);

	    init_lcd();
		init_dpi(isLcmInited);
#endif
        if (!isLcmInited)
        {
        DSI_SetMode(0);
        mdelay(100);
        DSI_DisableClk();
        }
        else
        {
            is_video_mode_running = true;
        }
		init_dsi(isLcmInited);

		if (NULL != lcm_drv->init && !isLcmInited) {
			lcm_drv->init();
			DSI_LP_Reset();
		}

		DSI_SetMode(lcm_params->dsi.mode);

#ifndef BUILD_UBOOT	
#ifndef MT65XX_NEW_DISP
		if(lcm_params->dsi.lcm_ext_te_monitor)
		{
			is_video_mode_running = false;
			LCD_TE_SetMode(LCD_TE_MODE_VSYNC_ONLY);
			LCD_TE_SetEdgePolarity(LCM_POLARITY_RISING);
			LCD_TE_Enable(FALSE);
		}

		if(lcm_params->dsi.noncont_clock)
			DSI_set_noncont_clk(false, lcm_params->dsi.noncont_clock_period);

		if(lcm_params->dsi.lcm_int_te_monitor)
			DSI_set_int_TE(false, lcm_params->dsi.lcm_int_te_period);			
#endif
#endif			
	}
#ifdef MT65XX_NEW_DISP
		{
			struct disp_path_config_struct config = {0};
			config.srcModule = DISP_MODULE_OVL;
				config.bgROI.x = 0;
				config.bgROI.y = 0;
				config.bgROI.width = DISP_GetScreenWidth();
				config.bgROI.height = DISP_GetScreenHeight();
				config.bgColor = 0x0;	// background color
	
				config.pitch = DISP_GetScreenWidth()*2;
				config.srcROI.x = 0;config.srcROI.y = 0;
				config.srcROI.height= DISP_GetScreenHeight();config.srcROI.width= DISP_GetScreenWidth();
				config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
	
        if(lcm_params->dsi.mode != CMD_MODE)
        {
            config.ovl_config.layer = FB_LAYER;
            config.ovl_config.layer_en = 0;
            disp_path_get_mutex();
            disp_path_config_layer(&config.ovl_config);
            disp_path_release_mutex();
            disp_path_wait_reg_update();
        }
        // Config FB_Layer port to be physical.
        {
            M4U_PORT_STRUCT portStruct;
            portStruct.ePortID = M4U_PORT_OVL_CH3;		   //hardware port ID, defined in M4U_PORT_ID_ENUM
            portStruct.Virtuality = 1;
            portStruct.Security = 0;
            portStruct.domain = 3;			  //domain : 0 1 2 3
            portStruct.Distance = 1;
            portStruct.Direction = 0;
            m4u_config_port(&portStruct);
        }
        config.ovl_config.layer = FB_LAYER;
        config.ovl_config.layer_en = 1; 
        config.ovl_config.fmt = OVL_INPUT_FORMAT_RGB565;
        config.ovl_config.addr = fbPA;	
        config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
        config.ovl_config.src_x = 0;
        config.ovl_config.src_y = 0;
        config.ovl_config.dst_x = 0;	   // ROI
        config.ovl_config.dst_y = 0;
        config.ovl_config.dst_w = DISP_GetScreenWidth();
        config.ovl_config.dst_h = DISP_GetScreenHeight();
        config.ovl_config.src_pitch = ALIGN_TO(DISP_GetScreenWidth(),32)*2; //pixel number
        config.ovl_config.keyEn = 0;
        config.ovl_config.key = 0xFF;	   // color key
        config.ovl_config.aen = 0;			  // alpha enable
        config.ovl_config.alpha = 0;	

        LCD_LayerSetAddress(FB_LAYER, fbPA);
        LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565);
        LCD_LayerSetOffset(FB_LAYER, 0, 0);
        LCD_LayerSetSize(FB_LAYER,DISP_GetScreenWidth(),DISP_GetScreenHeight());
        LCD_LayerSetPitch(FB_LAYER, ALIGN_TO(DISP_GetScreenWidth(),32) * 2);
        LCD_LayerEnable(FB_LAYER, TRUE);                    
        if(lcm_params->dsi.mode == CMD_MODE)
            config.dstModule = DISP_MODULE_DSI_CMD;// DISP_MODULE_WDMA1
        else
            config.dstModule = DISP_MODULE_DSI_VDO;// DISP_MODULE_WDMA1
        config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; 
        if(lcm_params->dsi.mode != CMD_MODE)
            disp_path_get_mutex();

        disp_path_config(&config);

        if(lcm_params->dsi.mode != CMD_MODE)
            disp_path_release_mutex();

        // Disable LK UI layer (Layer2)
        if(lcm_params->dsi.mode != CMD_MODE)
        {
            config.ovl_config.layer = FB_LAYER-1;
            config.ovl_config.layer_en = 0;
            disp_path_get_mutex();
            disp_path_config_layer(&config.ovl_config);
            disp_path_release_mutex();
            disp_path_wait_reg_update();
        }

        // Config LK UI layer port to be physical.
        {
            M4U_PORT_STRUCT portStruct;
            portStruct.ePortID = M4U_PORT_OVL_CH2;		   //hardware port ID, defined in M4U_PORT_ID_ENUM
            portStruct.Virtuality = 1;
            portStruct.Security = 0;
            portStruct.domain = 3;			  //domain : 0 1 2 3
            portStruct.Distance = 1;
            portStruct.Direction = 0;
            m4u_config_port(&portStruct);
        }
		}
#endif

	return DISP_STATUS_OK;
}
Exemplo n.º 17
0
DPI_STATUS DPI_Capture_Framebuffer(unsigned int pvbuf, unsigned int bpp)
{
    unsigned int i = 0;
    unsigned char *fbv;
    unsigned int fbsize = 0;
    unsigned int dpi_fb_bpp = 0;
    unsigned int w,h;

	if(s_isDpiPowerOn == false)
	{
		DPI_PowerOn();
	}

    if(pvbuf == 0 || bpp == 0)
    {
        printk("DPI_Capture_Framebuffer, ERROR, parameters wrong: pvbuf=0x%08x, bpp=%d\n", pvbuf, bpp);
        return DPI_STATUS_OK;
    }

    if(DPI_FBGetFormat() == DPI_FB_FORMAT_RGB565)
    {
        dpi_fb_bpp = 16;
    }
    else if(DPI_FBGetFormat() == DPI_FB_FORMAT_RGB888)
    {
        dpi_fb_bpp = 24;
    }
    else
    {
        printk("DPI_Capture_Framebuffer, ERROR, dpi_fb_bpp is wrong: %d\n", dpi_fb_bpp);
        return DPI_STATUS_OK;
    }

    w = DISP_GetScreenWidth();
    h = DISP_GetScreenHeight();
    fbsize = w*h*dpi_fb_bpp/8;

    fbv = (unsigned char*)ioremap_cached((unsigned int)DPI_REG->FB[DPI_GetCurrentFB()].ADDR, fbsize);
 
    printk("current fb count is %d\n", DPI_GetCurrentFB());

    if(bpp == 32 && dpi_fb_bpp == 24)
    {
    	for(i = 0;i < w*h; i++)
    	{
            *(unsigned int*)(pvbuf+i*4) = 0xff000000|fbv[i*3]|(fbv[i*3+1]<<8)|(fbv[i*3+2]<<16);
    	}
    }
    else if(bpp == 32 && dpi_fb_bpp == 16)
    {
        unsigned int t;
	unsigned short* fbvt = (unsigned short*)fbv;
        for(i = 0;i < w*h; i++)
    	{
	    t = fbvt[i];
            *(unsigned int*)(pvbuf+i*4) = 0xff000000|((t&0x001F)<<3)|((t&0x07E0)<<5)|((t&0xF800)<<8);
    	}
    }
    else if(bpp == 16 && dpi_fb_bpp == 16)
    {
    	memcpy((void*)pvbuf, (void*)fbv, fbsize);
    }
    else if(bpp == 16 && dpi_fb_bpp == 24)
    {
    	for(i = 0;i < w*h; i++)
    	{
            *(unsigned short*)(pvbuf+i*2) = ((fbv[i*3+0]&0x1F)>>3)|
	                                    ((fbv[i*3+1]&0xFC)<<3)|
					    ((fbv[i*3+2]&0x1F)<<8);
    	}
    }
    else
    {
int disphal_process_dbg_opt(const char *opt)
{
    if (0 == strncmp(opt, "dbi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            LCD_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            LCD_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dpi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DPI_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DPI_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dsi:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2)) {
            DSI_PowerOn();
        } else if (0 == strncmp(opt + 4, "off", 3)) {
            DSI_PowerOff();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "te:", 3))
    {
        if (0 == strncmp(opt + 3, "on", 2)) {
            if (DSI_Get_EXT_TE())
            {
                //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "EXT TE is enabled, can not enable BTA TE now\n");
            }
            else
            {
                //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "Before: BTA_TE = %d, EXT_TE = %d\n", DSI_Get_BTA_TE(),DSI_Get_EXT_TE());
				LCD_TE_Enable(TRUE);
				DSI_TE_Enable(TRUE);
				//DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "After : BTA_TE = %d, EXT_TE = %d\n", DSI_Get_BTA_TE(),DSI_Get_EXT_TE());

            }
        } else if (0 == strncmp(opt + 3, "off", 3)) {

            //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "Before: BTA_TE = %d, EXT_TE = %d\n", DSI_Get_BTA_TE(),DSI_Get_EXT_TE());
			LCD_TE_Enable(FALSE);
            DSI_TE_Enable(FALSE);
            //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "After : BTA_TE = %d, EXT_TE = %d\n", DSI_Get_BTA_TE(),DSI_Get_EXT_TE());

        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "te_ext:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            if (DSI_Get_BTA_TE())
            {
                //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "BTA TE is enabled, can not enable EXT TE now\n");
            }
            else
            {
                //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "Before: BTA_TE = %d, EXT_TE = %d\n", DSI_Get_BTA_TE(),DSI_Get_EXT_TE());
                LCD_TE_Enable(TRUE);
                DSI_TE_EXT_Enable(TRUE);
                //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "After : BTA_TE = %d, EXT_TE = %d\n", DSI_Get_BTA_TE(),DSI_Get_EXT_TE());
            }
        } else if (0 == strncmp(opt + 7, "off", 3)) {

            //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "Before: BTA_TE = %d, EXT_TE = %d\n", DSI_Get_BTA_TE(),DSI_Get_EXT_TE());
            LCD_TE_Enable(FALSE);
            DSI_TE_EXT_Enable(FALSE);
            //DISP_LOG_PRINT(ANDROID_LOG_INFO, "DSI", "After : BTA_TE = %d, EXT_TE = %d\n", DSI_Get_BTA_TE(),DSI_Get_EXT_TE());

        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "reg:", 4))
    {
        if (0 == strncmp(opt + 4, "dpi", 3)) {
            DPI_DumpRegisters();
        } else if (0 == strncmp(opt + 4, "dsi", 3)) {
            DSI_DumpRegisters();
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "lcdlog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            dbi_log_enable(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            dbi_log_enable(false);
        } else {
            goto Error;
        }
    }
	else if (0 == strncmp(opt, "dsilog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            DSI_Enable_Log(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            DSI_Enable_Log(false);
        } else {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "dpilog:", 7))
    {
        if (0 == strncmp(opt + 7, "on", 2)) {
            //dpi_log_enable(true);
        } else if (0 == strncmp(opt + 7, "off", 3)) {
            //dpi_log_enable(false);
        } else {
            goto Error;
        }
    }
    else
        goto Error;
    return 0;
Error:
    return -1;
}
Exemplo n.º 19
0
static DISP_STATUS dbi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
    if (!disp_drv_dbi_init_context()) 
        return DISP_STATUS_NOT_IMPLEMENTED;
//#if 0
//#ifdef MT65XX_NEW_DISP
#if 1
		{
			struct disp_path_config_struct config = {0};
	
			config.srcModule = DISP_MODULE_OVL;
	
			if(config.srcModule == DISP_MODULE_RDMA0)
			{
				config.inFormat = RDMA_INPUT_FORMAT_RGB565;
				config.addr = fbPA; 
				config.pitch = DISP_GetScreenWidth()*2;
				config.srcROI.x = 0;config.srcROI.y = 0;
				config.srcROI.height= DISP_GetScreenHeight();config.srcROI.width= DISP_GetScreenWidth();
			}
			else
			{			
				config.bgROI.x = 0;
				config.bgROI.y = 0;
				config.bgROI.width = DISP_GetScreenWidth();
				config.bgROI.height = DISP_GetScreenHeight();
				config.bgColor = 0x0;	// background color
				config.pitch = DISP_GetScreenWidth()*2;

				config.srcROI.x = 0;config.srcROI.y = 0;
				config.srcROI.height= DISP_GetScreenHeight();config.srcROI.width= DISP_GetScreenWidth();
				config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
#if 0
				config.ovl_config.layer = 2;
				config.ovl_config.layer_en = 1; 
				config.ovl_config.fmt = OVL_INPUT_FORMAT_RGB565;
				config.ovl_config.addr = fbPA;	
				config.ovl_config.source = OVL_LAYER_SOURCE_MEM; 
				config.ovl_config.x = 0;		// ROI
				config.ovl_config.y = 0;  
				config.ovl_config.w = DISP_GetScreenWidth();  
				config.ovl_config.h = DISP_GetScreenHeight(); 
				config.ovl_config.pitch = DISP_GetScreenWidth()*2; //pixel number
				config.ovl_config.keyEn = 1;
				config.ovl_config.key = 0xFFFFFFFF; 	// color key
				config.ovl_config.aen = 0;			   // alpha enable
				config.ovl_config.alpha = 0;  
#endif
			}
			
			config.dstModule = DISP_MODULE_DBI;// DISP_MODULE_WDMA1
			if(config.dstModule == DISP_MODULE_DBI)
				config.outFormat = RDMA_OUTPUT_FORMAT_ARGB; 
			else
				config.outFormat = WDMA_OUTPUT_FORMAT_ARGB; 		
			disp_path_get_mutex();
			disp_path_config(&config);

			disp_bls_config();
		}
#endif


    init_io_pad();
	init_io_driving_current();
    init_lcd();

    if (NULL != lcm_drv->init && !isLcmInited) {
        lcm_drv->init();
    }

    init_lcd_te_control();
    DPI_PowerOn();
    DPI_PowerOff();
    DSI_PowerOn();
    DSI_PowerOff();

    return DISP_STATUS_OK;
}
Exemplo n.º 20
0
static DISP_STATUS dbi_init(UINT32 fbVA, UINT32 fbPA, BOOL isLcmInited)
{
	if (!disp_drv_dbi_init_context())
		return DISP_STATUS_NOT_IMPLEMENTED;
#if 0
#ifdef MT65XX_NEW_DISP
	{
		struct disp_path_config_struct config = { 0 };

		config.srcModule = DISP_MODULE_OVL;

		config.bgROI.x = 0;
		config.bgROI.y = 0;
		config.bgROI.width = DISP_GetScreenWidth();
		config.bgROI.height = DISP_GetScreenHeight();
		config.bgColor = 0x0;	/* background color */
		config.pitch = DISP_GetScreenWidth() * 2;

		config.srcROI.x = 0;
		config.srcROI.y = 0;
		config.srcROI.height = DISP_GetScreenHeight();
		config.srcROI.width = DISP_GetScreenWidth();
		config.ovl_config.source = OVL_LAYER_SOURCE_MEM;
		/* Config FB_Layer port to be physical. */
		{
			M4U_PORT_STRUCT portStruct;
			portStruct.ePortID = M4U_PORT_OVL_CH3;	/* hardware port ID, defined in M4U_PORT_ID_ENUM */
			portStruct.Virtuality = 1;
			portStruct.Security = 0;
			portStruct.domain = 3;	/* domain : 0 1 2 3 */
			portStruct.Distance = 1;
			portStruct.Direction = 0;
			m4u_config_port(&portStruct);
		}
		/* Reconfig FB_Layer and enable it. */
		config.ovl_config.layer = FB_LAYER;
		config.ovl_config.layer_en = 1;
		config.ovl_config.fmt = eRGB565;
		config.ovl_config.addr = fbPA;
		config.ovl_config.source = OVL_LAYER_SOURCE_MEM;
		config.ovl_config.src_x = 0;
		config.ovl_config.src_y = 0;
		config.ovl_config.dst_x = 0;	/* ROI */
		config.ovl_config.dst_y = 0;
		config.ovl_config.dst_w = DISP_GetScreenWidth();
		config.ovl_config.dst_h = DISP_GetScreenHeight();
		config.ovl_config.src_pitch = ALIGN_TO(DISP_GetScreenWidth(), 32) * 2;
		config.ovl_config.keyEn = 0;
		config.ovl_config.key = 0xFF;	/* color key */
		config.ovl_config.aen = 0;	/* alpha enable */
		config.ovl_config.alpha = 0;
		LCD_LayerSetAddress(FB_LAYER, fbPA);
		LCD_LayerSetFormat(FB_LAYER, LCD_LAYER_FORMAT_RGB565);
		LCD_LayerSetOffset(FB_LAYER, 0, 0);
		LCD_LayerSetSize(FB_LAYER, DISP_GetScreenWidth(), DISP_GetScreenHeight());
		LCD_LayerSetPitch(FB_LAYER, ALIGN_TO(DISP_GetScreenWidth(), 32) * 2);
		LCD_LayerEnable(FB_LAYER, TRUE);
		config.dstModule = DISP_MODULE_DBI;	/* DISP_MODULE_WDMA1 */
		config.outFormat = RDMA_OUTPUT_FORMAT_ARGB;
		/* disp_path_get_mutex(); */
		disp_path_config(&config);
		/* Config LK UI layer port to be physical. */
		{
			M4U_PORT_STRUCT portStruct;
			portStruct.ePortID = M4U_PORT_OVL_CH2;	/* hardware port ID, defined in M4U_PORT_ID_ENUM */
			portStruct.Virtuality = 1;
			portStruct.Security = 0;
			portStruct.domain = 3;	/* domain : 0 1 2 3 */
			portStruct.Distance = 1;
			portStruct.Direction = 0;
			m4u_config_port(&portStruct);
		}

		disp_bls_config();
	}
#endif


	init_io_pad();
	init_io_driving_current();
	init_lcd();

	if (NULL != lcm_drv->init && !isLcmInited)
		lcm_drv->init();

	init_lcd_te_control();
	DPI_PowerOn();
	DPI_PowerOff();
	DSI_PowerOn();
	DSI_PowerOff();
#endif
	return DISP_STATUS_OK;
}
Exemplo n.º 21
0
DPI_STATUS DPI_Capture_Framebuffer(unsigned int pvbuf, unsigned int bpp)
{
#if 0
    unsigned int i = 0;
    unsigned char *fbv;
    unsigned int fbsize = 0;
    unsigned int dpi_fb_bpp = 0;
    unsigned int w,h;
	BOOL dpi_needPowerOff = FALSE;
	if(!s_isDpiPowerOn){
		DPI_PowerOn();
		dpi_needPowerOff = TRUE;
		LCD_WaitForNotBusy();
	    LCD_WaitDPIIndication(FALSE);
		LCD_FBReset();
    	LCD_StartTransfer(TRUE);
		LCD_WaitDPIIndication(TRUE);
	}

    if(pvbuf == 0 || bpp == 0)
    {
        DISP_LOG_PRINT(ANDROID_LOG_ERROR, "DPI", "DPI_Capture_Framebuffer, ERROR, parameters wrong: pvbuf=0x%08x, bpp=%d\n", pvbuf, bpp);
        return DPI_STATUS_OK;
    }

    if(DPI_FBGetFormat() == DPI_FB_FORMAT_RGB565)
    {
        dpi_fb_bpp = 16;
    }
    else if(DPI_FBGetFormat() == DPI_FB_FORMAT_RGB888)
    {
        dpi_fb_bpp = 24;
    }
    else
    {
        DISP_LOG_PRINT(ANDROID_LOG_ERROR, "DPI", "DPI_Capture_Framebuffer, ERROR, dpi_fb_bpp is wrong: %d\n", dpi_fb_bpp);
        return DPI_STATUS_OK;
    }

    w = DISP_GetScreenWidth();
    h = DISP_GetScreenHeight();
    fbsize = w*h*dpi_fb_bpp/8;
	if(dpi_needPowerOff)
    	fbv = (unsigned char*)ioremap_cached((unsigned int)DPI_REG->FB[0].ADDR, fbsize);
	else
    	fbv = (unsigned char*)ioremap_cached((unsigned int)DPI_REG->FB[DPI_GetCurrentFB()].ADDR, fbsize);
 
    DISP_LOG_PRINT(ANDROID_LOG_INFO, "DPI", "current fb count is %d\n", DPI_GetCurrentFB());

    if(bpp == 32 && dpi_fb_bpp == 24)
    {			
    	if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3)){
			unsigned int pix_count = w * h - 1;
    		for(i = 0;i < w*h; i++)
    		{
            	*(unsigned int*)(pvbuf+ (pix_count - i) * 4) = 0xff000000|fbv[i*3]|(fbv[i*3+1]<<8)|(fbv[i*3+2]<<16);
    		}
		}
		else{
    		for(i = 0;i < w*h; i++)
    		{
            	*(unsigned int*)(pvbuf+i*4) = 0xff000000|fbv[i*3]|(fbv[i*3+1]<<8)|(fbv[i*3+2]<<16);
    		}
		}
    }
    else if(bpp == 32 && dpi_fb_bpp == 16)
    {
        unsigned int t;
		unsigned short* fbvt = (unsigned short*)fbv;
    	
		if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3)){
			unsigned int pix_count = w * h - 1;
			
    		for(i = 0;i < w*h; i++)
    		{
				t = fbvt[i];
            	*(unsigned int*)(pvbuf+ (pix_count - i) * 4) = 0xff000000|((t&0x001F)<<3)|((t&0x07E0)<<5)|((t&0xF800)<<8);
    		}
		}
		else{
        	for(i = 0;i < w*h; i++)
    		{
	    		t = fbvt[i];
            	*(unsigned int*)(pvbuf+i*4) = 0xff000000|((t&0x001F)<<3)|((t&0x07E0)<<5)|((t&0xF800)<<8);
    		}
		}
    }
    else if(bpp == 16 && dpi_fb_bpp == 16)
    {
		if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3)){
			unsigned int pix_count = w * h - 1;
			unsigned short* fbvt = (unsigned short*)fbv;
    		for(i = 0;i < w*h; i++)
    		{
            	*(unsigned short*)(pvbuf+ (pix_count - i) * 2) = fbvt[i];
    		}
		}
		else
    		memcpy((void*)pvbuf, (void*)fbv, fbsize);
    }
    else if(bpp == 16 && dpi_fb_bpp == 24)
    {
		if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "180", 3)){
			unsigned int pix_count = w * h - 1;
    		for(i = 0;i < w*h; i++)
    		{
            	*(unsigned short*)(pvbuf+ (pix_count - i) * 2) = ((fbv[i*3+0]&0xF8)>>3)|
	            	                        				((fbv[i*3+1]&0xFC)<<3)|
														    ((fbv[i*3+2]&0xF8)<<8);
    		}
		}
		else{
    		for(i = 0;i < w*h; i++)