Esempio n. 1
0
DPI_STATUS DPI_PowerOff()
{
    if (s_isDpiPowerOn)
    {
        BOOL ret = TRUE;
        _BackupDPIRegisters();
#if 1   // FIXME
        MASKREG32(0x14000110, 0x40, 0x40);//dpi0 clock gate setting
#endif
        ASSERT(ret);
        s_isDpiPowerOn = FALSE;
    }

    return DPI_STATUS_OK;
}
DPI_STATUS DPI_Init_PLL(unsigned int mipi_pll_clk_ref,unsigned int mipi_pll_clk_div1,unsigned int mipi_pll_clk_div2)
{
	MASKREG32(CLK_CFG_5, 0x400, 0x400);  // CLK_CFG_5[10] rg_lvds_tv_sel
                                          // 0:dpi0_ck from tvhdmi pll
                                          // 1:dpi0_ck from lvds pll

	MASKREG32(CLK_CFG_7, 0x07000000, 0x01000000); // CLK_CFG_7[26:24] lvdspll clock divider selection
                                                   // 0: from 26M
                                                   // 1: lvds_pll_ck
                                                   // 2: lvds_pll_ck/2
                                                   // 3: lvds_pll_ck/4
                                                   // 4: lvds_pll_ck/8
                                                   // CLK_CFG_7[31] 0: clock on, 1: clock off

    DRV_SetReg32(LVDSPLL_PWR_CON0, (0x1 << 0));  //PLL_PWR_ON
    udelay(2);
    DRV_ClrReg32(LVDSPLL_PWR_CON0, (0x1 << 1));  //PLL_ISO_EN

	OUTREG32(LVDSPLL_CON1, mipi_pll_clk_div2);
	OUTREG32(LVDSPLL_CON0, mipi_pll_clk_div1);
    udelay(20);

	return DPI_STATUS_OK;
}
Esempio n. 3
0
DPI_STATUS DPI1_PowerOff()
{
    if (s_isDpiPowerOn)
    {
        BOOL ret = TRUE;
        _BackupDPIRegisters();
#if 1   // FIXME
        MASKREG32(0xC2080018, 0x10, 0x10);
#endif
        ASSERT(ret);
        s_isDpiPowerOn = FALSE;
    }

    return DPI_STATUS_OK;
}
Esempio n. 4
0
DSI_STATUS DSI_PowerOff(void)
{

    if (s_isDsiPowerOn)
    {
        BOOL ret = TRUE;
        //_WaitForEngineNotBusy();
        _BackupDSIRegisters();
#if 0   // FIXME
        ret = hwDisableClock(MT65XX_PDN_MM_DSI, "DSI");
        ASSERT(ret);
#else
        MASKREG32(0xC2080018, 0x00000020, 0x00000020);
		printf("[DISP] - uboot - DSI_PowerOff. 0x%8x,0x%8x,0x%8x\n", INREG32(0xC2080000), INREG32(0xC2080004), INREG32(0xC2080008));
#endif        
        s_isDsiPowerOn = FALSE;
    }
    
    return DSI_STATUS_OK;
}
Esempio n. 5
0
DSI_STATUS DSI_PowerOn(void)
{

    if (!s_isDsiPowerOn)
    {
#if 0   // FIXME
        BOOL ret = hwEnableClock(MT65XX_PDN_MM_DSI, "DSI");
        ASSERT(ret);
#else
		MASKREG32(0xC2080028, 0x00000020, 0x00000020);
		printf("[DISP] - uboot - DSI_PowerOn. 0x%8x,0x%8x,0x%8x\n", INREG32(0xC2080000), INREG32(0xC2080004), INREG32(0xC2080008));

#endif        
        _RestoreDSIRegisters();
	//_WaitForEngineNotBusy();		
        s_isDsiPowerOn = TRUE;
    }

    return DSI_STATUS_OK;
}
Esempio n. 6
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;
}
Esempio n. 7
0
// TODO: this is a temp debug solution
static void process_dbg_opt(const char *opt)
{
    if (0)
    {

    }
    else if (0 == strncmp(opt, "on", 2))
    {
        hdmi_power_on();
    }
    else if (0 == strncmp(opt, "off", 3))
    {
        hdmi_power_off();
    }
    else if (0 == strncmp(opt, "suspend", 7))
    {
        hdmi_suspend();
    }
    else if (0 == strncmp(opt, "resume", 6))
    {
        hdmi_resume();
    }
    else if (0 == strncmp(opt, "colorbar", 8))
    {

    }
    else if (0 == strncmp(opt, "ldooff", 6))
    {

    }
    else if (0 == strncmp(opt, "log:", 4))
    {
        if (0 == strncmp(opt + 4, "on", 2))
        {
            hdmi_log_enable(true);
        }
        else if (0 == strncmp(opt + 4, "off", 3))
        {
            hdmi_log_enable(false);
        }
        else
        {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "fakecablein:", 12))
    {
        if (0 == strncmp(opt + 12, "enable", 6))
        {
            hdmi_cable_fake_plug_in();
        }
        else if (0 == strncmp(opt + 12, "disable", 7))
        {
            hdmi_cable_fake_plug_out();
        }
        else
        {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "hdmimmp:", 8))
    {
        if (0 == strncmp(opt + 8, "on", 2))
        {
            hdmi_mmp_enable(1);
        }
        else if (0 == strncmp(opt + 8, "off", 3))
        {
            hdmi_mmp_enable(0);
        }
        else if (0 == strncmp(opt + 8, "img", 3))
        {
            hdmi_mmp_enable(7);
        }
        else
        {
            goto Error;
        }
    }
    else if (0 == strncmp(opt, "hdmireg", 7))
    {
        ext_disp_diagnose();
    }
    else if (0 == strncmp(opt, "enablehwc:", 10))
    {
        if (0 == strncmp(opt + 10, "on", 2))
        {
            hdmi_hwc_enable(1);
        }
        else if (0 == strncmp(opt + 10, "off", 3))
        {
            hdmi_hwc_enable(0);
        }
    }
    else if (0 == strncmp(opt, "I2S1:", 5))
    {
#ifdef GPIO_MHL_I2S_OUT_WS_PIN
        if (0 == strncmp(opt + 5, "on", 2))
        {
            printk("[hdmi][Debug] Enable I2S1 \n");
            mt_set_gpio_mode(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_MODE_01);
            mt_set_gpio_mode(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_MODE_01);
            mt_set_gpio_mode(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_MODE_01);
        }
        else if (0 == strncmp(opt + 5, "off", 3))
        {
            printk("[hdmi][Debug] Disable I2S1 \n");
            mt_set_gpio_mode(GPIO_MHL_I2S_OUT_WS_PIN, GPIO_MODE_02);
            mt_set_gpio_mode(GPIO_MHL_I2S_OUT_CK_PIN, GPIO_MODE_01);
            mt_set_gpio_mode(GPIO_MHL_I2S_OUT_DAT_PIN, GPIO_MODE_02);
        }
#endif
    }
    else if (0 == strncmp(opt, "I2SEnable:", 10))
    {
        if (0 == strncmp(opt + 10, "1", 1))
        {
            I2S_Enable = 1;
        }
        else if (0 == strncmp(opt + 10, "0", 1))
        {
            I2S_Enable = 0;
        }
    }
    else if (0 == strncmp(opt, "DPI_IO_DRIVING:", 15))
    {
        if (0 == strncmp(opt + 15, "4", 1))
        {
            MASKREG32(DISPSYS_IO_DRIVING, 0x3C00, 0x0000);
        }
        else if (0 == strncmp(opt + 15, "8", 1))
        {
            MASKREG32(DISPSYS_IO_DRIVING, 0x3C00, 0x1400);
        }
        else if (0 == strncmp(opt + 15, "12", 2))
        {
            MASKREG32(DISPSYS_IO_DRIVING, 0x3C00, 0x2800);
        }
        else if (0 == strncmp(opt + 15, "16", 2))
        {
            MASKREG32(DISPSYS_IO_DRIVING, 0x3C00, 0x3C00);
        }
    }
    else if (0 == strncmp(opt, "DPI_DUMP:", 9))
    {
        if (ddp_modules_driver[DISP_MODULE_DPI]->dump_info != NULL)
        {
            ddp_modules_driver[DISP_MODULE_DPI]->dump_info(DISP_MODULE_DPI, 1);
        }
    }
    else if (0 == strncmp(opt, "forceon", 7))
    {
        hdmi_force_on(false);
    }
    else
    {
        goto Error;
    }

    return;

Error:
    printk("[hdmitx] parse command error!\n\n%s", STR_HELP);
}
Esempio n. 8
0
DPI_STATUS DPI1_Init(BOOL isDpiPoweredOn)
{
    //DPI1_REG_CNTL cntl;
    //DPI1_REG_EMBSYNC_SETTING embsync;

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

    DPI1_PowerOn();

#if 0
	OUTREG32(DPI1_BASE+ 0x64, 0x400);//
	OUTREG32(DPI1_BASE+ 0x6C, 0x400);//
	OUTREG32(DPI1_BASE+ 0x74, 0x400);//
	OUTREG32(DPI1_BASE+ 0x8C, 0x0FFF0000);//
	OUTREG32(DPI1_BASE+ 0x90, 0x0FFF0000);//
	MASKREG32(DISPSYS_BASE + 0x60, 0x1, 0x1); // [1]: DPI0_I2X_EN
	                                          // 0: DPI0 IO is single edge mode
                                                //1: DPI0 IO is dual edge mode
#endif

	MASKREG32(DISPSYS_BASE + 0x60, 0xb03, 0xb03);

	//OUTREG32(DPI1_BASE+ 0x10, 0x000001A0);//DPI_CON
	//OUTREG32(DPI1_BASE+ 0x14, 0x00000101);//DPI_CLKCON
	//OUTREG32(DPI1_BASE+ 0x18, 0x02d00500);//DPI_SIZE 720x1280
	//OUTREG32(DPI1_BASE+ 0x1c, 0x00000028);//DPI_TGEN_HWIDTH 40
	//OUTREG32(DPI1_BASE+ 0x20, 0x01b800dc);//DPI_TGEN_HPORCH BACK:220 FRONT:440
	//OUTREG32(DPI1_BASE+ 0x24, 0x00000005);//DPI_TGEN_VWIDTH_LODD 5
	//OUTREG32(DPI1_BASE+ 0x28, 0x00050014);//DPI_TGEN_VPORCH_LODD BACK:20 FRONT:5
	//OUTREG32(DPI1_BASE+ 0x44, 0x00001e00);//DPI_ESAV_VTIM_L WIDTH:30 lines
	//DPI1_ESAVVTimingControlLeft(0, 0x1E, 0, 0);

	//OUTREG32(DPI1_BASE+ 0x64, 0x1ead1f53);//DPI_MATRIX_COEFF_SET0
	//OUTREG32(DPI1_BASE+ 0x68, 0x01320200);//DPI_MATRIX_COEFF_SET1
	//OUTREG32(DPI1_BASE+ 0x6c, 0x00750259);//DPI_MATRIX_COEFF_SET2
	//OUTREG32(DPI1_BASE+ 0x70, 0x1e530200);//DPI_MATRIX_COEFF_SET3
	//OUTREG32(DPI1_BASE+ 0x74, 0x00001fa0);//DPI_MATRIX_COEFF_SET4
	//DPI1_MatrixCoef(0x1F53, 0x1EAD, 0x0200, 0x0132, 0x0259, 0x0075, 0x0200, 0x1E53, 0x1FA0);

	//OUTREG32(DPI1_BASE+ 0x78, 0x00000000);//DPI_MATRIX_PREADD_SET0
	//OUTREG32(DPI1_BASE+ 0x7c, 0x00000000);//DPI_MATRIX_PREADD_SET1
	//DPI1_MatrixPreOffset(0, 0, 0);

	//OUTREG32(DPI1_BASE+ 0x80, 0x00000800);//DPI_MATRIX_POSTADD_SET0
	//OUTREG32(DPI1_BASE+ 0x84, 0x00000800);//DPI_MATRIX_POSTADD_SET1
	//DPI1_MatrixPostOffset(0x0800, 0, 0x0800);

	//OUTREG32(DPI1_BASE+ 0x88, 0x00000000);//DPI_CLPF_SETTING
	//DPI1_CLPFSetting(0, FALSE);

	//OUTREG32(DPI1_BASE+ 0x8c, 0x0f000100);//DPI_Y_LIMIT 256 - 3840
	//OUTREG32(DPI1_BASE+ 0x90, 0x0f000100);//DPI_C_LIMIT 256 - 3840
	//DPI1_SetChannelLimit(0x0100, 0x0F00, 0x0100, 0x0F00);

	//OUTREG32(DPI1_BASE+ 0x9c, 0x00000007);//DPI_EMBSYNC_SETTING
	//DPI1_EmbeddedSyncSetting(TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE);

	//OUTREG32(DPI1_BASE+ 0xa8, 0x00000600);//DPI_OUTPUT_SETTING OUT_YC_MAP
	//DPI1_OutputSetting(DPI_OUTPUT_BIT_NUM_8BITS, FALSE, DPI_OUTPUT_CHANNEL_SWAP_RGB, DPI_OUTPUT_YC_MAP_CY);

	//OUTREG32(DPI1_BASE+ 0xb4, 0x11223341);//DPI_PATTERN
	//DPI1_EnableColorBar();

	//OUTREG32(DPI1_BASE + 0x0,  0x00000001);//
	//DPI1_EnableClk();

    #if 0
	cntl = DPI1_REG->CNTL;
	cntl.EMBSYNC_EN = 1;
	OUTREG32(&DPI1_REG->CNTL, AS_UINT32(&cntl));

       embsync = DPI1_REG->EMBSYNC_SETTING;
       embsync.ESAV_CODE_MAN = 0;
       embsync.EMBVSYNC_G_Y = 1;
       embsync.EMBVSYNC_R_CR= 1;
       embsync.EMBVSYNC_B_CB= 1;
       OUTREG32(&DPI1_REG->EMBSYNC_SETTING, AS_UINT32(&embsync));
    #endif

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

    {
        DPI_REG_INTERRUPT enInt = DPI1_REG->INT_ENABLE;
        enInt.VSYNC = 1;
        OUTREG32(&DPI1_REG->INT_ENABLE, AS_UINT32(&enInt));
    }
#endif
	LCD_W2M_NeedLimiteSpeed(TRUE);
    return DPI_STATUS_OK;
}