嵌入式Linux的LCD驱动(FB @ s3c2410)

2019-07-13 00:41发布

CPU : ARM9 s3c2410 

LCD : 规格不明(这个很无奈,但是我所知道的只有一个分辨率)

源码修改:

/linux-2.6.30.4/arch/arm/mach-s3c2410/mach-smdk2410.c

        在这个文件中加入framebuffer的初始化数据结构(具体数据参照LCD技术手册)如下:
#include // added by B.Zhou for the LCD driver   /* The info of LCD driver start */

static struct s3c2410fb_display smdk2410_lcd_cfg __initdata = {

    .lcdcon5    = S3C2410_LCDCON5_FRM565 |
              S3C2410_LCDCON5_INVVLINE |
              S3C2410_LCDCON5_INVVFRAME |
              S3C2410_LCDCON5_PWREN |
              S3C2410_LCDCON5_HWSWP,

    .type        = S3C2410_LCDCON1_TFT,
    .width        = 800,
    .height        = 480,

    .pixclock    = 174757, //40000, /* HCLK/4 */
    .xres        = 800,
    .yres        = 480,
    .bpp        = 16,
    .left_margin    = 7,
    .right_margin    = 3,
    .hsync_len    = 5,
    .upper_margin    = 1,
    .lower_margin    = 3,
    .vsync_len    = 1,
};

static struct s3c2410fb_mach_info smdk2410_fb_info __initdata = {

    .displays        = &smdk2410_lcd_cfg,
    .num_displays        = 1,
    .default_display    = 0,
    .lpcsel        = 0x0,
};
          找到这个文件中的设备初始化函数,并在其中添加对于LCD设备初始化:   static void __init smdk2410_init(void)
{ #if 1 //added by B.Zhou for theLCD framebuffer
    s3c24xx_fb_set_platdata(&smdk2410_fb_info);
#endif

    s3c_i2c0_set_platdata(NULL);
    platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
    smdk_machine_init();
}           源码修改就这么多,我所做过的最简单的设备移植。(当然要把资料不足排除在外)

配置内核:

make menuconfig   Device Drivers  ---> 
    Graphics support  --->
        <*> Support for frame buffer devices --->
        <*> S3C2410 LCD framebuffer support 
            Display device support  --->
                   <*> Display panel/monitor 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            至此,LCD驱动添加结束。