Linux下移植LCD驱动(2440)

Kernel:Linux3.2.81

LCD尺寸:4.3寸LCD

开发板:JZ2440

移植

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

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,    //根据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

static struct 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才会使用到的};
static void __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 <asm/io.h>头文件

2. 执行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、编译重新下载

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

喜欢这篇文章,欢迎点赞,分享,关注

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年9月15日
下一篇 2021年9月15日

相关推荐