Tony Lindgren | c40fae95 | 2006-12-07 13:58:10 -0800 | [diff] [blame] | 1 | /* |
| 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 Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 24 | #include <linux/module.h> |
| 25 | #include <linux/kernel.h> |
Andrea Righi | 27ac792 | 2008-07-23 21:28:13 -0700 | [diff] [blame] | 26 | #include <linux/mm.h> |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 27 | #include <linux/init.h> |
| 28 | #include <linux/platform_device.h> |
Russell King | 98864ff | 2010-05-22 23:59:11 +0100 | [diff] [blame] | 29 | #include <linux/memblock.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 30 | #include <linux/io.h> |
Tomi Valkeinen | 91773a0 | 2009-08-03 15:06:36 +0300 | [diff] [blame] | 31 | #include <linux/omapfb.h> |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 32 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 33 | #include <mach/hardware.h> |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 34 | #include <asm/mach/map.h> |
| 35 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 36 | #include <plat/board.h> |
Manjunath Kondaiah G | b0a330d | 2010-10-08 10:00:19 -0700 | [diff] [blame] | 37 | |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 38 | #if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) |
| 39 | |
| 40 | static struct omapfb_platform_data omapfb_config; |
| 41 | |
| 42 | static u64 omap_fb_dma_mask = ~(u32)0; |
| 43 | |
| 44 | static struct platform_device omap_fb_device = { |
| 45 | .name = "omapfb", |
| 46 | .id = -1, |
| 47 | .dev = { |
| 48 | .dma_mask = &omap_fb_dma_mask, |
| 49 | .coherent_dma_mask = ~(u32)0, |
| 50 | .platform_data = &omapfb_config, |
| 51 | }, |
| 52 | .num_resources = 0, |
| 53 | }; |
| 54 | |
Tomi Valkeinen | b39a982d | 2009-08-04 16:12:50 +0300 | [diff] [blame] | 55 | void omapfb_set_platform_data(struct omapfb_platform_data *data) |
| 56 | { |
| 57 | } |
| 58 | |
Uwe Kleine-König | 375c324 | 2010-09-02 10:03:38 +0200 | [diff] [blame] | 59 | static int __init omap_init_fb(void) |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 60 | { |
| 61 | const struct omap_lcd_config *conf; |
| 62 | |
Imre Deak | b7cc6d4 | 2007-03-06 03:16:36 -0800 | [diff] [blame] | 63 | conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config); |
Tomi Valkeinen | 1e434f9 | 2011-09-20 14:12:43 +0300 | [diff] [blame^] | 64 | if (conf == NULL) |
Imre Deak | b7cc6d4 | 2007-03-06 03:16:36 -0800 | [diff] [blame] | 65 | return 0; |
Tomi Valkeinen | 1e434f9 | 2011-09-20 14:12:43 +0300 | [diff] [blame^] | 66 | |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 67 | omapfb_config.lcd = *conf; |
| 68 | |
| 69 | return platform_device_register(&omap_fb_device); |
| 70 | } |
| 71 | |
| 72 | arch_initcall(omap_init_fb); |
| 73 | |
Tomi Valkeinen | b39a982d | 2009-08-04 16:12:50 +0300 | [diff] [blame] | 74 | #elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
| 75 | |
| 76 | static u64 omap_fb_dma_mask = ~(u32)0; |
| 77 | static struct omapfb_platform_data omapfb_config; |
| 78 | |
| 79 | static 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 | |
| 90 | void omapfb_set_platform_data(struct omapfb_platform_data *data) |
| 91 | { |
| 92 | omapfb_config = *data; |
| 93 | } |
| 94 | |
Uwe Kleine-König | 375c324 | 2010-09-02 10:03:38 +0200 | [diff] [blame] | 95 | static int __init omap_init_fb(void) |
Tomi Valkeinen | b39a982d | 2009-08-04 16:12:50 +0300 | [diff] [blame] | 96 | { |
| 97 | return platform_device_register(&omap_fb_device); |
| 98 | } |
| 99 | |
| 100 | arch_initcall(omap_init_fb); |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 101 | |
Tomi Valkeinen | b39a982d | 2009-08-04 16:12:50 +0300 | [diff] [blame] | 102 | #else |
| 103 | |
| 104 | void omapfb_set_platform_data(struct omapfb_platform_data *data) |
| 105 | { |
| 106 | } |
| 107 | |
Tony Lindgren | 0dc5e77 | 2006-04-02 17:46:26 +0100 | [diff] [blame] | 108 | #endif |