MTK6577+Android增加支持新显示屏的显示

MTK6577+Android增加支持新显示屏的显示

 

MTK6577包含一个针对多媒体应用优化过的多功能(versatile)的LCD控制器,这个控制器支持多种类型的LCD模块和包含一系列丰富的曾强功能的特征。

 

1.     LCD控制器特性(features)

 

(1)  支持高达540*960的分辨率

(2)  从帧缓冲(frame buffer)读取的图像数据格式:RGB 565、RGB 888、 ARGB 8888、PARGB 8888和YUYV422

(3)  支持8-bpp(RGB332)、12-bpp(RGB444)、16-bpp(RGB565)、18-bpp(RGB666)和24-bpp(RGB888)

(4)  支持多达6层单色深度、窗口大小、垂直偏移、水平偏移、source key、diher and alpha value的叠加。

(5)  3个伽玛校正表(gamma correction table)

(6)  支持DBI B和C类型接口

DBI(Display Bus Interface)规范中规定了它的硬件接口方式,它是液晶数据总线接口,可细分为MIPI DBI Type A、MIPI DBI TypeB、MIPI DBI Type C这三种不同的模式,不同模式下的硬件接口以及数据的采样都有所不同,如在MIPI DBI Type A规范中规定是下降沿采样数据值(摩托罗拉6800接口),MIPI DBI Type B规范中规定是上升沿采样数据(英特尔8080接口)。MIPI DBI Type A和MIPI DBI Type B同时又可细分为5种不同数据接口模式,分别为8位数据接口、9位数据接口、16位数据接口、18位数据接口、24位数据接口。不过市面上支持9位数据接口的液晶驱动IC并不多见,当然数据接口越大那么相同一个周期内数据接口越大,所传输的数据越多。而MIPI DBI Type C 只适用于传输于DCS规范中规定的命令和该命令所需要的参数值,不能传输液晶像素的颜色值(虽然DBI规范中规定能传输颜色值,不过市面上的液晶驱动IC是用来传输命令和命令所需的参数值)。

 

 

2.     LCD控制器框图

MTK6577+Android增加支持新显示屏的显示_第1张图片

图1

由于我们的产品LCD屏是采用DPI RGB接口的,下面给出MTK6577 DPI接口的框图:

MTK6577+Android增加支持新显示屏的显示_第2张图片

图2

 

 

3.     CPU的DPI接口引脚

从图2可知DPI接口支持的引脚有R[7:0]、G[7:0]、B[7:0]、H Sync、V sync、DE和DIPCLK,对应的LCD DPI引脚和LCD模块电路连接图如下:

MTK6577+Android增加支持新显示屏的显示_第3张图片

图3

 

 

 

4.     U-Boot中LCD初始化

MTK6577+Android增加支持新显示屏的显示_第4张图片

图4

上面是以显示模块驱动IC为ILI9481为例来画出UBoot中是如何最终调用到显示模块的初始化的。

 

5.     增加对新显示屏支持

 

新显示模块分辨率为480*800,驱动IC为ILI9806E。

 

\mediatek\custom\common\uboot\lcm和\mediatek\custom\common\kernel\lcm文件夹内容一样,为什么不共用呢?

 

(1)  新建对应于驱动IC ILI9806E的初始化文件夹

在\mediatek\custom\common\uboot\lcm和\mediatek\custom\common\kernel\lcm

文件夹下新建文件夹ili9806e

 

(2)  mt65xx_lcm_list.c新增对新显示模块的支持

1)     声明ili9806e_lcm_drv

extern LCM_DRIVERili9806e_lcm_drv;

 

2)     在lcm_driver_list[]增加对9806的支持

#if defined(ILI9806E)

       &ili9806e_lcm_drv,

#endif

这里的ILI9806E就是在mediatek\config\prj\ProjectConfig.mk定义。

 

(3)  ProjectConfig.mk配置为新的显示模块

 

BOOT_LOGO= wvga

这里的开机logo图片wvga对应于\mediatek\custom\common\uboot\logo\wvga下的文件夹

CUSTOM_UBOOT_LCM=ili9806e

CUSTOM_KERNEL_LCM=ili9806e

 

LCM_HEIGHT=800

LCM_WIDTH=480

 

(4)   

 

6.     新显示屏硬件配置及寄存器初始化

6.1   显示屏的数据和控制引脚

先来看LCD显示屏及外围电路图:

