说明:本篇博客 参考tq linux 移植手册中的内容,只是自己学习过程中的记录。
1.简化LCD时钟计算方法
修改 “drivers/video/s3c2410fb.c”
- static void s3c2410fb_activate_var(struct fb_info *info)
- {
- struct s3c2410fb_info *fbi = info->par;
- void __iomem *regs = fbi->io;
- int type = fbi->regs.lcdcon1 & S3C2410_LCDCON1_TFT;
- 添加:
- struct s3c2410fb_mach_info *mach_info = fbi->dev->platform_data;
- struct s3c2410fb_display *default_display = mach_info->displays +
- mach_info->default_display;
- 结束
- struct fb_var_screeninfo *var = &info->var;
- int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2;
- dprintk("%s: var->xres = %d\n", __func__, var->xres);
- dprintk("%s: var->yres = %d\n", __func__, var->yres);
- dprintk("%s: var->bpp = %d\n", __func__, var->bits_per_pixel);
- if (type == S3C2410_LCDCON1_TFT) {
- s3c2410fb_calculate_tft_lcd_regs(info, &fbi->regs);
- --clkdiv;
- if (clkdiv < 0)
- clkdiv = 0;
- } else {
- s3c2410fb_calculate_stn_lcd_regs(info, &fbi->regs);
- if (clkdiv < 2)
- clkdiv = 2;
- }
- // fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(clkdiv);
- 修改为 fbi->regs.lcdcon1 |= S3C2410_LCDCON1_CLKVAL(default_display->setclkval);
2.完成了这部分修改后,我们在时c2410fb_display 结构体中添加了一个 setclkval 变量,那么我们需要在该结构体的院校中添加上该变量,修改“arch/arm/mach-s3c2410/include/fb.h”
- struct s3c2410fb_display {
- /* LCD type */
- unsigned type;
- /* Screen size */
- unsigned short width;
- unsigned short height;
- /* Screen info */
- unsigned short xres;
- unsigned short yres;
- unsigned short bpp;
- unsigned pixclock; /* pixclock in picoseconds */
- ## /* 新加入的项,目的是减少计算pixclock的复杂度*/
- unsigned setclkval; /* clkval */
- unsigned short left_margin; /* value in pixels (TFT) or HCLKs (STN) */
3.修改LCD 各个参数,注意:添加上刚刚添加的那个变量 setclkval 的赋值
修改 "arch/arm/mach-s3c2440/mach-smdk2440.c"
- /* 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,
- #if defined(CONFIG_FB_S3C24X0_W320240)
- .width = 320,
- .height = 240,
- .pixclock = 80000, /* HCLK 100 MHz, divisor 3 */
- /* 新加入的项,目的是减少计算pixclock的复杂度*/
- .setclkval = 0x3,
- .xres = 320,
- .yres = 240,
- .bpp = 16,
- .left_margin = 28, /* for HFPD*/
- .right_margin = 24, /* for HBPD*/
- .hsync_len = 42, /* for HSPW*/
- .upper_margin = 6, /* for VFPD*/
- .lower_margin = 2, /* for VBPD*/
- .vsync_len = 12, /* for VSPW*/
- #endif
- };
4.修改 drivers/video/Kconfig
- config FB_S3C24X0 修改
- tristate "S3C2410 LCD framebuffer support"
-
- depends on FB && ARCH_S3C2410
- select FB_CFB_FILLRECT
- select FB_CFB_COPYAREA
- select FB_CFB_IMAGEBLIT
- ---help---
- Frame buffer driver for the built-in LCD controller in the Samsung
- S3C2410 processor.
- This driver is also available as a module ( = code which can be
- inserted and removed from the running kernel whenever you want). The
- module will be called s3c2410fb. If you want to compile it as a module,
- say M here and read <file:Documentation/kbuild/modules.txt>.
- If unsure, say N.
-
- choice 添加
- prompt "LCD select"
- depends on FB_S3C24X0
- help
- S3C24x0 LCD size select
- config FB_S3C24X0_W320240
- boolean "3.5 inch 320x240 WanXin LCD"
- depends on FB_S3C24X0
- help
- 3.5 inch 320x240 WanXin LCD
- endchoice
- config FB_S3C2410_DEBUG
- bool "S3C2410 lcd debug messages"
- depends on FB_S3C24X0 #修改
- help
- Turn on debugging messages. Note that you can set/unset at run time
- through sysfs
4.修改 drivers/video/Makefile
- obj-$(CONFIG_FB_IMX) += imxfb.o
- obj-$(CONFIG_FB_S3C) += s3c-fb.o
- obj-$(CONFIG_FB_S3C24X0) += s3c2410fb.o #因为Kconifg 修改为 CONFIG_FB_S3C24X0,所以这里修改
- obj-$(CONFIG_FB_FSL_DIU) += fsl-diu-fb.o
5.制作 linux 的开机 logo
有几点需要注意:1.使用320*240 像素的 bmp 图片,
2.我用别的像素制作的图片,当下载到板子后,出现,黑、白、红、绿交替闪烁,
没有出现预期的图片
上传自己制作好的图片.ppm logo_linux_tft320240_clut224.ppm
6.支持LCD设置
复制 logo_linux_tft320240_clut224.ppm 到 drivers/video/logo
修改drivers/video/logo/Kconfig
- config LOGO_LINUX_CLUT224
- bool "Standard 224-color Linux logo"
- default y
- 添加
- config LOGO_LINUX_TFT320240_CLUT224
- bool "Standard 224-color Linux logo for 320X240"
- depends on LOGO && FB_S3C24X0_S320240 || FB_S3C24X0_W320240
- default y
结束
修改drives/video/logo/Makefile
- obj-$(CONFIG_LOGO_LINUX_CLUT224) += logo_linux_clut224.o
- 添加
- obj-$(CONFIG_LOGO_LINUX_TFT320240_CLUT224) += logo_linux_tft320240_clut224.o
修改 drivers/video/logo/logo.c
- extern const struct linux_logo logo_linux_clut224;
- extern const struct linux_logo logo_linux_tft320240_clut224;
- #ifdef CONFIG_LOGO_LINUX_CLUT224
- /* Generic Linux logo */
- logo = &logo_linux_clut224;
- #endif
- #ifdef CONFIG_LOGO_LINUX_TFT320240_CLUT224
- /* Generic Linux logo */
- logo = &logo_linux_tft320240_clut224;
- #endif
7.配置内核
- Device Drivers -->
- Graphics support __>
- <*>Support for frame buffer devices ->
- [*] Enable firmware EDID
- [*] Enable Video mode handling dhelpers
- ****frame buffer hardware dirvers***
- <*> S3C24X0 LCD framebufer support 注意这个就是在 Kconfig中 drivers/video/
- LCD select 3.5 inch 320*240
- <*> Frambuffer console support
- [*]bootup logo -> 注意:drivers/video/logo/Kconfig
- [*] standard 224-color linux logo for 320*240
8.ok 了
阅读(1156) | 评论(0) | 转发(0) |