Linux-2.6.32.2内核在mini2440上的移植(六)---LCD驱动移植

 

Linux-2.6.32.2内核在mini2440上的移植(六)---LCD驱动移植  

【3】在内核中添加各种LCD 类型的支持

打开 arch/arm/mach-s3c2440/mach-mini2440.c,定位到114行到157行之间,先删除之前的LCD 设备平台代码,如下:

/* LCD driver info */

static struct s3c2410fb_display mini2440_lcd_cfg __initdata = {

 .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 = 166667, /* HCLK 60 MHz, divisor 10 */
 .xres  = 240,
 .yres  = 320,
 .bpp  = 16,
 .left_margin = 20,
 .right_margin = 8,
 .hsync_len = 4,
 .upper_margin = 8,
 .lower_margin = 7,
 .vsync_len = 4,
};

static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
 .displays = &mini2440_lcd_cfg,
 .num_displays = 1,
 .default_display = 0,

#if 0
 /* currently setup by downloader */
 .gpccon  = 0xaa940659,
 .gpccon_mask = 0xffffffff,
 .gpcup  = 0x0000ffff,
 .gpcup_mask = 0xffffffff,
 .gpdcon  = 0xaa84aaa0,
 .gpdcon_mask = 0xffffffff,
 .gpdup  = 0x0000faff,
 .gpdup_mask = 0xffffffff,
#endif

 .lpcsel  = ((0xCE6) & ~7) | 1<<4,
};
再把友善之臂已经移植好的代码加入,如下:

//;NEC 3.5”LCD 的配置和参数设置
#if defined(CONFIG_FB_S3C2410_N240320)
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_PIXCLOCK 100000
#define LCD_RIGHT_MARGIN 36
#define LCD_LEFT_MARGIN 19
#define LCD_HSYNC_LEN 5
#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 5
#define LCD_VSYNC_LEN 1
//;夏普8”LCD 的配置和参数设置
#elif defined(CONFIG_FB_S3C2410_TFT640480)
#define LCD_WIDTH 640
#define LCD_HEIGHT 480
#define LCD_PIXCLOCK 80000
#define LCD_RIGHT_MARGIN 67
#define LCD_LEFT_MARGIN 40
#define LCD_HSYNC_LEN 31
#define LCD_UPPER_MARGIN 25
#define LCD_LOWER_MARGIN 5
#define LCD_VSYNC_LEN 1
//;统宝3.5”LCD 的配置和参数设置
#elif defined(CONFIG_FB_S3C2410_T240320)
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_PIXCLOCK 146250//170000
#define LCD_RIGHT_MARGIN 25
#define LCD_LEFT_MARGIN 0
#define LCD_HSYNC_LEN 4
#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 4
#define LCD_VSYNC_LEN 1
//;群创7”LCD 的配置和参数设置
#elif defined(CONFIG_FB_S3C2410_TFT800480)
#define LCD_WIDTH 800
#define LCD_HEIGHT 480
#define LCD_PIXCLOCK 11463//40000
#define LCD_RIGHT_MARGIN 67
#define LCD_LEFT_MARGIN 40
#define LCD_HSYNC_LEN 31
#define LCD_UPPER_MARGIN 25
#define LCD_LOWER_MARGIN 5
#define LCD_VSYNC_LEN 1
//;LCD2VGA(分辨率为1024x768)模块的配置和参数设置
#elif defined(CONFIG_FB_S3C2410_VGA1024768)
#define LCD_WIDTH 1024
#define LCD_HEIGHT 768
#define LCD_PIXCLOCK 80000
#define LCD_RIGHT_MARGIN 15
#define LCD_LEFT_MARGIN 199
#define LCD_HSYNC_LEN 15
#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 1
#define LCD_VSYNC_LEN 1
#define LCD_CON5 (S3C2410_LCDCON5_FRM565 | S3C2410_LCDCON5_HWSWP)
#endif
#if defined (LCD_WIDTH)
static struct s3c2410fb_display mini2440_lcd_cfg __initdata = {
#if !defined (LCD_CON5)
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_PWREN |
S3C2410_LCDCON5_HWSWP,
#else
.lcdcon5 = LCD_CON5,
#endif
.type = S3C2410_LCDCON1_TFT,
.width = LCD_WIDTH,
.height = LCD_HEIGHT,
.pixclock = LCD_PIXCLOCK,
.xres = LCD_WIDTH,
.yres = LCD_HEIGHT,
.bpp = 16,
.left_margin = LCD_LEFT_MARGIN + 1,
.right_margin = LCD_RIGHT_MARGIN + 1,
.hsync_len = LCD_HSYNC_LEN + 1,
.upper_margin = LCD_UPPER_MARGIN + 1,
.lower_margin = LCD_LOWER_MARGIN + 1,
.vsync_len = LCD_VSYNC_LEN + 1,
};
static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
.displays = &mini2440_lcd_cfg,
.num_displays = 1,
.default_display = 0,
.gpccon = 0xaa955699,
.gpccon_mask = 0xffc003cc,
.gpcup = 0x0000ffff,
.gpcup_mask = 0xffffffff,
.gpdcon = 0xaa95aaa1,
.gpdcon_mask = 0xffc0fff0,
.gpdup = 0x0000faff,
.gpdup_mask = 0xffffffff,
.lpcsel = 0xf82,
};
#endif