MTK6577+Android增加支持新显示屏的显示_第5张图片

图5

我们选择RGB666的像素数据格式,我们用到和显示屏相关的重要引脚如下:

CPU GPIO

连接符

显示屏引脚

功能

PMIC

VDD28_PMU

VCC

模拟和逻辑电源,显示屏驱动IC供电

 

VDD1V8_PMU

IOVCC

接口电源,决定显示屏其他引脚电源

 

VLED_P

LEDA

LED阳极

 

VLED_N

LEDK

LED阴极

见下表

LCM_DPI_R[5:0]

R[5:0]

像素数据R引脚

见下表

LCM_DPI_G[5:0]

G[5:0]

像素数据G引脚

见下表

LCM_DPI_B[5:0]

B[5:0]

像素数据B引脚

GPIO21

LCM_VSYNC

VSYNC

显示图像帧同步信号

GPIO19

LCM_HSYNC

HSYNC

显示图像行同步信号

GPIO41

LCM_PCLK

DOTCLK

显示图像素同步信号

GPIO30

LCM_DE_RS

ENABLE

RGB接口数据时能信号,高电平有效

GPIO18

LRSTB

RESET

复位信号,低电平有效

GPIO48

SPI_SDO

SDO

SPI接口串行输出,这里暂时没用

GPIO52

LSDA

SDI

SPI接口串行输入

GPIO51

LSCK

SCL

SPI接口串行时钟

GPIO47/16

LSCE0B/ LPCE0B

CS

片选信号,低电平有效

 

 

 

 

RGB和CPU的GPIO引脚对应关系如下:

R

CPU GPIO

G

CPU GPIO

B

CPU GPIO

R0

GPIO44

G0

GPIO37

B0

GPIO25

R1

GPIO45

G1

GPIO43

B1

GPIO36

R2

GPIO35

G2

GPIO33

B2

GPIO23

R3

GPIO40

G3

GPIO28

B3

GPIO31

R4

GPIO27

G4

GPIO39

B4

GPIO29

R5

GPIO22

G5

GPIO46

B5

GPIO24

R6

GPIO32

G6

GPIO38

B6

GPIO20

R7

GPIO26

G7

GPIO34

B7

GPIO42

(1)  RGB和VSYNC、HSYNC、PCLK、DE、RESET的初始化

在整个源代码中找不到对这些引脚的初始化代码,后来才注意到CPU默认就已经选择对应的模式了,所以不需要初始化,可参考《MTK6577+Android GPIO》的相关部分:

http://blog.csdn.net/loongembedded/article/details/38454739

 

(2)  SDI、SCL和CS的初始化

选择为GPIO模式,设置为输出和禁止上下拉功能。

 

(3)  初始化驱动IC

在初始化之前,需要复位驱动IC。

 

6.2   显示屏参数的设置

主要包括如下几方面:

(1)  显示屏像素和接口类型(比如为DPI)

(2)  帧同步、行同步、像素同步的极性及这些同步信号的其他参数。

(3)  DPI始终源

(4)  RGB数据格式(比如RGB666)和显示屏的驱动电流等。

 

6.3   发现的问题

在屏可以正常显示后,发现显示旋转了180度,原来是\mediatek\config\hsimobile77_ics2下的ProjectConfig配置文件中旋转了180度,如下:

MTK_LCM_PHYSICAL_ROTATION=180

改为MTK_LCM_PHYSICAL_ROTATION=0就OK了。

 

6.4   源代码

 

#include <linux/string.h>

#ifdef BUILD_UBOOT
#include <asm/arch/mt6577_gpio.h>
#else
#include <mach/mt6577_gpio.h>
#endif
#include "lcm_drv.h"
#ifndef BUILD_UBOOT
#include <mach/mt6577_gpt.h>
#endif

// ---------------------------------------------------------------------------
//  Local Constants
// ---------------------------------------------------------------------------

#define FRAME_WIDTH  (480)
#define FRAME_HEIGHT (800)

#define LSA0_GPIO_PIN (GPIO49)//no use
#define LSCE_GPIO_PIN (GPIO47)//CS
#define LSCK_GPIO_PIN (GPIO51)
#define LSDA_GPIO_PIN (GPIO52)

#define GPIO_MSG2313_PIN (GPIO83) //power interface for TP
//#define GPIO_BL
// ---------------------------------------------------------------------------
//  Local Variables
// ---------------------------------------------------------------------------

