Commit | Line | Data |
---|---|---|
0191bf36 TV |
1 | /* |
2 | * Copyright (C) 2012 Texas Instruments, Inc.. | |
3 | * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or | |
6 | * modify it under the terms of the GNU General Public License | |
7 | * version 2 as published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, but | |
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | * General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
17 | * 02110-1301 USA | |
18 | * | |
19 | */ | |
20 | ||
21 | /* | |
22 | * NOTE: this is a transitional file to help with DT adaptation. | |
23 | * This file will be removed when DSS supports DT. | |
24 | */ | |
25 | ||
26 | #include <linux/kernel.h> | |
86cf29dc TV |
27 | #include <linux/gpio.h> |
28 | ||
0191bf36 TV |
29 | #include <video/omapdss.h> |
30 | #include <video/omap-panel-tfp410.h> | |
86cf29dc TV |
31 | #include <video/omap-panel-nokia-dsi.h> |
32 | #include <video/omap-panel-picodlp.h> | |
0191bf36 | 33 | |
e8d3d47a | 34 | #include "soc.h" |
0191bf36 TV |
35 | #include "dss-common.h" |
36 | #include "mux.h" | |
37 | ||
38 | #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */ | |
39 | #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ | |
40 | #define HDMI_GPIO_HPD 63 /* Hotplug detect */ | |
41 | ||
42 | /* Display DVI */ | |
43 | #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0 | |
44 | ||
45 | /* Using generic display panel */ | |
46 | static struct tfp410_platform_data omap4_dvi_panel = { | |
47 | .i2c_bus_num = 3, | |
48 | .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, | |
49 | }; | |
50 | ||
51 | static struct omap_dss_device omap4_panda_dvi_device = { | |
52 | .type = OMAP_DISPLAY_TYPE_DPI, | |
53 | .name = "dvi", | |
54 | .driver_name = "tfp410", | |
55 | .data = &omap4_dvi_panel, | |
56 | .phy.dpi.data_lines = 24, | |
57 | .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, | |
58 | .channel = OMAP_DSS_CHANNEL_LCD2, | |
59 | }; | |
60 | ||
61 | static struct omap_dss_hdmi_data omap4_panda_hdmi_data = { | |
62 | .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD, | |
63 | .ls_oe_gpio = HDMI_GPIO_LS_OE, | |
64 | .hpd_gpio = HDMI_GPIO_HPD, | |
65 | }; | |
66 | ||
67 | static struct omap_dss_device omap4_panda_hdmi_device = { | |
68 | .name = "hdmi", | |
69 | .driver_name = "hdmi_panel", | |
70 | .type = OMAP_DISPLAY_TYPE_HDMI, | |
71 | .channel = OMAP_DSS_CHANNEL_DIGIT, | |
72 | .data = &omap4_panda_hdmi_data, | |
73 | }; | |
74 | ||
75 | static struct omap_dss_device *omap4_panda_dss_devices[] = { | |
76 | &omap4_panda_dvi_device, | |
77 | &omap4_panda_hdmi_device, | |
78 | }; | |
79 | ||
80 | static struct omap_dss_board_info omap4_panda_dss_data = { | |
81 | .num_devices = ARRAY_SIZE(omap4_panda_dss_devices), | |
82 | .devices = omap4_panda_dss_devices, | |
83 | .default_device = &omap4_panda_dvi_device, | |
84 | }; | |
85 | ||
86 | void __init omap4_panda_display_init(void) | |
87 | { | |
88 | omap_display_init(&omap4_panda_dss_data); | |
89 | ||
90 | /* | |
91 | * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and | |
92 | * later have external pull up on the HDMI I2C lines | |
93 | */ | |
94 | if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2) | |
95 | omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP); | |
96 | else | |
97 | omap_hdmi_init(0); | |
98 | ||
99 | omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT); | |
100 | omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT); | |
101 | omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN); | |
102 | } | |
103 | ||
104 | void __init omap4_panda_display_init_of(void) | |
105 | { | |
106 | omap_display_init(&omap4_panda_dss_data); | |
107 | } | |
86cf29dc TV |
108 | |
109 | ||
110 | /* OMAP4 Blaze display data */ | |
111 | ||
112 | #define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */ | |
113 | #define DLP_POWER_ON_GPIO 40 | |
114 | ||
115 | static struct nokia_dsi_panel_data dsi1_panel = { | |
116 | .name = "taal", | |
117 | .reset_gpio = 102, | |
118 | .use_ext_te = false, | |
119 | .ext_te_gpio = 101, | |
120 | .esd_interval = 0, | |
121 | .pin_config = { | |
122 | .num_pins = 6, | |
123 | .pins = { 0, 1, 2, 3, 4, 5 }, | |
124 | }, | |
125 | }; | |
126 | ||
127 | static struct omap_dss_device sdp4430_lcd_device = { | |
128 | .name = "lcd", | |
129 | .driver_name = "taal", | |
130 | .type = OMAP_DISPLAY_TYPE_DSI, | |
131 | .data = &dsi1_panel, | |
132 | .phy.dsi = { | |
133 | .module = 0, | |
134 | }, | |
135 | .channel = OMAP_DSS_CHANNEL_LCD, | |
136 | }; | |
137 | ||
138 | static struct nokia_dsi_panel_data dsi2_panel = { | |
139 | .name = "taal", | |
140 | .reset_gpio = 104, | |
141 | .use_ext_te = false, | |
142 | .ext_te_gpio = 103, | |
143 | .esd_interval = 0, | |
144 | .pin_config = { | |
145 | .num_pins = 6, | |
146 | .pins = { 0, 1, 2, 3, 4, 5 }, | |
147 | }, | |
148 | }; | |
149 | ||
150 | static struct omap_dss_device sdp4430_lcd2_device = { | |
151 | .name = "lcd2", | |
152 | .driver_name = "taal", | |
153 | .type = OMAP_DISPLAY_TYPE_DSI, | |
154 | .data = &dsi2_panel, | |
155 | .phy.dsi = { | |
156 | ||
157 | .module = 1, | |
158 | }, | |
159 | .channel = OMAP_DSS_CHANNEL_LCD2, | |
160 | }; | |
161 | ||
162 | static struct omap_dss_hdmi_data sdp4430_hdmi_data = { | |
163 | .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD, | |
164 | .ls_oe_gpio = HDMI_GPIO_LS_OE, | |
165 | .hpd_gpio = HDMI_GPIO_HPD, | |
166 | }; | |
167 | ||
168 | static struct omap_dss_device sdp4430_hdmi_device = { | |
169 | .name = "hdmi", | |
170 | .driver_name = "hdmi_panel", | |
171 | .type = OMAP_DISPLAY_TYPE_HDMI, | |
172 | .channel = OMAP_DSS_CHANNEL_DIGIT, | |
173 | .data = &sdp4430_hdmi_data, | |
174 | }; | |
175 | ||
176 | static struct picodlp_panel_data sdp4430_picodlp_pdata = { | |
177 | .picodlp_adapter_id = 2, | |
178 | .emu_done_gpio = 44, | |
179 | .pwrgood_gpio = 45, | |
180 | }; | |
181 | ||
182 | static void sdp4430_picodlp_init(void) | |
183 | { | |
184 | int r; | |
185 | const struct gpio picodlp_gpios[] = { | |
186 | {DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW, | |
187 | "DLP POWER ON"}, | |
188 | {sdp4430_picodlp_pdata.emu_done_gpio, GPIOF_IN, | |
189 | "DLP EMU DONE"}, | |
190 | {sdp4430_picodlp_pdata.pwrgood_gpio, GPIOF_OUT_INIT_LOW, | |
191 | "DLP PWRGOOD"}, | |
192 | }; | |
193 | ||
194 | r = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios)); | |
195 | if (r) | |
196 | pr_err("Cannot request PicoDLP GPIOs, error %d\n", r); | |
197 | } | |
198 | ||
199 | static int sdp4430_panel_enable_picodlp(struct omap_dss_device *dssdev) | |
200 | { | |
201 | gpio_set_value(DISPLAY_SEL_GPIO, 0); | |
202 | gpio_set_value(DLP_POWER_ON_GPIO, 1); | |
203 | ||
204 | return 0; | |
205 | } | |
206 | ||
207 | static void sdp4430_panel_disable_picodlp(struct omap_dss_device *dssdev) | |
208 | { | |
209 | gpio_set_value(DLP_POWER_ON_GPIO, 0); | |
210 | gpio_set_value(DISPLAY_SEL_GPIO, 1); | |
211 | } | |
212 | ||
213 | static struct omap_dss_device sdp4430_picodlp_device = { | |
214 | .name = "picodlp", | |
215 | .driver_name = "picodlp_panel", | |
216 | .type = OMAP_DISPLAY_TYPE_DPI, | |
217 | .phy.dpi.data_lines = 24, | |
218 | .channel = OMAP_DSS_CHANNEL_LCD2, | |
219 | .platform_enable = sdp4430_panel_enable_picodlp, | |
220 | .platform_disable = sdp4430_panel_disable_picodlp, | |
221 | .data = &sdp4430_picodlp_pdata, | |
222 | }; | |
223 | ||
224 | static struct omap_dss_device *sdp4430_dss_devices[] = { | |
225 | &sdp4430_lcd_device, | |
226 | &sdp4430_lcd2_device, | |
227 | &sdp4430_hdmi_device, | |
228 | &sdp4430_picodlp_device, | |
229 | }; | |
230 | ||
231 | static struct omap_dss_board_info sdp4430_dss_data = { | |
232 | .num_devices = ARRAY_SIZE(sdp4430_dss_devices), | |
233 | .devices = sdp4430_dss_devices, | |
234 | .default_device = &sdp4430_lcd_device, | |
235 | }; | |
236 | ||
237 | void __init omap_4430sdp_display_init(void) | |
238 | { | |
239 | int r; | |
240 | ||
241 | /* Enable LCD2 by default (instead of Pico DLP) */ | |
242 | r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH, | |
243 | "display_sel"); | |
244 | if (r) | |
245 | pr_err("%s: Could not get display_sel GPIO\n", __func__); | |
246 | ||
247 | sdp4430_picodlp_init(); | |
248 | omap_display_init(&sdp4430_dss_data); | |
249 | /* | |
250 | * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and | |
251 | * later have external pull up on the HDMI I2C lines | |
252 | */ | |
253 | if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2) | |
254 | omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP); | |
255 | else | |
256 | omap_hdmi_init(0); | |
257 | ||
258 | omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT); | |
259 | omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT); | |
260 | omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN); | |
261 | } | |
262 | ||
263 | void __init omap_4430sdp_display_init_of(void) | |
264 | { | |
265 | int r; | |
266 | ||
267 | /* Enable LCD2 by default (instead of Pico DLP) */ | |
268 | r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH, | |
269 | "display_sel"); | |
270 | if (r) | |
271 | pr_err("%s: Could not get display_sel GPIO\n", __func__); | |
272 | ||
273 | sdp4430_picodlp_init(); | |
274 | omap_display_init(&sdp4430_dss_data); | |
275 | } |