LCD驱动移植之开机logo

发布者:糖三角最新更新时间:2021-07-23 来源: eefocus关键字:LCD  驱动移植  开机logo 手机看文章 扫描二维码
随时随地手机看文章

移植环境

BootLoader:u-boot-1.1.6

kernel:linux-2.6.30.4

CPU:s3c2440

开发板:TQ2440

LCD:TFT480*272

参考资料:《天嵌Linux移植手册》


移植步骤

1、修改LCD时钟计算方法

内核源码的“drivers/video/s3c2410fb.c”文件,就是 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 fb_var_screeninfo *var = &info->var;

struct s3c2410fb_mach_info *mach_info = fbi->dev->platform_data;

struct s3c2410fb_display *default_display = mach_info->displays +

mach_info->default_display;

int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2;

dprintk("%s: var->xres = %dn", __FUNCTION__, var->xres);

dprintk("%s: var->yres = %dn", __FUNCTION__, var->yres);

dprintk("%s: var->bpp = %dn", __FUNCTION__, 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);

/* write new registers */


完成了这部分修改之后,在 s3c2410fb_display 结构体中添加了一个 setclkval 的变量,那么需要在该结构体的原型中添加上该变量,修改Linux-2.6.30.4 的“arch/arm/mach-s3c2410/include/mach/fb.h”文件,添加如下内容:


/* LCD description */

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 */

unsigned setclkval; /* clkval */

unsigned short left_margin; /* value in pixels (TFT) or HCLKs (STN) */

unsigned short right_margin; /* value in pixels (TFT) or HCLKs (STN) */

unsigned short hsync_len; /* value in pixels (TFT) or HCLKs (STN) */

unsigned short upper_margin;/* value in lines (TFT) or 0 (STN) */

unsigned short lower_margin;/* value in lines (TFT) or 0 (STN) */

unsigned short vsync_len; /* value in lines (TFT) or 0 (STN) */

/* lcd configuration registers */

unsigned long lcdcon5;

};


2、修改LCD参数设置

然后修改 LCD 各个参数的配置,该配置参数在“arch/arm/mach-s3c2440/mach-smdk2440.c”文件中的由 107 行开始的结构体中,然后将其改为如下内容即可:

(注意:添加上刚刚添加的那个变量 setclkval 的赋值)


/* 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 = 480,

.height = 272,

.pixclock = 40000, /* HCLK 100 MHz, divisor 1 */

.setclkval = 0x4,

.xres = 480,

.yres = 272,

.bpp = 16,

.left_margin = 19, /* for HFPD*/

.right_margin = 10, /* for HBPD*/

.hsync_len = 30, /* for HSPW*/

.upper_margin = 4, /* for VFPD*/

.lower_margin = 2, /* for VBPD*/

.vsync_len = 8, /* for VSPW*/

}

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,

};


然后修改“drivers/video/Kconfig”文件


config FB_S3C2410

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 .

If unsure, say N.


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


然后修改“drivers/video/Makefile”文件,把 109 行的内容改成如下所示:


obj-$(CONFIG_FB_S3C2410) += s3c2410fb.o


3、制作开机logo

首先需要在PC端下载GIMP软件,然后导入一张480*272的bmp图片.

在这里插入图片描述

图像->模式->索引,最大颜色数量为224

在这里插入图片描述

保存图片为ppm格式,数据类型为ASCII

在这里插入图片描述
在这里插入图片描述

开机logo就制作好了,将其替换“drivers/video/logo/logo_linux_clut224.ppm”文件


4、配置内核

Device Drivers —>

Graphics support —>

<* > Support for frame buffer devices —>

[* ] Enable firmware EDID

[* ] Enable Video Mode Handling Helpers

*** Frame buffer hardware drivers ***

< * > S3C2410 LCD framebuffer support

<* > Framebuffer Console support

[ * ] Bootup logo —>

[ * ] Standard 224-color Linux logo


5、开机显示logo

配置完毕后,编译出内核镜像,烧写到 TQ2440 开发板中,启动系统时,就可以看到开机logo 的画面,这就表明 LCD 驱动完成了。

在这里插入图片描述

关键字:LCD  驱动移植  开机logo 引用地址:LCD驱动移植之开机logo

上一篇:LCD驱动移植之背光控制
下一篇:嵌入式驱动编写之简单驱动Hello_word

小广播
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved