devs.c:
static struct resource s3cfb_resource[] = {
[0] = {
.start= S5P_PA_LCD,
.end= S5P_PA_LCD + S5P_SZ_LCD - 1,
.flags= IORESOURCE_MEM,
},
[1] = {
.start= IRQ_LCD1,
.end= IRQ_LCD1,
.flags= IORESOURCE_IRQ,
},
[2] = {
.start= IRQ_LCD0,
.end= IRQ_LCD0,
.flags= IORESOURCE_IRQ,
},
};
static u64 fb_dma_mask = 0xffffffffUL;
struct platform_device s3c_device_fb = {
.name= "s3cfb",
.id= -1,
.num_resources= ARRAY_SIZE(s3cfb_resource),
.resource= s3cfb_resource,
.dev= {
.dma_mask= &fb_dma_mask,
.coherent_dma_mask= 0xffffffffUL
}
};
static struct s3c_platform_fb default_fb_data __initdata = {//总的
#if defined(CONFIG_CPU_S5PV210_EVT0)
.hw_ver= 0x60,
#else
.hw_ver= 0x62,
#endif
.nr_wins= 5,
#if defined(CONFIG_FB_S3C_DEFAULT_WINDOW)
.default_win= CONFIG_FB_S3C_DEFAULT_WINDOW,
#else
.default_win= 0,
#endif
.swap= FB_SWAP_WORD | FB_SWAP_HWORD,
};
void __init s3cfb_set_platdata(struct s3c_platform_fb *pd)
{
struct s3c_platform_fb *npd;
int i;
if (!pd)
pd = &default_fb_data;
npd = kmemdup(pd, sizeof(struct s3c_platform_fb), GFP_KERNEL);
if (!npd)
printk(KERN_ERR "%s: no memory for platform data\n", __func__);
else {
for (i = 0; i < npd->nr_wins; i++)//每个fb拥有的缓冲区个数
npd->nr_buffers[i] = 1;
#if defined(CONFIG_FB_S3C_NR_BUFFERS)
npd->nr_buffers[npd->default_win] = CONFIG_FB_S3C_NR_BUFFERS;
#else
npd->nr_buffers[npd->default_win] = 1;
#endif
s3cfb_get_clk_name(npd->clk_name);
npd->cfg_gpio = s3cfb_cfg_gpio;
npd->backlight_on = s3cfb_backlight_on;
npd->backlight_off = s3cfb_backlight_off;
npd->lcd_on = s3cfb_lcd_on;
npd->lcd_off = s3cfb_lcd_off;
npd->clk_on = s3cfb_clk_on;
npd->clk_off = s3cfb_clk_off;
s3c_device_fb.dev.platform_data = npd;//放到平台数据中
}
}