裸机S3C6410显示控制器(3)-LINUX下LCD驱动源码阅读

相关文件:

linux-2.6.28.6\drivers\video\samsung\s3cfb.c   (这个是LCD驱动的入口)
linux-2.6.28.6\drivers\video\samsung\s3cfb_spi.c
linux-2.6.28.6\drivers\video\samsung\s3cfb_fimd4x.c  (操作6410LCD硬件的代码)
linux-2.6.28.6\drivers\video\samsung\s3c_mini6410.c

S3c_mini6410.h中定义了S70屏的一些参数

/**
 * WARNING: CLKVAL is defined upon 133 MHz HCLK, please update it
 * when HCLK freq changed.
 *   VCLK = 133 MHz / (CLKVAL + 1)
 */

。。。
#elif defined(CONFIG_FB_S3C_S70T800480)
下面这些是时序,主要设置vidtcon0~2
#define S3CFB_LCD_TYPE	"S70"
#define S3CFB_VBP		(0x15)	/* back porch */
#define S3CFB_VFP		(0x16)	/* front porch */
#define S3CFB_VSW		(0x02)	/* vsync width */
#define S3CFB_HBP		(0x2C)	/* back porch */
#define S3CFB_HFP		(0xD2)	/* front porch */
#define S3CFB_HSW		(0x02)	/* hsync width */

#define S3CFB_HRES		800		/* horizon pixel  x resolition */
#define S3CFB_VRES		480		/* line cnt       y resolution */

#define S3CFB_CLKVAL		3	/* ~33.25 MHz */时钟分频
#define S3CFB_VIDCON1	(S3C_VIDCON1_IHSYNC_INVERT | S3C_VIDCON1_IVSYNC_INVERT)

在s3c_mini6410.c的s3cfb_set_fimd_info(void)函数中,这些值被使用:

static void s3cfb_set_fimd_info(void)
{
#ifdef S3CFB_VIDCON1
	s3cfb_fimd.vidcon1 = S3CFB_VIDCON1;
#else
	s3cfb_fimd.vidcon1 = S3C_VIDCON1_IHSYNC_INVERT |	\
						 S3C_VIDCON1_IVSYNC_INVERT |	\
						 S3C_VIDCON1_IVDEN_NORMAL;
#endif

#if defined(CONFIG_FB_S3C_VGA1024768) || \
	defined(CONFIG_FB_S3C_VGA640480) || \
	defined(CONFIG_FB_S3C_VGA800600)
	s3cfb_fimd.vidcon1 = 0;
#endif

	s3cfb_fimd.vidtcon0 = S3C_VIDTCON0_VBPD(S3CFB_VBP - 1) |	\
						  S3C_VIDTCON0_VFPD(S3CFB_VFP - 1) |	\
						  S3C_VIDTCON0_VSPW(S3CFB_VSW - 1);
	s3cfb_fimd.vidtcon1 = S3C_VIDTCON1_HBPD(S3CFB_HBP - 1) |	\
						  S3C_VIDTCON1_HFPD(S3CFB_HFP - 1) |	\
						  S3C_VIDTCON1_HSPW(S3CFB_HSW - 1);
	s3cfb_fimd.vidtcon2 = S3C_VIDTCON2_LINEVAL(S3CFB_VRES - 1) |	\
						  S3C_VIDTCON2_HOZVAL(S3CFB_HRES - 1);

	s3cfb_fimd.vidosd0a = S3C_VIDOSDxA_OSD_LTX_F(0) | S3C_VIDOSDxA_OSD_LTY_F(0);
	s3cfb_fimd.vidosd0b = S3C_VIDOSDxB_OSD_RBX_F(S3CFB_HRES - 1) |	\
						  S3C_VIDOSDxB_OSD_RBY_F(S3CFB_VRES - 1);

	s3cfb_fimd.vidosd1a = S3C_VIDOSDxA_OSD_LTX_F(0) | S3C_VIDOSDxA_OSD_LTY_F(0);
	s3cfb_fimd.vidosd1b = S3C_VIDOSDxB_OSD_RBX_F(S3CFB_HRES_OSD - 1) |	\
						  S3C_VIDOSDxB_OSD_RBY_F(S3CFB_VRES_OSD - 1);

	s3cfb_fimd.width = S3CFB_HRES;
	s3cfb_fimd.height = S3CFB_VRES;
	s3cfb_fimd.xres = S3CFB_HRES;
	s3cfb_fimd.yres = S3CFB_VRES;

#if defined(CONFIG_FB_S3C_VIRTUAL_SCREEN)
	s3cfb_fimd.xres_virtual = S3CFB_HRES_VIRTUAL;
	s3cfb_fimd.yres_virtual = S3CFB_VRES_VIRTUAL;
#else
	s3cfb_fimd.xres_virtual = S3CFB_HRES;
	s3cfb_fimd.yres_virtual = S3CFB_VRES;
#endif

	s3cfb_fimd.osd_width = S3CFB_HRES_OSD;
	s3cfb_fimd.osd_height = S3CFB_VRES_OSD;
	s3cfb_fimd.osd_xres = S3CFB_HRES_OSD;
	s3cfb_fimd.osd_yres = S3CFB_VRES_OSD;

	s3cfb_fimd.osd_xres_virtual = S3CFB_HRES_OSD;
	s3cfb_fimd.osd_yres_virtual = S3CFB_VRES_OSD;

	s3cfb_fimd.pixclock = S3CFB_PIXEL_CLOCK;

	s3cfb_fimd.hsync_len = S3CFB_HSW;
	s3cfb_fimd.vsync_len = S3CFB_VSW;
	s3cfb_fimd.left_margin = S3CFB_HBP;
	s3cfb_fimd.upper_margin = S3CFB_VBP;
	s3cfb_fimd.right_margin = S3CFB_HFP;
	s3cfb_fimd.lower_margin = S3CFB_VFP;
}


你可能感兴趣的:(裸机S3C6410显示控制器(3)-LINUX下LCD驱动源码阅读)