static LCM_UTIL_FUNCS lcm_util = {0};
void lcm_setbacklight(unsigned int level);
void bl_call_up(UINT16 i);

#define SET_RESET_PIN(v)    (lcm_util.set_reset_pin((v)))
#define SET_GPIO_OUT(n, v)  (lcm_util.set_gpio_out((n), (v)))


#define UDELAY(n) (lcm_util.udelay(n))
#define MDELAY(n) (lcm_util.mdelay(n))

// ---------------------------------------------------------------------------
//  Local Functions
// ---------------------------------------------------------------------------

#define SET_LSCE_LOW   SET_GPIO_OUT(LSCE_GPIO_PIN, 0)
#define SET_LSCE_HIGH  SET_GPIO_OUT(LSCE_GPIO_PIN, 1)
#define SET_LSCK_LOW   SET_GPIO_OUT(LSCK_GPIO_PIN, 0)
#define SET_LSCK_HIGH  SET_GPIO_OUT(LSCK_GPIO_PIN, 1)
#define SET_LSDA_LOW   SET_GPIO_OUT(LSDA_GPIO_PIN, 0)
#define SET_LSDA_HIGH  SET_GPIO_OUT(LSDA_GPIO_PIN, 1)

int on_off_flag=1;
int First_RUN=1;
#ifndef BUILD_UBOOT
//GPT_NUM gpt_num=GPT_NONE;
//GPT_CONFIG config;
#endif

static __inline void send_ctrl_cmd(unsigned int cmd)
{
	unsigned int i;
	unsigned int tmp;

 	tmp = (0x0000 | (cmd& 0xFF));
	SET_LSDA_HIGH;
	SET_LSCK_HIGH;
	SET_LSCE_HIGH;
	UDELAY(1);
	SET_LSCE_LOW;
	//-------------------------------

	for(i=0;i<9;i++)
	{    

		if((tmp&0x0100)==0x0100)   {
			SET_LSDA_HIGH;
		}
		else {
			SET_LSDA_LOW;
		}

		UDELAY(1);
		SET_LSCK_LOW;
		UDELAY(1);
		SET_LSCK_HIGH;
		tmp = tmp << 1;
	}

	SET_LSCE_HIGH;

	UDELAY(1);

}


static __inline void send_data_cmd(unsigned int data)
{
	unsigned int i;
	unsigned int tmp;

	tmp = (0x0100 | (data& 0xFF));
	SET_LSDA_HIGH;
	SET_LSCK_HIGH;
	SET_LSCE_HIGH;
	UDELAY(1);
	SET_LSCE_LOW;
	//-------------------------------

	for(i=0;i<9;i++)
	{	 

		if((tmp&0x0100)==0x0100)   {
			SET_LSDA_HIGH;
		}
		else {
			SET_LSDA_LOW;
		}

		UDELAY(1);
		SET_LSCK_LOW;
		UDELAY(1);
		SET_LSCK_HIGH;
		tmp = tmp << 1;
	}

	SET_LSCE_HIGH;

	UDELAY(1);

}



static __inline void set_lcm_register(unsigned int regIndex,
                                      unsigned int regData)
{
    send_ctrl_cmd(regIndex);
    send_data_cmd(regData);
}

