Tiny 4412 lcd 驱动分析 2

/home/yangjia/samba/linux-3.5/arch/arm/mach-exynos/mach-tiny4412.c  。_initdata 定义在此文件中。平台驱动都重要在这里注册。平台驱动是匹配名字的。

static struct platform_device *smdk4x12_devices[] __initdata = {
#ifdef CONFIG_EXYNOS4_DEV_DWMCI
	&exynos_device_dwmci,
#endif
	&s3c_device_hsmmc2,
	&s3c_device_hsmmc3,
	&wm8994_fixed_voltage0,
	&wm8994_fixed_voltage1,
	&wm8994_fixed_voltage2,
	&s3c_device_i2c0,
	&s3c_device_i2c1,
	&s3c_device_i2c2,
	&s3c_device_i2c3,
#ifdef CONFIG_VIDEO_M5MOLS
	&s3c_device_i2c4,
#endif
	&s3c_device_i2c7,
	&s3c_device_adc,
	&s3c_device_rtc,
	&s3c_device_wdt,
#ifdef CONFIG_TINY4412_BUZZER
	&s3c_device_timer[0],
#endif
#ifdef CONFIG_VIDEO_EXYNOS_FIMC_LITE
	&exynos_device_flite0,
	&exynos_device_flite1,
#endif
	&s5p_device_mipi_csis0,
	&s5p_device_mipi_csis1,
	&s5p_device_fimc0,
	&s5p_device_fimc1,
	&s5p_device_fimc2,
	&s5p_device_fimc3,
	&s5p_device_fimc_md,
	&s5p_device_fimd0,

在/home/yangjia/samba/linux-3.5/arch/arm/plat-samsung/devs.c 中定义有 s3c_device_fb 和s5p_device_fimd0 。S5P_PA_FIMD0是VIDCON0的地址,可以查三星的用户手册,地址为 0x11C00000。s5p-fb这个名字没有在后面匹配。


#ifdef CONFIG_S5P_DEV_FIMD0
static struct resource s5p_fimd0_resource[] = {
	[0] = DEFINE_RES_MEM(S5P_PA_FIMD0, SZ_32K),
	[1] = DEFINE_RES_IRQ(IRQ_FIMD0_VSYNC),
	[2] = DEFINE_RES_IRQ(IRQ_FIMD0_FIFO),
	[3] = DEFINE_RES_IRQ(IRQ_FIMD0_SYSTEM),
};

struct platform_device s5p_device_fimd0 = {
	.name		= "s5p-fb",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(s5p_fimd0_resource),
	.resource	= s5p_fimd0_resource,
	.dev		= {
		.dma_mask		= &samsung_device_dma_mask,
		.coherent_dma_mask	= DMA_BIT_MASK(32),
	},
};
#ifdef CONFIG_S3C_DEV_FB
static struct resource s3c_fb_resource[] = {
	[0] = DEFINE_RES_MEM(S3C_PA_FB, SZ_16K),
	[1] = DEFINE_RES_IRQ(IRQ_LCD_VSYNC),
	[2] = DEFINE_RES_IRQ(IRQ_LCD_FIFO),
	[3] = DEFINE_RES_IRQ(IRQ_LCD_SYSTEM),
};

struct platform_device s3c_device_fb = {
	.name		= "s3c-fb",
	.id		= -1,
	.num_resources	= ARRAY_SIZE(s3c_fb_resource),
	.resource	= s3c_fb_resource,
	.dev		= {
		.dma_mask		= &samsung_device_dma_mask,
		.coherent_dma_mask	= DMA_BIT_MASK(32),
	},
};
#ifdef CONFIG_S5P_DEV_FIMD0
static struct resource s5p_fimd0_resource[] = {
	[0] = DEFINE_RES_MEM(S5P_PA_FIMD0, SZ_32K),
	[1] = DEFINE_RES_IRQ(IRQ_FIMD0_VSYNC),
	[2] = DEFINE_RES_IRQ(IRQ_FIMD0_FIFO),
	[3] = DEFINE_RES_IRQ(IRQ_FIMD0_SYSTEM),
};

/home/yangjia/samba/linux-3.5/arch/arm/mach-exynos/mach-tiny4412.c  

static void __init smdk4x12_machine_init(void)
{
#ifdef CONFIG_TOUCHSCREEN_FT5X0X
	struct s3cfb_lcd *lcd = tiny4412_get_lcd();
	ft5x0x_pdata.screen_max_x = lcd->width;
	ft5x0x_pdata.screen_max_y = lcd->height;

/home/yangjia/samba/linux-3.5/arch/arm/mach-exynos/tiny4412-lcds.c 在这个文件中对lcd的参数进行配置。

static struct {
	char *name;
	struct s3cfb_lcd *lcd;
	int ctp;
} tiny4412_lcd_config[] = {
	{ "HD700",	&wxga_hd700, 1 },
	{ "S70",	&wvga_s70,   1 },
	{ "W50",	&wvga_w50,   0 },
	{ "W101",	&wsvga_w101, 1 },
	{ "A97",	&xga_a97,    0 },
	{ "HDM",	&hdmi_def,   0 },	/* Pls keep it at last */
};

static int lcd_idx = 0;

static int __init tiny4412_setup_lcd(char *str)
{
	int i;

	if (!strncasecmp("HDMI", str, 4)) {
		struct hdmi_config *cfg = &tiny4412_hdmi_config[0];
		struct s3cfb_lcd *lcd;

		lcd_idx = ARRAY_SIZE(tiny4412_lcd_config) - 1;
		lcd = tiny4412_lcd_config[lcd_idx].lcd;

		for (i = 0; i < ARRAY_SIZE(tiny4412_hdmi_config); i++, cfg++) {
			if (!strcasecmp(cfg->name, str)) {
				lcd->width = cfg->width;
				lcd->height = cfg->height;
				goto __ret;
			}
		}
	}

	for (i = 0; i < ARRAY_SIZE(tiny4412_lcd_config); i++) {
		if (!strcasecmp(tiny4412_lcd_config[i].name, str)) {
			lcd_idx = i;
			break;
		}
	}

__ret:
	printk("TINY4412: %s selected\n", tiny4412_lcd_config[lcd_idx].name);
	return 0;
}
early_param("lcd", tiny4412_setup_lcd);









你可能感兴趣的:(linux驱动)