或以为孤权重,妄相忖度
分类: LINUX
2009-06-15 11:20:55
Linux2.6.26.8 移植之五:lcd驱动的移植
Kernel version :2.6.26.8
Crosstool :arm-linux-gcc-3.4.1
LCD type :LQ035Q7DH01_SHARP
Author :iNtone.Huang(hyd)
一、修改/arch/arm/mach-s3c2410/mach-smdk2410.c文件
1、添加头文件
#include
2、添加初始化s3c2410的LCD控制器时所需的参数(copy from/arch/arm/mach-s3c2410/mach-qt2410.c,稍作修改)。
/* LCD driver info */
static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
{
/* Configuration for 640x480 SHARP LQ080V3DG01 */
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = 640,
.height = 480,
.pixclock = 40000, /* HCLK/4 */
.xres = 640,
.yres = 480,
.bpp = 16,
.left_margin = 44,
.right_margin = 116,
.hsync_len = 96,
.upper_margin = 19,
.lower_margin = 11,
.vsync_len = 15,
},
{
/* Configuration for 480x640 toppoly TD028TTEC1 */
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = 480,
.height = 640,
.pixclock = 40000, /* HCLK/4 */
.xres = 480,
.yres = 640,
.bpp = 16,
.left_margin = 8,
.right_margin = 24,
.hsync_len = 8,
.upper_margin = 2,
.lower_margin = 4,
.vsync_len = 2,
},
{
/* Config for 240x320 LCD 这是我们的液晶屏,以下参数经过测试验证2009-5-6*/
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = 240,
.height = 320,
.pixclock = 100000, /* HCLK/10 */
.xres = 240,
.yres = 320,
.bpp = 16,
.hsync_len = 18,
.left_margin = 3,
.right_margin = 13,
.vsync_len = 3,
.upper_margin = 2,
.lower_margin = 7,
};
static struct s3c2410fb_mach_info qt2410_fb_info __initdata = {
.displays = qt2410_lcd_cfg,
.num_displays = ARRAY_SIZE(qt2410_lcd_cfg),
.default_display = 2, /*hyd 0417,orignal value:0*/
.gpccon =0xaa9556a9,
.gpccon_mask =0xffc003cc,
.gpcup = 0x0000ffff,
.gpdcon =0xaa95aaa1,
.gpdcon_mask =0xffc0fff0,
.gpdup = 0x0000faff,
.lpcsel = 0xf82,
};
3、添加LCD控制器的寄存器参数设置函数
static void __init smdk2410_init(void)
{
s3c24xx_fb_set_platdata(&qt2410_fb_info);//该函数在fb.H中
platform_add_devices(smdk2410_devices,ARRAY_SIZE(smdk2410_devices));
smdk_machine_init();
}
4、网上有一种说法,注释掉drivers\char\vt.c的blank_screen_t(unsigned long dummy)的函数内容,否则,lcd会在10分钟左右关掉显示(我没有遇到这个问题)。
二、修改linux/drivers/video/s3c2410fb.c(h:388)
//fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(clkdiv);
fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(4); //Modified by hyd
说明:由于clkdiv的计算稍微有点复杂(与上面那个结构qt2410_lcd_cfg中的pixclock的值有关),所以这里直接取值4(即是说与pixclock的取值无关),关于这部分的具体运算请参考S3C2410 datasheet中LCD部分。
三、配置内核
Device Drivers --->
Graphics support --->
Display device support --->
<*> Display panel/monitor support
<*> Support for frame buffer devices
<*> S3C2410 LCD framebuffer support
Console display driver support --->
<*> Framebuffer Console support
[*] Framebuffer Console Rotation
[*] Select compiled-in fonts
[*] VGA 8x8 font
[*] VGA 8x16 font
[*] Mini 4x6 font
[*] Sparc console 8x16 font
[*] Bootup logo --->
--- Bootup logo
[*] Standard 224-color Linux logo
四、自定义Logo的方法:
(1)使用The GIMP 图像编辑器打开你想要的图像文件,依次选择图像->模式->索引颜色,将颜色改为224色;至于图片大小,不要大于你的显示器分辨率就好,最后将文件保存为ppm格式(ASCii码),文件名为:logo_linux_clut224.ppm。
(2)将logo_linux_clut224.ppm拷贝到/drivers/video/logo文件夹下,替换原有的文件。
(3)重新编译内核,tftp下载到开发板重新启动。