void init_lcm_registers()
{


//*********************Initial Code**********************//

send_ctrl_cmd(0xFF); // EXTC Command Set enable register
send_data_cmd(0xFF);
send_data_cmd(0x98);
send_data_cmd(0x06);
send_data_cmd(0x04);
send_data_cmd(0x01);

send_ctrl_cmd(0x08);
send_data_cmd(0x10);

send_ctrl_cmd(0x21);
send_data_cmd(0x01);

send_ctrl_cmd(0x30);
send_data_cmd(0x02);

send_ctrl_cmd(0x31);
send_data_cmd(0x02);

send_ctrl_cmd(0x40);
send_data_cmd(0x15);

send_ctrl_cmd(0x41);
send_data_cmd(0x33);

send_ctrl_cmd(0x42);
send_data_cmd(0x01);

send_ctrl_cmd(0x43);
send_data_cmd(0x02);

send_ctrl_cmd(0x44);
send_data_cmd(0x02);

send_ctrl_cmd(0x52);
send_data_cmd(0x00);

send_ctrl_cmd(0x53);
send_data_cmd(0x6e);

send_ctrl_cmd(0x60);
send_data_cmd(0x03);

send_ctrl_cmd(0x61);
send_data_cmd(0x00);

send_ctrl_cmd(0x62);
send_data_cmd(0x08);

send_ctrl_cmd(0x63);
send_data_cmd(0x04);





//++++++++++++++++++ Gamma Setting ++++++++++++++++++//

send_ctrl_cmd(0xFF);
send_data_cmd(0xFF);
send_data_cmd(0x98);
send_data_cmd(0x06);
send_data_cmd(0x04);
send_data_cmd(0x01);

send_ctrl_cmd(0xA0);
send_data_cmd(0x00);

send_ctrl_cmd(0xA1);
send_data_cmd(0x03);

send_ctrl_cmd(0xA2);
send_data_cmd(0x0a);

send_ctrl_cmd(0xA3);
send_data_cmd(0x0f);

send_ctrl_cmd(0xA4);
send_data_cmd(0x09);

send_ctrl_cmd(0xA5);
send_data_cmd(0x18);

send_ctrl_cmd(0xA6);
send_data_cmd(0x0A);

send_ctrl_cmd(0xA7);
send_data_cmd(0x09);

send_ctrl_cmd(0xA8);
send_data_cmd(0x03);

send_ctrl_cmd(0xA9);
send_data_cmd(0x07);

send_ctrl_cmd(0xAA);
send_data_cmd(0x05);

send_ctrl_cmd(0xAB);
send_data_cmd(0x03);

send_ctrl_cmd(0xAC);
send_data_cmd(0x0b);

send_ctrl_cmd(0xAD);
send_data_cmd(0x2e);

send_ctrl_cmd(0xAE);
send_data_cmd(0x28);

send_ctrl_cmd(0xAF);
send_data_cmd(0x00);

///==============Nagitive
send_ctrl_cmd(0xC0);
send_data_cmd(0x00);

send_ctrl_cmd(0xC1);
send_data_cmd(0x02);

send_ctrl_cmd(0xC2);
send_data_cmd(0x09);

send_ctrl_cmd(0xC3);
send_data_cmd(0x0f);

send_ctrl_cmd(0xC4);
send_data_cmd(0x08);

send_ctrl_cmd(0xC5);
send_data_cmd(0x17);

send_ctrl_cmd(0xC6);
send_data_cmd(0x0b);

send_ctrl_cmd(0xC7);
send_data_cmd(0x08);

send_ctrl_cmd(0xC8);
send_data_cmd(0x03);

send_ctrl_cmd(0xC9);
send_data_cmd(0x08);

send_ctrl_cmd(0xCA);
send_data_cmd(0x06);

send_ctrl_cmd(0xCB);
send_data_cmd(0x04);

send_ctrl_cmd(0xCC);
send_data_cmd(0x0a);

send_ctrl_cmd(0xCD);
send_data_cmd(0x2d);

send_ctrl_cmd(0xCE);
send_data_cmd(0x29);

send_ctrl_cmd(0xCF);
send_data_cmd(0x00);

//****************************** Page 6 Command ******************************//

send_ctrl_cmd(0xFF);
send_data_cmd(0xFF);
send_data_cmd(0x98);
send_data_cmd(0x06);
send_data_cmd(0x04);
send_data_cmd(0x06);

send_ctrl_cmd(0x00);
send_data_cmd(0x21);

send_ctrl_cmd(0x01);
send_data_cmd(0x06);

send_ctrl_cmd(0x02);
send_data_cmd(0x00);

send_ctrl_cmd(0x03);
send_data_cmd(0x00);

send_ctrl_cmd(0x04);
send_data_cmd(0x01);

send_ctrl_cmd(0x05);
send_data_cmd(0x01);

send_ctrl_cmd(0x06);
send_data_cmd(0x80);

send_ctrl_cmd(0x07);
send_data_cmd(0x02);

send_ctrl_cmd(0x08);
send_data_cmd(0x05);

send_ctrl_cmd(0x09);
send_data_cmd(0x00);

send_ctrl_cmd(0x0A);
send_data_cmd(0x00);

send_ctrl_cmd(0x0B);
send_data_cmd(0x00);

send_ctrl_cmd(0x0C);
send_data_cmd(0x01);

send_ctrl_cmd(0x0D);
send_data_cmd(0x01);

send_ctrl_cmd(0x0E);
send_data_cmd(0x00);

send_ctrl_cmd(0x0F);
send_data_cmd(0x00);

send_ctrl_cmd(0x10);
send_data_cmd(0xF0);

send_ctrl_cmd(0x11);
send_data_cmd(0xF4);

send_ctrl_cmd(0x12);
send_data_cmd(0x00);

send_ctrl_cmd(0x13);
send_data_cmd(0x00);

send_ctrl_cmd(0x14);
send_data_cmd(0x00);

send_ctrl_cmd(0x15);
send_data_cmd(0xC0);

send_ctrl_cmd(0x16);
send_data_cmd(0x08);

send_ctrl_cmd(0x17);
send_data_cmd(0x00);

send_ctrl_cmd(0x18);
send_data_cmd(0x00);

send_ctrl_cmd(0x19);
send_data_cmd(0x00);

send_ctrl_cmd(0x1A);
send_data_cmd(0x00);

send_ctrl_cmd(0x1B);
send_data_cmd(0x00);

send_ctrl_cmd(0x1C);
send_data_cmd(0x00);

send_ctrl_cmd(0x1D);
send_data_cmd(0x00);

send_ctrl_cmd(0x20);
send_data_cmd(0x02);

send_ctrl_cmd(0x21);
send_data_cmd(0x13);

send_ctrl_cmd(0x22);
send_data_cmd(0x45);

send_ctrl_cmd(0x23);
send_data_cmd(0x67);

send_ctrl_cmd(0x24);
send_data_cmd(0x01);

send_ctrl_cmd(0x25);
send_data_cmd(0x23);

send_ctrl_cmd(0x26);
send_data_cmd(0x45);

send_ctrl_cmd(0x27);
send_data_cmd(0x67);

send_ctrl_cmd(0x30);
send_data_cmd(0x13);

send_ctrl_cmd(0x31);
send_data_cmd(0x22);

send_ctrl_cmd(0x32);
send_data_cmd(0x22);

send_ctrl_cmd(0x33);
send_data_cmd(0x22);

send_ctrl_cmd(0x34);
send_data_cmd(0x22);

send_ctrl_cmd(0x35);
send_data_cmd(0xbb);

send_ctrl_cmd(0x36);
send_data_cmd(0xaa);

send_ctrl_cmd(0x37);
send_data_cmd(0xdd);

send_ctrl_cmd(0x38);
send_data_cmd(0xcc);

send_ctrl_cmd(0x39);
send_data_cmd(0x66);

send_ctrl_cmd(0x3A);
send_data_cmd(0x77);

send_ctrl_cmd(0x3B);
send_data_cmd(0x22);

send_ctrl_cmd(0x3C);
send_data_cmd(0x22);

send_ctrl_cmd(0x3D);
send_data_cmd(0x22);

send_ctrl_cmd(0x3E);
send_data_cmd(0x22);

send_ctrl_cmd(0x3F);
send_data_cmd(0x22);

send_ctrl_cmd(0x40);
send_data_cmd(0x22);




//****************************** Page 7 Command ******************************//

send_ctrl_cmd(0xFF);
send_data_cmd(0xFF);
send_data_cmd(0x98);
send_data_cmd(0x06);
send_data_cmd(0x04);
send_data_cmd(0x07);


send_ctrl_cmd(0x17);
send_data_cmd(0x22);

send_ctrl_cmd(0x02);
send_data_cmd(0x77);



//****************************** Page 0 Command ******************************//

send_ctrl_cmd(0xFF);
send_data_cmd(0xFF);
send_data_cmd(0x98);
send_data_cmd(0x06);
send_data_cmd(0x04);
send_data_cmd(0x00);

send_ctrl_cmd(0x3a);
send_data_cmd(0x66);

send_ctrl_cmd(0x11);
MDELAY(220);
send_ctrl_cmd(0x29);
MDELAY(20);
//********************************END****************************//

return ;



}



