Linux-2.6.38的LCD驱动分析(一)

一、让LCD显示可爱的小企鹅

还是先说说环境吧,处理器为S3C6410linux的版本是2.6.38(友善之臂提供的)。下面先说说怎样让LCD上显示出可爱的小企鹅。最直接的步骤如下(记住不要问为什么哈~_~,一步一步跟着走就行了):

1.       添加s3c6410处理器的LCD控制寄存器的初始值,具体做法为在文件arch/arm/mach-s3c6410/mach-mini6410.c中添加struct s3c_fb_platdata类型的寄存器描述讯息,如下所示:

static struct s3c_fb_pd_win mini6410_fb_win0 = {
/* this is to ensure we use win0 */
.win_mode = {
#if 0
.pixclock = 115440,
#endif
.left_margin = 0x03,
.right_margin = 0x02,
.upper_margin = 0x01,
.lower_margin = 0x01,
.hsync_len = 0x28,行同步信号脉冲长度
.vsync_len = 0x01,帧同步信号脉冲长度(表示新一帧图像的开始)
.xres = 480,
.yres = 272,
},
.max_bpp = 32,
.default_bpp = 16,
};

/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
static struct s3c_fb_platdata mini6410_lcd_pdata __initdata = {
.setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
.win[0] = &mini6410_fb_win0,
.vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
.vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
};


2. 通过s3c_fb_set_platdata函数向内核注册上面的信息。具体做法为:

static void __init mini6410_machine_init(void)系统启动时调用该函数初始化系统
{
u32 cs1;

s3c_i2c0_set_platdata(NULL);
#ifdef CONFIG_S3C_DEV_I2C1
s3c_i2c1_set_platdata(NULL);
#endif

s3c_fb_set_platdata(&mini6410_lcd_pdata);把lcd的初始值信息注册到内核中

#ifdef CONFIG_SAMSUNG_DEV_TS
s3c24xx_ts_set_platdata(&s3c_ts_platform);
#endif
#ifdef CONFIG_TOUCHSCREEN_MINI6410
s3c_ts_set_platdata(&s3c_ts_platform);
#endif

s3c_sdhci0_set_platdata(&mini6410_hsmmc0_pdata);
s3c_sdhci1_set_platdata(&mini6410_hsmmc1_pdata);

3. make menuconfig的时候配置Linuxlogo选项,然后在Graphic Support->console frame support 选项中选上framebuffer console surpport,还要选上Boot logo要不然看不到小企鹅。


你可能感兴趣的:(Linux-2.6.38的LCD驱动分析(一))