您的位置:首页 > 其它

LCD驱动移植

2012-04-07 12:48 253 查看
LCD驱动移植

做这个驱动移植花了我一个晚上和一个早上,太他吗蛋痛了,但做出来后就很高兴啦!!!学习本身就是烦恼与快乐并存的过程。。。。。。

好了,不多说了,下面说说我的移植过程:

我的开发板是Mini2440的,LCD是宽屏的,上面标注W35

(1)gedit arch/arm/mach-s3c2440/mach-smdk2440.c,先删除之前的 LCD 设备平台代码,如

下:

/* LCD driver info */

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,

.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 smdk2440_fb_info __initdata = {

.displays = &smdk2440_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,

再把囯嵌移植好的代码加入,如下:

/* LCD driver info */

//W 3.5”LCD 的配置和参数设置

#if defined(CONFIG_FB_S3C2410_T240320) //注:下面的宏定义的参数十分重要,一定要根据你的屏类型设置,否则会出现显示不满屏等许多现象。

#define LCD_WIDTH 320

#define LCD_HEIGHT 240

#define LCD_PIXCLOCK 170000

#define LCD_RIGHT_MARGIN 0x44

#define LCD_LEFT_MARGIN 0x04

#define LCD_HSYNC_LEN 0x01

#define LCD_UPPER_MARGIN 10

#define LCD_LOWER_MARGIN 4

#define LCD_VSYNC_LEN 1

#endif

#if defined (LCD_WIDTH)

#endif

static struct s3c2410fb_display smdk2440_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 smdk2440_fb_info __initdata = {

.displays = &smdk2440_lcd_cfg,

.num_displays = 1,

.default_display = 0,

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,

};

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

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

endchoice

(3)配置使支持LCD

到你的内核源代码顶层目录 make menuconfig

Device Drivers --->

Graphics support --->

<*> Support for frame buffer devices --->

LCD select (3.5 inch 240X320 Toppoly LCD) --->



如图选上

再次提醒大家一定要注意屏的参数设置!!!

配置完保存退出,再编译内核。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: