diff options
Diffstat (limited to 'arch/arm/mach-tegra/p852/board-p852-panel.c')
-rw-r--r-- | arch/arm/mach-tegra/p852/board-p852-panel.c | 196 |
1 files changed, 196 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/p852/board-p852-panel.c b/arch/arm/mach-tegra/p852/board-p852-panel.c new file mode 100644 index 00000000000..c47032dd4f0 --- /dev/null +++ b/arch/arm/mach-tegra/p852/board-p852-panel.c | |||
@@ -0,0 +1,196 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/board-p852-panel.c | ||
3 | * | ||
4 | * Copyright (c) 2010-2012, NVIDIA Corporation. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #include <linux/delay.h> | ||
22 | #include <linux/gpio.h> | ||
23 | #include <linux/regulator/consumer.h> | ||
24 | #include <linux/resource.h> | ||
25 | #include <linux/nvhost.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <asm/mach-types.h> | ||
28 | #include <mach/nvmap.h> | ||
29 | #include <mach/irqs.h> | ||
30 | #include <mach/iomap.h> | ||
31 | #include <mach/dc.h> | ||
32 | #include <mach/fb.h> | ||
33 | |||
34 | #include "board-p852.h" | ||
35 | |||
36 | #define CARVEOUT_IRAM {\ | ||
37 | .name = "iram",\ | ||
38 | .usage_mask = NVMAP_HEAP_CARVEOUT_IRAM,\ | ||
39 | .base = TEGRA_IRAM_BASE,\ | ||
40 | .size = TEGRA_IRAM_SIZE,\ | ||
41 | .buddy_size = 0, /* no buddy allocation for IRAM */\ | ||
42 | } | ||
43 | |||
44 | static int p852_panel_enable(void) | ||
45 | { | ||
46 | pr_info("%s\n", __func__); | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static int p852_panel_disable(void) | ||
51 | { | ||
52 | pr_info("%s\n", __func__); | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | static struct resource p852_disp_resources[] = { | ||
57 | { | ||
58 | .name = "irq", | ||
59 | .start = INT_DISPLAY_GENERAL, | ||
60 | .end = INT_DISPLAY_GENERAL, | ||
61 | .flags = IORESOURCE_IRQ, | ||
62 | }, | ||
63 | { | ||
64 | .name = "regs", | ||
65 | .start = TEGRA_DISPLAY_BASE, | ||
66 | .end = TEGRA_DISPLAY_BASE + TEGRA_DISPLAY_SIZE - 1, | ||
67 | .flags = IORESOURCE_MEM, | ||
68 | }, | ||
69 | { | ||
70 | .name = "fbmem", | ||
71 | .start = 0, | ||
72 | .end = 0, | ||
73 | .flags = IORESOURCE_MEM, | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | static struct tegra_dc_mode p852_panel_modes[] = { | ||
78 | /* Timings for the LG LB070WV4 panel */ | ||
79 | { | ||
80 | .pclk = 33230769, | ||
81 | |||
82 | .h_ref_to_sync = 1, | ||
83 | .v_ref_to_sync = 1, | ||
84 | |||
85 | .h_sync_width = 128, | ||
86 | .v_sync_width = 2, | ||
87 | |||
88 | .h_back_porch = 88, | ||
89 | .v_back_porch = 30, | ||
90 | |||
91 | .h_front_porch = 40, | ||
92 | .v_front_porch = 13, | ||
93 | |||
94 | .h_active = 800, | ||
95 | .v_active = 480, | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | static struct tegra_fb_data p852_fb_data = { | ||
100 | .win = 0, | ||
101 | .xres = 800, | ||
102 | .yres = 480, | ||
103 | .bits_per_pixel = 16, | ||
104 | }; | ||
105 | |||
106 | static struct tegra_dc_out p852_disp_out = { | ||
107 | .type = TEGRA_DC_OUT_RGB, | ||
108 | |||
109 | .align = TEGRA_DC_ALIGN_MSB, | ||
110 | .order = TEGRA_DC_ORDER_RED_BLUE, | ||
111 | |||
112 | .modes = p852_panel_modes, | ||
113 | .n_modes = ARRAY_SIZE(p852_panel_modes), | ||
114 | |||
115 | .enable = p852_panel_enable, | ||
116 | .disable = p852_panel_disable, | ||
117 | }; | ||
118 | |||
119 | static struct tegra_dc_platform_data p852_disp_pdata = { | ||
120 | .flags = TEGRA_DC_FLAG_ENABLED, | ||
121 | .default_out = &p852_disp_out, | ||
122 | .fb = &p852_fb_data, | ||
123 | }; | ||
124 | |||
125 | static struct nvhost_device p852_disp_device = { | ||
126 | .name = "tegradc", | ||
127 | .id = 0, | ||
128 | .resource = p852_disp_resources, | ||
129 | .num_resources = ARRAY_SIZE(p852_disp_resources), | ||
130 | .dev = { | ||
131 | .platform_data = &p852_disp_pdata, | ||
132 | }, | ||
133 | }; | ||
134 | |||
135 | static struct nvmap_platform_carveout p852_carveouts[] = { | ||
136 | [0] = CARVEOUT_IRAM, | ||
137 | [1] = { | ||
138 | .name = "generic-0", | ||
139 | .usage_mask = NVMAP_HEAP_CARVEOUT_GENERIC, | ||
140 | .base = 0, | ||
141 | .size = 0, | ||
142 | .buddy_size = SZ_32K, | ||
143 | }, | ||
144 | }; | ||
145 | |||
146 | static struct nvmap_platform_data p852_nvmap_data = { | ||
147 | .carveouts = p852_carveouts, | ||
148 | .nr_carveouts = ARRAY_SIZE(p852_carveouts), | ||
149 | }; | ||
150 | |||
151 | static struct platform_device p852_nvmap_device = { | ||
152 | .name = "tegra-nvmap", | ||
153 | .id = -1, | ||
154 | .dev = { | ||
155 | .platform_data = &p852_nvmap_data, | ||
156 | }, | ||
157 | }; | ||
158 | |||
159 | static struct platform_device *p852_gfx_devices[] __initdata = { | ||
160 | &tegra_pwfm2_device, | ||
161 | }; | ||
162 | |||
163 | int __init p852_panel_init(void) | ||
164 | { | ||
165 | int err; | ||
166 | struct resource *res; | ||
167 | |||
168 | pr_info("%s\n", __func__); | ||
169 | |||
170 | p852_carveouts[1].base = tegra_carveout_start; | ||
171 | p852_carveouts[1].size = tegra_carveout_size; | ||
172 | |||
173 | err = platform_device_register(&p852_nvmap_device); | ||
174 | if (err) | ||
175 | return err; | ||
176 | |||
177 | #ifdef CONFIG_TEGRA_GRHOST | ||
178 | err = nvhost_device_register(&tegra_grhost_device); | ||
179 | if (err) | ||
180 | return err; | ||
181 | #endif | ||
182 | |||
183 | err = platform_add_devices(p852_gfx_devices, | ||
184 | ARRAY_SIZE(p852_gfx_devices)); | ||
185 | |||
186 | res = nvhost_get_resource_byname(&p852_disp_device, | ||
187 | IORESOURCE_MEM, "fbmem"); | ||
188 | |||
189 | res->start = tegra_fb_start; | ||
190 | res->end = tegra_fb_start + tegra_fb_size - 1; | ||
191 | |||
192 | if (!err) | ||
193 | err = nvhost_device_register(&p852_disp_device); | ||
194 | |||
195 | return err; | ||
196 | } | ||