diff options
Diffstat (limited to 'arch/arm/mach-tegra/board-p1852-panel.c')
-rw-r--r-- | arch/arm/mach-tegra/board-p1852-panel.c | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-p1852-panel.c b/arch/arm/mach-tegra/board-p1852-panel.c new file mode 100644 index 00000000000..8940af0c0b6 --- /dev/null +++ b/arch/arm/mach-tegra/board-p1852-panel.c | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/board-p1852-panel.c | ||
3 | * | ||
4 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #include <linux/resource.h> | ||
20 | #include <asm/mach-types.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/nvhost.h> | ||
23 | #include <mach/nvmap.h> | ||
24 | #include <mach/irqs.h> | ||
25 | #include <mach/iomap.h> | ||
26 | #include <mach/dc.h> | ||
27 | #include <mach/fb.h> | ||
28 | |||
29 | #include "board.h" | ||
30 | #include "devices.h" | ||
31 | |||
32 | static int p1852_panel_enable(void) | ||
33 | { | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | static int p1852_panel_disable(void) | ||
38 | { | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | static struct tegra_dc_mode p1852_panel_modes[] = { | ||
43 | { | ||
44 | /* 800x480@60 */ | ||
45 | .pclk = 32460000, | ||
46 | .h_ref_to_sync = 1, | ||
47 | .v_ref_to_sync = 1, | ||
48 | .h_sync_width = 64, | ||
49 | .v_sync_width = 3, | ||
50 | .h_back_porch = 128, | ||
51 | .v_back_porch = 22, | ||
52 | .h_front_porch = 64, | ||
53 | .v_front_porch = 20, | ||
54 | .h_active = 800, | ||
55 | .v_active = 480, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | static struct tegra_fb_data p1852_fb_data = { | ||
60 | .win = 0, | ||
61 | .xres = 800, | ||
62 | .yres = 480, | ||
63 | .bits_per_pixel = 32, | ||
64 | }; | ||
65 | |||
66 | static struct tegra_dc_out p1852_disp1_out = { | ||
67 | .align = TEGRA_DC_ALIGN_MSB, | ||
68 | .order = TEGRA_DC_ORDER_RED_BLUE, | ||
69 | .type = TEGRA_DC_OUT_RGB, | ||
70 | .modes = p1852_panel_modes, | ||
71 | .n_modes = ARRAY_SIZE(p1852_panel_modes), | ||
72 | .enable = p1852_panel_enable, | ||
73 | .disable = p1852_panel_disable, | ||
74 | }; | ||
75 | |||
76 | static struct tegra_dc_platform_data p1852_disp1_pdata = { | ||
77 | .flags = TEGRA_DC_FLAG_ENABLED, | ||
78 | .default_out = &p1852_disp1_out, | ||
79 | .emc_clk_rate = 300000000, | ||
80 | .fb = &p1852_fb_data, | ||
81 | }; | ||
82 | |||
83 | static struct nvmap_platform_carveout p1852_carveouts[] = { | ||
84 | [0] = { | ||
85 | .name = "iram", | ||
86 | .usage_mask = NVMAP_HEAP_CARVEOUT_IRAM, | ||
87 | .base = TEGRA_IRAM_BASE + TEGRA_RESET_HANDLER_SIZE, | ||
88 | .size = TEGRA_IRAM_SIZE - TEGRA_RESET_HANDLER_SIZE, | ||
89 | .buddy_size = 0, /* no buddy allocation for IRAM */ | ||
90 | }, | ||
91 | [1] = { | ||
92 | .name = "generic-0", | ||
93 | .usage_mask = NVMAP_HEAP_CARVEOUT_GENERIC, | ||
94 | .base = 0, /* Filled in by p1852_panel_init() */ | ||
95 | .size = 0, /* Filled in by p1852_panel_init() */ | ||
96 | .buddy_size = SZ_32K, | ||
97 | }, | ||
98 | }; | ||
99 | |||
100 | static struct nvmap_platform_data p1852_nvmap_data = { | ||
101 | .carveouts = p1852_carveouts, | ||
102 | .nr_carveouts = ARRAY_SIZE(p1852_carveouts), | ||
103 | }; | ||
104 | |||
105 | static struct platform_device *p1852_gfx_devices[] __initdata = { | ||
106 | &tegra_nvmap_device, | ||
107 | }; | ||
108 | |||
109 | int __init p1852_panel_init(void) | ||
110 | { | ||
111 | int err; | ||
112 | struct resource *res; | ||
113 | |||
114 | p1852_carveouts[1].base = tegra_carveout_start; | ||
115 | p1852_carveouts[1].size = tegra_carveout_size; | ||
116 | tegra_nvmap_device.dev.platform_data = &p1852_nvmap_data; | ||
117 | tegra_disp1_device.dev.platform_data = &p1852_disp1_pdata; | ||
118 | |||
119 | res = nvhost_get_resource_byname(&tegra_disp1_device, | ||
120 | IORESOURCE_MEM, "fbmem"); | ||
121 | if (!res) { | ||
122 | pr_err("No memory resources\n"); | ||
123 | return -ENODEV; | ||
124 | } | ||
125 | res->start = tegra_fb_start; | ||
126 | res->end = tegra_fb_start + tegra_fb_size - 1; | ||
127 | |||
128 | #ifdef CONFIG_TEGRA_GRHOST | ||
129 | err = nvhost_device_register(&tegra_grhost_device); | ||
130 | if (err) | ||
131 | return err; | ||
132 | #endif | ||
133 | |||
134 | err = platform_add_devices(p1852_gfx_devices, | ||
135 | ARRAY_SIZE(p1852_gfx_devices)); | ||
136 | if (!err) | ||
137 | err = nvhost_device_register(&tegra_disp1_device); | ||
138 | |||
139 | #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP) | ||
140 | if (!err) | ||
141 | err = nvhost_device_register(&nvavp_device); | ||
142 | #endif | ||
143 | return err; | ||
144 | } | ||