blob: bcbb9d5dc293e4066264dc6aba714af8aa6594f4 [file] [log] [blame]
Tony Lindgrenc40fae952006-12-07 13:58:10 -08001/*
2 * File: arch/arm/plat-omap/fb.c
3 *
4 * Framebuffer device registration for TI OMAP platforms
5 *
6 * Copyright (C) 2006 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
Tony Lindgren0dc5e772006-04-02 17:46:26 +010024#include <linux/module.h>
25#include <linux/kernel.h>
Andrea Righi27ac7922008-07-23 21:28:13 -070026#include <linux/mm.h>
Tony Lindgren0dc5e772006-04-02 17:46:26 +010027#include <linux/init.h>
28#include <linux/platform_device.h>
Russell King98864ff2010-05-22 23:59:11 +010029#include <linux/memblock.h>
Russell Kingfced80c2008-09-06 12:10:45 +010030#include <linux/io.h>
Tomi Valkeinen91773a02009-08-03 15:06:36 +030031#include <linux/omapfb.h>
Tony Lindgren0dc5e772006-04-02 17:46:26 +010032
Russell Kinga09e64f2008-08-05 16:14:15 +010033#include <mach/hardware.h>
Tony Lindgren0dc5e772006-04-02 17:46:26 +010034#include <asm/mach/map.h>
35
Tony Lindgren0dc5e772006-04-02 17:46:26 +010036#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
37
Tomi Valkeinenddba6c72011-09-20 15:23:13 +030038static bool omapfb_lcd_configured;
Tony Lindgren0dc5e772006-04-02 17:46:26 +010039static struct omapfb_platform_data omapfb_config;
40
41static u64 omap_fb_dma_mask = ~(u32)0;
42
43static struct platform_device omap_fb_device = {
44 .name = "omapfb",
45 .id = -1,
46 .dev = {
47 .dma_mask = &omap_fb_dma_mask,
48 .coherent_dma_mask = ~(u32)0,
49 .platform_data = &omapfb_config,
50 },
51 .num_resources = 0,
52};
53
Tomi Valkeinenddba6c72011-09-20 15:23:13 +030054void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
55{
56 omapfb_config.lcd = *config;
57 omapfb_lcd_configured = true;
58}
59
Uwe Kleine-König375c3242010-09-02 10:03:38 +020060static int __init omap_init_fb(void)
Tony Lindgren0dc5e772006-04-02 17:46:26 +010061{
Tomi Valkeinenddba6c72011-09-20 15:23:13 +030062 /*
63 * If the board file has not set the lcd config with
64 * omapfb_set_lcd_config(), don't bother registering the omapfb device
65 */
66 if (!omapfb_lcd_configured)
Imre Deakb7cc6d42007-03-06 03:16:36 -080067 return 0;
Tomi Valkeinen1e434f92011-09-20 14:12:43 +030068
Tony Lindgren0dc5e772006-04-02 17:46:26 +010069 return platform_device_register(&omap_fb_device);
70}
71
72arch_initcall(omap_init_fb);
73
Tomi Valkeinenb39a982d2009-08-04 16:12:50 +030074#elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
75
76static u64 omap_fb_dma_mask = ~(u32)0;
77static struct omapfb_platform_data omapfb_config;
78
79static struct platform_device omap_fb_device = {
80 .name = "omapfb",
81 .id = -1,
82 .dev = {
83 .dma_mask = &omap_fb_dma_mask,
84 .coherent_dma_mask = ~(u32)0,
85 .platform_data = &omapfb_config,
86 },
87 .num_resources = 0,
88};
89
Uwe Kleine-König375c3242010-09-02 10:03:38 +020090static int __init omap_init_fb(void)
Tomi Valkeinenb39a982d2009-08-04 16:12:50 +030091{
92 return platform_device_register(&omap_fb_device);
93}
94
95arch_initcall(omap_init_fb);
Tony Lindgren0dc5e772006-04-02 17:46:26 +010096
Tomi Valkeinenddba6c72011-09-20 15:23:13 +030097#else
98
Tony Lindgren001b7f32012-03-08 12:43:28 -080099void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
100{
101}
Tomi Valkeinenddba6c72011-09-20 15:23:13 +0300102
Tony Lindgren0dc5e772006-04-02 17:46:26 +0100103#endif