2.6.31内核中已经有很完善的LCD驱动了,只要根据所用的LCD进行简单的修改即可
1、修改drivers/video/s3c2410fb.c的365行左右的函数,设置LCD的时钟频率
static void s3c2410fb_activate _var(struct fb_info *info)
{
struct s3c2410fb_info *fbi = info->par;
void __iomem *regs = fbi->io;
int type = fbi->regs.lcdcon1 & S3C2410_LCDCON1_TFT;
struct fb_var_screeninfo *var = &info->var;
struct s3c2410fb_mach_info *mach_info = fbi->dev->platform_data;
struct s3c2410fb_display *default_display = mach_info->displays + mach_info->default_display;
int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2;
dprintk("%s: var->xres = %d\n", __func__, var->xres);
dprintk("%s: var->yres = %d\n", __func__, var->yres);
dprintk("%s: var->bpp = %d\n", __func__, var->bits_per_pixel);
if (type == S3C2410_LCDCON1_TFT) {
s3c2410fb_calculate_tft_lcd_regs(info, &fbi->regs);
--clkdiv;
if (clkdiv < 0)
clkdiv = 0;
} else {
s3c2410fb_calculate_stn_lcd_reg s(info, &fbi->regs);
if (clkdiv < 2)
clkdiv = 2;
}
// fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(clkdiv);
fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(default_display->setclkval);
2、修改arch/arm/mach-s3c2410/include/mach/fb.h文件的第40行左右,在s3c2410fb_display结构体中加入了setclkval 变量
unsigned setclkval; /*clkval*/
3、从所用LCD的手册中查找相关参数,修改 arch/arm/mach-s3c2440/mach-smdk2440.c 中第 107 行左右的结构体
static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = 480,
.height = 272 ,
.pixclock = 40000, /* HCLK 60 MHz, divisor 10 */
.setclkval = 0x4 ,
.xres = 480,
.yres= 272,
.bpp = 16,
.left_margin = 19,
.right_margin = 10,
.hsync_len = 30,
.upper_margin = 4,
.lower_margin = 2,
.vsync_len = 8,
};
屏蔽掉第 150 行的语句:
// .lpcsel = ((0xCE6) & ~7) | 1<<4,
4、在内核根目录执行命令make menuconfig配置内核支持LCD
Device Drivers:
Graphics Support --->
<*>support for frame buffer devices --->
[*] Enable frameware EDID
[*] Enable Vidoe Mode Handling Helpers
<*> S3C24X0 LCD framebuffer support
Console display driver support --->
<*> Framebuffer Console Support
启动时输出:
Console: switching to colour frame buffer device 40x30
fb0: s3c2410fb frame buffer device
阅读(1188) | 评论(0) | 转发(0) |