fb.c 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * File: arch/arm/plat-omap/fb.c
 *
 * Framebuffer device registration for TI OMAP platforms
 *
 * Copyright (C) 2006 Nokia Corporation
 * Author: Imre Deak <imre.deak@nokia.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

24 25
#include <linux/module.h>
#include <linux/kernel.h>
26
#include <linux/mm.h>
27 28
#include <linux/init.h>
#include <linux/platform_device.h>
29
#include <linux/memblock.h>
30
#include <linux/io.h>
T
Tomi Valkeinen 已提交
31
#include <linux/omapfb.h>
32

33
#include <mach/hardware.h>
34 35
#include <asm/mach/map.h>

36
#include <plat/board.h>
37

38 39
#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)

40
static bool omapfb_lcd_configured;
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
static struct omapfb_platform_data omapfb_config;

static u64 omap_fb_dma_mask = ~(u32)0;

static struct platform_device omap_fb_device = {
	.name		= "omapfb",
	.id		= -1,
	.dev = {
		.dma_mask		= &omap_fb_dma_mask,
		.coherent_dma_mask	= ~(u32)0,
		.platform_data		= &omapfb_config,
	},
	.num_resources = 0,
};

56
void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
57
{
58 59 60
	omapfb_config.lcd = *config;
	omapfb_lcd_configured = true;
}
61

62 63 64 65 66 67 68
static int __init omap_init_fb(void)
{
	/*
	 * If the board file has not set the lcd config with
	 * omapfb_set_lcd_config(), don't bother registering the omapfb device
	 */
	if (!omapfb_lcd_configured)
69
		return 0;
70

71 72 73 74 75
	return platform_device_register(&omap_fb_device);
}

arch_initcall(omap_init_fb);

T
Tomi Valkeinen 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
#elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)

static u64 omap_fb_dma_mask = ~(u32)0;
static struct omapfb_platform_data omapfb_config;

static struct platform_device omap_fb_device = {
	.name		= "omapfb",
	.id		= -1,
	.dev = {
		.dma_mask		= &omap_fb_dma_mask,
		.coherent_dma_mask	= ~(u32)0,
		.platform_data		= &omapfb_config,
	},
	.num_resources = 0,
};

92
static int __init omap_init_fb(void)
T
Tomi Valkeinen 已提交
93 94 95 96 97
{
	return platform_device_register(&omap_fb_device);
}

arch_initcall(omap_init_fb);
98

99 100
#else

101 102 103
void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
{
}
104

105
#endif