Linux2.6.26.5加入TFT-LCD驱动

作者:孙晓明,华清远见嵌入式学院讲师。

首先下载内核源码,我这里用的是linux-2.6.26.5的内核源码。

(1) 在arch/arm/mach-s3c2410/mach-smdk2410.c里添加头文件:

    #include <asm/arch/fb.h>

(2) 在arch/arm/ plat-s3c24xx / common-smdk.c文件中添加如下信息:

    #include <asm/arch/fb.h>

然后添加如下代码:

static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
        {
             .lcdcon5 = S3C2410_LCDCON5_FRM565 |
                 S3C2410_LCDCON5_INVVCLK|
                 S3C2410_LCDCON5_INVVLINE |
                 S3C2410_LCDCON5_INVVFRAME |
                 S3C2410_LCDCON5_PWREN |
                 S3C2410_LCDCON5_HWSWP,
             .type = S3C2410_LCDCON1_TFT,
             .width = 320,
             .height = 240,
             .pixclock = 100000, /* HCLK/10 */
             .xres = 320,
             .yres = 240,
             .bpp = 16,
             .left_margin = 13,
             .right_margin = 8,
             .hsync_len = 4,
             .upper_margin = 2,
             .lower_margin = 7,
             .vsync_len = 4,
        }
    };

static struct s3c2410fb_mach_info qt2410_fb_info __initdata = {
             .displays = qt2410_lcd_cfg,
             .num_displays = ARRAY_SIZE(qt2410_lcd_cfg),
             .default_display = 0,
             .lpcsel = ((0xCE6) & ~7) | 1<<4,
        };

在smdk_machine_init函数里添加:

s3c24xx_fb_set_platdata(&qt2410_fb_info);

(3) 重新配置内核

# make menuconfig
    Device Drivers
    Graphics support→
       Support for frame buffer devices→

Linux2.6.26.5加入TFT-LCD驱动_第1张图片

(4) 重新编译内核

#make zImage

这样你新编译的内核就支持LCD驱动了。

你可能感兴趣的:(Linux2.6.26.5加入TFT-LCD驱动)