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