static void config_gpio(void)
{
    const unsigned int USED_GPIOS[] = 
    {
        LSCE_GPIO_PIN,
        LSCK_GPIO_PIN,
        LSDA_GPIO_PIN
    };

    unsigned int i;

    //lcm_util.set_gpio_mode(LSA0_GPIO_PIN, GPIO_MODE_GPIO);
    lcm_util.set_gpio_mode(LSCE_GPIO_PIN, GPIO_MODE_GPIO);
    lcm_util.set_gpio_mode(LSCK_GPIO_PIN, GPIO_MODE_GPIO);
    lcm_util.set_gpio_mode(LSDA_GPIO_PIN, GPIO_MODE_GPIO);

    for (i = 0; i < ARY_SIZE(USED_GPIOS); ++ i)
    {
        lcm_util.set_gpio_dir(USED_GPIOS[i], 1);               // GPIO out
        lcm_util.set_gpio_pull_enable(USED_GPIOS[i], 0);
    }

    // Swithc LSA0 pin to GPIO mode to avoid data contention,
    // since A0 is connected to LCM's SPI SDO pin
    //
   //lcm_util.set_gpio_dir(LSA0_GPIO_PIN, 0);                   // GPIO in
    lcm_util.set_gpio_out(LSCE_GPIO_PIN, 0);
	
}