然后打开drivers/video/Kconfig,在大概1930 行加入以下配置信息:

config FB_S3C2410_DEBUG
 bool "S3C2410 lcd debug messages"
 depends on FB_S3C2410
 help
   Turn on debugging messages. Note that you can set/unset at run time
   through sysfs
choice
 prompt "LCD select"
 depends on FB_S3C2410
 help
  S3C24x0 LCD size select

config FB_S3C2410_T240320
 boolean "3.5 inch 240X320 Toppoly LCD"
 depends on FB_S3C2410
 help
  3.5 inch 240X320 Toppoly LCD

config FB_S3C2410_N240320
 boolean "3.5 inch 240X320 NEC LCD"
 depends on FB_S3C2410
 help
  3.5 inch 240x320 NEC LCD

config FB_S3C2410_TFT640480
 boolean "8 inch 640X480 L80 LCD"
 depends on FB_S3C2410
 help
  8 inch 640X480 LCD

config FB_S3C2410_TFT800480
 boolean "7 inch 800x480 TFT LCD"
 depends on FB_S3C2410
 help
  7 inch 800x480 TFT LCD

config FB_S3C2410_VGA1024768
 boolean "VGA 1024x768"
 depends on FB_S3C2410
 help
  VGA 1024x768

endchoice

config FB_SM501
 tristate "Silicon Motion SM501 framebuffer support"
 depends on FB && MFD_SM501
 select FB_CFB_FILLRECT
 select FB_CFB_COPYAREA

定位到326行附近,在初始化部分加入:

static void __init mini2440_map_io(void)
{
 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
 s3c24xx_init_clocks(12000000);
 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
 
}

static void __init mini2440_machine_init(void)
{
#if defined (LCD_WIDTH)
 s3c24xx_fb_set_platdata(&mini2440_fb_info);
#endif
 s3c_i2c0_set_platdata(NULL);
 s3c_device_nand.dev.platform_data = &mini2440_nand_info;
 platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
 //smdk_machine_init();
}

这样,我们就完成了LCD 驱动的移植,如果你需要加入其他型号的LCD 驱动,也可以参照上面的方式复制即可,一般小尺寸的pixclock 参数可以参考统宝3.5”的,超过640x480分辨率的参数可以参考8”LCD 的,特别要注意你使用的LCD 的长宽也要修改。

【4】配置内核并下载到开发板测试

现在,我们在命令行输入:make menuconfig 进入内核配置,依次按下面的子菜单项选择:

Device Drivers --->
    Graphics support --->
        <*> Support for frame buffer devices --->
            LCD select (3.5 inch 240X320 Toppoly LCD) --->

               (X) 3.5 inch 240X320 Toppoly LCD    //选择统宝3.5寸液晶

    Console display driver support  ---> 

         <*> Framebuffer Console support   //支持Framebuffer控制台

         [*] Select compiled-in fonts  //选择字库,默认VGA 8x8 , VGA 8x16

        [*]   VGA 8x8 font  

        [*]   VGA 8x16 font 

    [*] Bootup logo  ---> 

         [*]   Standard 224-color Linux logo  

 按空格或者回车键选择我们需要的 LCD 型号,然后退出保存内核配置。
在命令行执行:
#make uImage
将会生成arch/arm/boot/zImage,把它烧写到开发板中,就可以看到一个小企鹅出现在屏幕上了,如图

Linux-2.6.32.2内核在mini2440上的移植(七)---LCD驱动移植 - singleboy - singleboy的博客

而且logo左下方有一个光标提示符在闪动。

接下来,将要为内核添加ADC驱动

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值