72 DBI接口HVGA TE问题!
另外开了TE功能还是会出现切屏现像,通过示波器测量TE引脚输出的信号是正常的,不知兄弟们有何高招?驱动如下:hx8357d
#ifdef BUILD_LK
#else
#include <linux/kernel.h>
#include <linux/string.h>
#endif
#include "LCM_drv.h"
// ---------------------------------------------------------------------------
// Local Constants
// ---------------------------------------------------------------------------
#define FRAME_WIDTH (320)
#define FRAME_HEIGHT (480)
#define LCM_ID (0x99)
// ---------------------------------------------------------------------------
// Local Variables
// ---------------------------------------------------------------------------
static LCM_UTIL_FUNCS lcm_util = {0};
#define SET_RESET_PIN(v) (lcm_util.set_reset_pin((v)))
#define UDELAY(n) (lcm_util.udelay(n))
#define MDELAY(n) (lcm_util.mdelay(n))
// ---------------------------------------------------------------------------
// Local Functions
// ---------------------------------------------------------------------------
static __inline unsigned int read_data_cmd()
{
return lcm_util.read_data();
}
static __inline void send_ctrl_cmd(unsigned int cmd)
{
lcm_util.send_cmd(cmd);
}
static __inline void send_data_cmd(unsigned int data)
{
lcm_util.send_data(data);
}
static __inline void set_lcm_register(unsigned int regIndex,
unsigned int regData)
{
send_ctrl_cmd(regIndex);
send_data_cmd(regData);
}
static void init_lcm_registers(void)
{
send_ctrl_cmd(0xB9); //EXTC
send_data_cmd(0xFF); //EXTC
send_data_cmd(0x83); //EXTC
send_data_cmd(0x57); //EXTC
MDELAY(5);
send_ctrl_cmd(0x35);
send_data_cmd(0x00); // TE ON
//send_ctrl_cmd(0X0044); // Set TE signal delay scanline
send_ctrl_cmd(0xB6);
send_data_cmd(0x09); //VCOMDC CTC 4C 30
send_ctrl_cmd(0x3A);
send_data_cmd(0x55); // 55 65K 66 262k
send_ctrl_cmd(0xB0);
send_data_cmd(0x68); //70Hz
send_ctrl_cmd(0xCC); // Set Panel
send_data_cmd(0x09); //
send_ctrl_cmd(0xB1); //
send_data_cmd(0x00); //
send_data_cmd(0x11); //BT
send_data_cmd(0x1c); //VSPR
send_data_cmd(0x1c); //VSNR
send_data_cmd(0xc3); //AP
send_data_cmd(0x33); //FS
send_ctrl_cmd(0xB4); //
send_data_cmd(0x02); //NW
send_data_cmd(0x40); //RTN
send_data_cmd(0x00); //div
send_data_cmd(0x2A); //DUM
send_data_cmd(0x2A); //DUM
send_data_cmd(0x12); //GDON
send_data_cmd(0x4A); //GDOFF
send_ctrl_cmd(0xC0); //STBA
send_data_cmd(0x36); //OPON
send_data_cmd(0x36); //OPON
send_data_cmd(0x00); //
send_data_cmd(0x3C); //
send_data_cmd(0xc8); //
send_data_cmd(0x08); //GEN
send_ctrl_cmd(0xC2); //STBA
send_data_cmd(0x00); //OPON
send_data_cmd(0x04); //OPON
send_data_cmd(0x04); //
send_ctrl_cmd(0xE0); //Set Gamma
send_data_cmd(0x00);
send_data_cmd(0x04);
send_data_cmd(0x0D);
send_data_cmd(0x16);
send_data_cmd(0x1C);
send_data_cmd(0x2D);
send_data_cmd(0x3B);
send_data_cmd(0x48);
send_data_cmd(0x4C);
send_data_cmd(0x42);
send_data_cmd(0x32);
send_data_cmd(0x1A);
send_data_cmd(0x15);
send_data_cmd(0x03);
send_data_cmd(0x02);
send_data_cmd(0x01);
send_data_cmd(0x00);
send_data_cmd(0x04);
send_data_cmd(0x0D);
send_data_cmd(0x16);
send_data_cmd(0x1C);
send_data_cmd(0x2D);
send_data_cmd(0x3B);
send_data_cmd(0x48);
send_data_cmd(0x4C);
send_data_cmd(0x42);
send_data_cmd(0x32);
send_data_cmd(0x1A);
send_data_cmd(0x15);
send_data_cmd(0x03);
send_data_cmd(0x02);
send_data_cmd(0x01);
send_data_cmd(0xE0);
send_data_cmd(0x01);
send_ctrl_cmd(0x36); //
send_data_cmd(0xC0);
send_ctrl_cmd(0xEA); //鏂板姞涓婅В鍐冲垏灞?
send_data_cmd(0x03);
send_ctrl_cmd(0x44); //鏂板姞涓婅В鍐冲垏灞?
send_data_cmd(0x00);
send_data_cmd(0xC8);
send_ctrl_cmd(0x21); // Display inversion on
send_ctrl_cmd(0x11); // SLPOUT
MDELAY(150);
send_ctrl_cmd(0x29); // Display On
//MDELAY(25);
}
// ---------------------------------------------------------------------------
// 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_DBI;
params->ctrl = LCM_CTRL_PARALLEL_DBI;
params->width = FRAME_WIDTH;
params->height = FRAME_HEIGHT;
params->io_select_mode = 1; //note:this para is different between 6573 and 6575
params->dbi.port = 0; //DBI port must be 0 or 1 on MT6575, should not be 2
params->dbi.clock_freq = LCM_DBI_CLOCK_FREQ_52M;
params->dbi.data_width = LCM_DBI_DATA_WIDTH_8BITS;
params->dbi.data_format.color_order = LCM_COLOR_ORDER_RGB;
params->dbi.data_format.trans_seq = LCM_DBI_TRANS_SEQ_MSB_FIRST;
params->dbi.data_format.padding = LCM_DBI_PADDING_ON_MSB;
params->dbi.data_format.format = LCM_DBI_FORMAT_RGB565;
params->dbi.data_format.width = LCM_DBI_DATA_WIDTH_8BITS;
params->dbi.cpu_write_bits = LCM_DBI_CPU_WRITE_8_BITS;
params->dbi.io_driving_current = LCM_DRIVING_CURRENT_4MA;
params->dbi.te_mode = LCM_DBI_TE_MODE_VSYNC_ONLY;
params->dbi.te_edge_polarity = LCM_POLARITY_FALLING;
params->dbi.parallel.write_setup = 2;
params->dbi.parallel.write_hold = 2;
params->dbi.parallel.write_wait = 7;
params->dbi.parallel.read_setup = 3;
params->dbi.parallel.read_hold = 7;
params->dbi.parallel.read_latency = 31;
params->dbi.parallel.wait_period = 2;
}
static void lcm_init(void)
{
SET_RESET_PIN(0);
MDELAY(25);
SET_RESET_PIN(1);
MDELAY(50);
init_lcm_registers();
#if 0
//Set TE register
send_ctrl_cmd(0x35);
send_data_cmd(0x00);
send_ctrl_cmd(0X0044); // Set TE signal delay scanline
send_data_cmd(0X0000); // Set as 0-th scanline
send_data_cmd(0X0000);
//sw_clear_panel(0);
#endif
}
static void lcm_suspend(void)
{
send_ctrl_cmd(0x10);
MDELAY(120);
send_ctrl_cmd(0x28);
}
static void lcm_resume(void)
{
send_ctrl_cmd(0x11);
MDELAY(120);
send_ctrl_cmd(0x29);
}
static void lcm_update(unsigned int x, unsigned int y,
unsigned int width, unsigned int height)
{
unsigned short x0, y0, x1, y1;
unsigned short h_X_start,l_X_start,h_X_end,l_X_end,h_Y_start,l_Y_start,h_Y_end,l_Y_end;
x0 = (unsigned short)x;
y0 = (unsigned short)y;
x1 = (unsigned short)x+width-1;
y1 = (unsigned short)y+height-1;
h_X_start=((x0&0xFF00)>>8);
l_X_start=(x0&0x00FF);
h_X_end=((x1&0xFF00)>>8);
l_X_end=(x1&0x00FF);
h_Y_start=((y0&0xFF00)>>8);
l_Y_start=(y0&0x00FF);
h_Y_end=((y1&0xFF00)>>8);
l_Y_end=(y1&0x00FF);
send_ctrl_cmd(0x2A);
send_data_cmd(h_X_start);
send_data_cmd(l_X_start);
send_data_cmd(h_X_end);
send_data_cmd(l_X_end);
send_ctrl_cmd(0x2B);
send_data_cmd(h_Y_start);
send_data_cmd(l_Y_start);
send_data_cmd(h_Y_end);
send_data_cmd(l_Y_end);
send_ctrl_cmd(0x29);
send_ctrl_cmd(0x2C);
}
void lcm_setbacklight(unsigned int level)
{
if(level > 255) level = 255;
send_ctrl_cmd(0x51);
send_data_cmd(level);
}
static unsigned int lcm_compare_id(void)
{
unsigned int id[4] = {0};
unsigned int model;
model = 0;
send_ctrl_cmd(0xB9);
send_data_cmd(0xFF);
send_data_cmd(0x83);
send_data_cmd(0x57);
send_ctrl_cmd(0xD0);
id[0] = read_data_cmd();
id[1] = read_data_cmd();
id[2] = read_data_cmd();
id[3] = read_data_cmd();
#ifdef BUILD_LK
printf("hx8357d %s id = 0x%x 0x%x 0x%x 0x%x\n", __func__, id[0], id[1], id[2], id[3]);
#endif
model = id[1];
return (LCM_ID == model)?1:0;
}
LCM_DRIVER hx8357d_lcm_drv =
{
.name = "hx8357d_lcm_drv",
.set_util_funcs = lcm_set_util_funcs,
.get_params = lcm_get_params,
.init = lcm_init,
.suspend = lcm_suspend,
.resume = lcm_resume,
.update = lcm_update,
.compare_id = lcm_compare_id
};
TE的极性是不是不对?
如何查看极性,群主可能72调好的HVGA文件发个
typedef enum
{
LCM_POLARITY_RISING = 0,
LCM_POLARITY_FALLING = 1
} LCM_POLARITY;
就这两个极性,你都可以试一下。
MT6572只能使用内部TE了。
你搜一下:
dsiTeEnable
将这个设置为TRUE就是打开TE了,将这个设置为FLASH就是关TE了。
屏的TE是0X35(反正我们这边是这个,你的我不知道了)
开关不是在屏的驱动里面, params->dbi.te_mode = 0;
这个控制么
喔,这个是模式哈,我刚搜了下 disTeEnable 发现只有dsi_drv.c才有用到。
没调过的路过
72不支持外部的te
所以屏驱动的地方,那个te要是disable的。
直接 params->dbi.te_mode = 0;这样么,那切屏严重咋解决呢
你的切屏问题解决了吗?
没有呢,兄弟有啥高招没
也没有。
我们现在一个3.5寸的屏,也是遇到了这个问题。
主要是开TE功能不开机,切屏还好搞
就是切屏搞不定。
te是72不支持外部te,所以打开external te设置为true的时候会重启。
internal te是打开的。
external te设置为true 这个是在哪个文件?
就是屏驱动里面,可以自己加
没加,还是重启
params->dbi.te_mode =LCM_DBI_TE_MODE_DISABLED;
这样就不会重启了;
params->dbi.parallel.write_setup = 2;
params->dbi.parallel.write_hold = 2;
params->dbi.parallel.write_wait = 7;
修改上面三组参数,降低刷新帧率试试