Merge tag 'for-3.8-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk...
[deliverable/linux.git] / arch / arm / mach-omap2 / dss-common.c
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>
27 #include <linux/gpio.h>
28
29 #include <video/omapdss.h>
30 #include <video/omap-panel-tfp410.h>
31 #include <video/omap-panel-nokia-dsi.h>
32 #include <video/omap-panel-picodlp.h>
33
34 #include <plat/cpu.h>
35
36 #include "dss-common.h"
37 #include "mux.h"
38
39 #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
40 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
41 #define HDMI_GPIO_HPD 63 /* Hotplug detect */
42
43 /* Display DVI */
44 #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
45
46 /* Using generic display panel */
47 static struct tfp410_platform_data omap4_dvi_panel = {
48 .i2c_bus_num = 3,
49 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
50 };
51
52 static struct omap_dss_device omap4_panda_dvi_device = {
53 .type = OMAP_DISPLAY_TYPE_DPI,
54 .name = "dvi",
55 .driver_name = "tfp410",
56 .data = &omap4_dvi_panel,
57 .phy.dpi.data_lines = 24,
58 .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
59 .channel = OMAP_DSS_CHANNEL_LCD2,
60 };
61
62 static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
63 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
64 .ls_oe_gpio = HDMI_GPIO_LS_OE,
65 .hpd_gpio = HDMI_GPIO_HPD,
66 };
67
68 static struct omap_dss_device omap4_panda_hdmi_device = {
69 .name = "hdmi",
70 .driver_name = "hdmi_panel",
71 .type = OMAP_DISPLAY_TYPE_HDMI,
72 .channel = OMAP_DSS_CHANNEL_DIGIT,
73 .data = &omap4_panda_hdmi_data,
74 };
75
76 static struct omap_dss_device *omap4_panda_dss_devices[] = {
77 &omap4_panda_dvi_device,
78 &omap4_panda_hdmi_device,
79 };
80
81 static struct omap_dss_board_info omap4_panda_dss_data = {
82 .num_devices = ARRAY_SIZE(omap4_panda_dss_devices),
83 .devices = omap4_panda_dss_devices,
84 .default_device = &omap4_panda_dvi_device,
85 };
86
87 void __init omap4_panda_display_init(void)
88 {
89 omap_display_init(&omap4_panda_dss_data);
90
91 /*
92 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
93 * later have external pull up on the HDMI I2C lines
94 */
95 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
96 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
97 else
98 omap_hdmi_init(0);
99
100 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
101 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
102 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
103 }
104
105 void __init omap4_panda_display_init_of(void)
106 {
107 omap_display_init(&omap4_panda_dss_data);
108 }
109
110
111 /* OMAP4 Blaze display data */
112
113 #define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */
114 #define DLP_POWER_ON_GPIO 40
115
116 static struct nokia_dsi_panel_data dsi1_panel = {
117 .name = "taal",
118 .reset_gpio = 102,
119 .use_ext_te = false,
120 .ext_te_gpio = 101,
121 .esd_interval = 0,
122 .pin_config = {
123 .num_pins = 6,
124 .pins = { 0, 1, 2, 3, 4, 5 },
125 },
126 };
127
128 static struct omap_dss_device sdp4430_lcd_device = {
129 .name = "lcd",
130 .driver_name = "taal",
131 .type = OMAP_DISPLAY_TYPE_DSI,
132 .data = &dsi1_panel,
133 .phy.dsi = {
134 .module = 0,
135 },
136 .channel = OMAP_DSS_CHANNEL_LCD,
137 };
138
139 static struct nokia_dsi_panel_data dsi2_panel = {
140 .name = "taal",
141 .reset_gpio = 104,
142 .use_ext_te = false,
143 .ext_te_gpio = 103,
144 .esd_interval = 0,
145 .pin_config = {
146 .num_pins = 6,
147 .pins = { 0, 1, 2, 3, 4, 5 },
148 },
149 };
150
151 static struct omap_dss_device sdp4430_lcd2_device = {
152 .name = "lcd2",
153 .driver_name = "taal",
154 .type = OMAP_DISPLAY_TYPE_DSI,
155 .data = &dsi2_panel,
156 .phy.dsi = {
157
158 .module = 1,
159 },
160 .channel = OMAP_DSS_CHANNEL_LCD2,
161 };
162
163 static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
164 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
165 .ls_oe_gpio = HDMI_GPIO_LS_OE,
166 .hpd_gpio = HDMI_GPIO_HPD,
167 };
168
169 static struct omap_dss_device sdp4430_hdmi_device = {
170 .name = "hdmi",
171 .driver_name = "hdmi_panel",
172 .type = OMAP_DISPLAY_TYPE_HDMI,
173 .channel = OMAP_DSS_CHANNEL_DIGIT,
174 .data = &sdp4430_hdmi_data,
175 };
176
177 static struct picodlp_panel_data sdp4430_picodlp_pdata = {
178 .picodlp_adapter_id = 2,
179 .emu_done_gpio = 44,
180 .pwrgood_gpio = 45,
181 };
182
183 static void sdp4430_picodlp_init(void)
184 {
185 int r;
186 const struct gpio picodlp_gpios[] = {
187 {DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
188 "DLP POWER ON"},
189 {sdp4430_picodlp_pdata.emu_done_gpio, GPIOF_IN,
190 "DLP EMU DONE"},
191 {sdp4430_picodlp_pdata.pwrgood_gpio, GPIOF_OUT_INIT_LOW,
192 "DLP PWRGOOD"},
193 };
194
195 r = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios));
196 if (r)
197 pr_err("Cannot request PicoDLP GPIOs, error %d\n", r);
198 }
199
200 static int sdp4430_panel_enable_picodlp(struct omap_dss_device *dssdev)
201 {
202 gpio_set_value(DISPLAY_SEL_GPIO, 0);
203 gpio_set_value(DLP_POWER_ON_GPIO, 1);
204
205 return 0;
206 }
207
208 static void sdp4430_panel_disable_picodlp(struct omap_dss_device *dssdev)
209 {
210 gpio_set_value(DLP_POWER_ON_GPIO, 0);
211 gpio_set_value(DISPLAY_SEL_GPIO, 1);
212 }
213
214 static struct omap_dss_device sdp4430_picodlp_device = {
215 .name = "picodlp",
216 .driver_name = "picodlp_panel",
217 .type = OMAP_DISPLAY_TYPE_DPI,
218 .phy.dpi.data_lines = 24,
219 .channel = OMAP_DSS_CHANNEL_LCD2,
220 .platform_enable = sdp4430_panel_enable_picodlp,
221 .platform_disable = sdp4430_panel_disable_picodlp,
222 .data = &sdp4430_picodlp_pdata,
223 };
224
225 static struct omap_dss_device *sdp4430_dss_devices[] = {
226 &sdp4430_lcd_device,
227 &sdp4430_lcd2_device,
228 &sdp4430_hdmi_device,
229 &sdp4430_picodlp_device,
230 };
231
232 static struct omap_dss_board_info sdp4430_dss_data = {
233 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
234 .devices = sdp4430_dss_devices,
235 .default_device = &sdp4430_lcd_device,
236 };
237
238 void __init omap_4430sdp_display_init(void)
239 {
240 int r;
241
242 /* Enable LCD2 by default (instead of Pico DLP) */
243 r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
244 "display_sel");
245 if (r)
246 pr_err("%s: Could not get display_sel GPIO\n", __func__);
247
248 sdp4430_picodlp_init();
249 omap_display_init(&sdp4430_dss_data);
250 /*
251 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
252 * later have external pull up on the HDMI I2C lines
253 */
254 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
255 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
256 else
257 omap_hdmi_init(0);
258
259 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
260 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
261 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
262 }
263
264 void __init omap_4430sdp_display_init_of(void)
265 {
266 int r;
267
268 /* Enable LCD2 by default (instead of Pico DLP) */
269 r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
270 "display_sel");
271 if (r)
272 pr_err("%s: Could not get display_sel GPIO\n", __func__);
273
274 sdp4430_picodlp_init();
275 omap_display_init(&sdp4430_dss_data);
276 }
This page took 0.044617 seconds and 5 git commands to generate.