Linux下移植LCD驱动



使用Linux3.2.81内核

4.3LCD

 

  1. 修改arch/arm/mach-s3c2440/mach-smdk2440.c

    staticstruct 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,

    //根据LCD数据手册

    .width                = 480,

    .height               = 272,

     

    .pixclock   = 101111,        

     .xres        = 480,

    .yres                   = 272,

    .bpp          = 16,

    .left_margin     = 2,  /* for HFPD*/

    .right_margin  = 2,   /* for HBPD*/

    .hsync_len        = 42,         /*for HSPW*/

    .upper_margin         = 2,    /* for VFPD*/

    .lower_margin          = 2,   /* for VBPD*/

    .vsync_len         = 10,         /*for VSPW*/

    };

     

    pixclock的计算:
    DOTCLK = fframe × (X + HBP + HFP+HSPW) × (Y +VBP + VFP+VSPW)  //fframe
    是屏幕刷新频率(本开发板60HZ

     

     

    staticstruct s3c2410fb_mach_info smdk2440_fb_info __initdata = {

    .displays  =&smdk2440_lcd_cfg,

    .num_displays =1,

    .default_display = 0,

     

    //#if 0

    /* currently setup bydownloader */

    .gpccon             = 0xaaaaaaaa,

    .gpccon_mask = 0xffffffff,

    .gpcup               = 0xffffffff,

    .gpcup_mask   = 0xffffffff,

    .gpdcon             = 0xaaaaaaaa,

    .gpdcon_mask = 0xffffffff,

    .gpdup               = 0xffffffff,

    .gpdup_mask   = 0xffffffff,

    //#endif

     

    //.lpcsel             = ((0xCE6) & ~7) | 1<<4,   //这是三星的LCD才会使用到的

    };

     

     

    staticvoid __init smdk2440_machine_init(void)

    {

    s3c24xx_fb_set_platdata(&smdk2440_fb_info);

    s3c_i2c0_set_platdata(NULL);

    //添加下面三行

    writel((readl(S3C2410_GPBCON)& ~(3)) | 1, S3C2410_GPBCON);

    writel((readl(S3C2410_GPBDAT)| 1), S3C2410_GPBDAT);      //背光控制

    writel((readl(S3C2410_GPGCON)| (3<<8)), S3C2410_GPGCON);  //电源控制

     

    platform_add_devices(smdk2440_devices,ARRAY_SIZE(smdk2440_devices));

    smdk_machine_init();

    }

    并且添加#include 头文件

 

  1. 执行make menuconfig

    Device Driversà

               Graphicssupportà

                        <*>Support for frame buffer devicesà

                                 [*]   Enable firmware EDID

                                 -*-   Enable Video Mode Handling Helpers

                                 <*> S3C24X0 LCD framebuffer support

                        Consoledisplay driver supportà

                                 <*>Framebuffer Console support

                                 [*]Select compiled-in fonts

                                 [*]   VGA 8x8 font

                                 [*]   VGA 8x16 font

                        [*]Bootup logoà

                                 [*]   Standard 224-color Linux logo

3、编译重新下载

注意:屏幕没显示是因为没有初始化电源控制脚和背光控制脚。

你可能感兴趣的:(Linux驱动)