// ---------------------------------------------------------------------------
//  LCM Driver Implementations
// ---------------------------------------------------------------------------

static void lcm_set_util_funcs(const LCM_UTIL_FUNCS *util)
{
    memcpy(&lcm_util, util, sizeof(LCM_UTIL_FUNCS));
}


static void lcm_get_params(LCM_PARAMS *params)
{
    memset(params, 0, sizeof(LCM_PARAMS));

    params->type   = LCM_TYPE_DPI;
    params->ctrl   = LCM_CTRL_GPIO;
    params->width  = FRAME_WIDTH;
    params->height = FRAME_HEIGHT;

    /* RGB interface configurations */
    
    params->dpi.mipi_pll_clk_ref  = 0;
    params->dpi.mipi_pll_clk_div1 = 65;
    params->dpi.mipi_pll_clk_div2 = 11;
    params->dpi.dpi_clk_div       = 2;
    params->dpi.dpi_clk_duty      = 1;

    params->dpi.clk_pol           = LCM_POLARITY_FALLING;
    params->dpi.de_pol            = LCM_POLARITY_RISING;
    params->dpi.vsync_pol         = LCM_POLARITY_FALLING;
    params->dpi.hsync_pol         = LCM_POLARITY_FALLING;

    params->dpi.hsync_pulse_width = 8;//6;
    params->dpi.hsync_back_porch  = 50;//2;
    params->dpi.hsync_front_porch = 50;//2;
    params->dpi.vsync_pulse_width = 4;//6;
    params->dpi.vsync_back_porch  = 16;//2+6;
    params->dpi.vsync_front_porch = 20;//2;
    
    params->dpi.format            = LCM_DPI_FORMAT_RGB666;
    params->dpi.rgb_order         = LCM_COLOR_ORDER_RGB;
    params->dpi.is_serial_output  = 0;

    params->dpi.intermediat_buffer_num = 2;

    params->dpi.io_driving_current = LCM_DRIVING_CURRENT_8MA;
}



void bl_call_up(UINT16 i)
{
    if(on_off_flag){
        on_off_flag = 0;
//    GPT_Stop(gpt_num);
//    if(GPT_Config(config)==FALSE)
//        return;
//    GPT_Start(gpt_num);
//    mt_set_gpio_out(GPIO67, 1);
 
    }else{
        on_off_flag = 1;
//    mt_set_gpio_out(GPIO67, 0);
//    GPT_Stop(gpt_num);
//    if(GPT_Config(config)==FALSE)
//        return;
//    GPT_Start(gpt_num);

    }
#ifndef BUILD_UBOOT
   // printk("##########run in LCM############\n");
#endif
}
 


