日期:2014-05-16 浏览次数:20790 次
接着上 一篇,程序看到了probe函数中。
831 mach_info = pdev->dev.platform_data;
832 if (mach_info == NULL) {
833 dev_err(&pdev->dev,
834 "no platform data for lcd, cannot attach\n");
835 return -EINVAL;
836 }
首先获取平台设备中定义的数据,先看struct s3c2410fb_mach_info这个结构体类型的定义:
/* arch/arm/mach-s3c2410/include/mach/fb.h */
51 struct s3c2410fb_mach_info {
52
53 struct s3c2410fb_display *displays; /* attached diplays info */
54 unsigned num_displays; /* number of defined displays */
55 unsigned default_display;
56
57 /* GPIOs */
58
59 unsigned long gpcup;
60 unsigned long gpcup_mask;
61 unsigned long gpccon;
62 unsigned long gpccon_mask;
63 unsigned long gpdup;
64 unsigned long gpdup_mask;
65 unsigned long gpdcon;
66 unsigned long gpdcon_mask;
67
68 /* lpc3600 control register */
69 unsigned long lpcsel;
70 };
我们再来看看这个结构体的定义:
static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
.displays = &mini2440_lcd_cfg,
.num_displays = 1,
.default_display = 0,
.gpccon = 0xaa955699,
.gpccon_mask = 0xffc003cc,
.gpcup = 0x0000ffff,
.gpcup_mask = 0xffffffff,
.gpdco