分类: 嵌入式
2010-08-14 10:27:26
嵌入式学习入门 http://blog.chinaunix.net/u3/117680/showart.php?id=2300212
, 文章——>嵌入式学习入门 全面的讲述学习嵌入式linux中的每个步骤
内核里已经有很完善的LCD驱动了,只要根据所用的LCD进行简单的修改,在内核源码drivers/video/s3c2410fb.c是LCD驱动的源码,首先要设置LCD的时钟频率,有一个计算公式,很复杂,不用管它,直接修改程序实现。
在第365行开始的函数:
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_regs(info, &fbi->regs);
if (clkdiv < 2)
clkdiv = 2;
}
// fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(clkdiv);
fbi->regs.lcdcon1 |=
S3C2410_LCDCON1_CLKVAL(default_display->setclkval);
这几句是在s3c2410fb_display结构体中加入了setclkval变量,我们需要在结构体原型中加入这个变量,在arch/arm/mach-s3c2410/include/mach/fb.h中第40行加入:unsigned setclkval; /*clkval*/
修改LCD参数配置:(这个要查看所用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 = 320,
.height = 240,
.pixclock = 100000, /* HCLK 60 MHz, divisor 10 */
.setclkval = 0x3, /*add by xgc*/
.xres = 320,
.yres = 240,
.bpp = 16,
.left_margin = 19,
.right_margin = 24,
.hsync_len = 44,
.upper_margin = 7,
.lower_margin = 5,
.vsync_len = 15,
};
屏蔽掉第150行的语句:
// .lpcsel = ((0xCE6) & ~7) | 1<<4,
2. 配置内核选项。选上LCD支持和Logo图标
|