static void lcm_init(void)
{
    config_gpio();

    SET_RESET_PIN(1);
    MDELAY(100);
    SET_RESET_PIN(0);
    MDELAY(100);
    SET_RESET_PIN(1);
    MDELAY(100);

    		init_lcm_registers();
#ifdef BUILD_UBOOT
printf("sgh debug nt35510 lcd_init..........\n");
#else
printk("sgh debug nt35510 lcd_init..........\n");
#endif
/*
   MDELAY(10);
   mt_set_gpio_mode(GPIO_MSG2313_PIN, GPIO_MODE_00);//power interface for TP
   mt_set_gpio_dir(GPIO_MSG2313_PIN, GPIO_DIR_OUT);
   mt_set_gpio_out(GPIO_MSG2313_PIN, 1);

   MDELAY(10);
   mt_set_gpio_mode(GPIO85, GPIO_MODE_00);//SPI_MO--->GPIO85_1D3V3--->SENSOR_DOVDD_3V3, for 2DS and 1D
   mt_set_gpio_dir(GPIO85, GPIO_DIR_OUT);
   mt_set_gpio_out(GPIO85, 1);

   MDELAY(10);
   mt_set_gpio_mode(GPIO149, GPIO_MODE_00);//SWCLKTCK--->SOS_EN_L_SD,for 2DS
   mt_set_gpio_dir(GPIO149, GPIO_DIR_OUT);
   mt_set_gpio_out(GPIO149, 0);

   MDELAY(10);
   mt_set_gpio_mode(GPIO156, GPIO_MODE_00);//JTMS--->MCU_JTMS_IC_SD,for PSAM IC TDA8029
   mt_set_gpio_dir(GPIO156, GPIO_DIR_OUT);
   mt_set_gpio_out(GPIO156, 0);
*/

}


static void lcm_suspend(void)
{
        // chenzhilin
	//config_gpio();
//        mt_set_gpio_mode(GPIO67, GPIO_MODE_GPIO);
//        mt_set_gpio_dir(GPIO67, GPIO_DIR_OUT);
//        mt_set_gpio_out(GPIO67, GPIO_OUT_ZERO);

    // chenzhilin
    //send_ctrl_cmd(0x1000);
    send_ctrl_cmd(0x10);
    MDELAY(250);
}


static void lcm_resume(void)
{
//        mt_set_gpio_mode(GPIO67, GPIO_MODE_GPIO);
//        mt_set_gpio_dir(GPIO67, GPIO_DIR_OUT);
//        mt_set_gpio_out(GPIO67, GPIO_OUT_ONE);
    // chenzhilin
    //send_ctrl_cmd(0x1100);
    send_ctrl_cmd(0x11);
    MDELAY(300);
}





void lcm_setbacklight(unsigned int level)
{
#ifdef BUILD_UBOOT
	printf("hzm new01 lcm_setbacklight = %d\n", level);
#else
	printk("hzm new01 lcm_setbacklight = %d\n", level);
#endif
/********BEGIN****************/

    
//    mt_set_gpio_mode(GPIO67, GPIO_MODE_GPIO);
//    mt_set_gpio_dir(GPIO67, GPIO_DIR_OUT);
//    mt_set_gpio_out(GPIO67, 1);
#ifdef GPIO_BL    
#ifdef BUILD_UBOOT    
//    mt_set_gpio_out(GPIO67, 1);
#else
if(First_RUN){
    First_RUN = 0;
    gpt_num = GPT_Request();
        if(gpt_num == GPT_NONE)
        {
            printk(">>>>>>>>>>>>>>ERROR>>>>>>>>>>>>>>>\n");
        }
    printk("########Request num = %d############\n",gpt_num);
    GPT_Init(gpt_num,bl_call_up);
    GPT_CLK_SRC clkSrc = GPT_CLK_SRC_RTC;
    GPT_CLK_DIV clkDiv = GPT_CLK_DIV_1;
    config.num = gpt_num;
    config.mode = GPT_REPEAT;
    config.clkSrc = clkSrc;
    config.clkDiv = clkDiv;
    config.u4CompareL = 1;  //here we set it 32K
    config.u4CompareH = 0;
    config.bIrqEnable = TRUE;
    if(GPT_Config(config)==FALSE)
        return -1;
    GPT_Start(gpt_num);
}
#endif

    
#endif

}

// ---------------------------------------------------------------------------
//  Get LCM Driver Hooks
// ---------------------------------------------------------------------------
    LCM_DRIVER ili9806e_lcm_drv =
    {
	.name           = "ili9806e",
        .set_util_funcs = lcm_set_util_funcs,
        .get_params     = lcm_get_params,
        .init           = lcm_init,
	//.set_backlight	= lcm_setbacklight,
        .suspend        = lcm_suspend,
        .resume         = lcm_resume
    };

 

参考:

MTK Android Driver:lcm

http://blog.csdn.net/cbk861110/article/details/17438835

 

MIPI DBI\DPI\DSI简介

http://blog.csdn.net/codectq/article/details/11763765

 

Mtk android LCD开机启动过程

http://blog.csdn.net/wilsonboliu/article/details/21733247

 

 

你可能感兴趣的:(MTK6577+Android增加支持新显示屏的显示)