blob: 9c49bbe825f79416d3ce77eaa950e6676b6a5e50 [file] [log] [blame]
Tomi Valkeinen0191bf32012-11-05 15:14:17 +02001/*
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>
Tomi Valkeinen86cf29d2012-11-05 15:14:18 +020027#include <linux/gpio.h>
28
Tomi Valkeinen0191bf32012-11-05 15:14:17 +020029#include <video/omapdss.h>
Archit Tanejaa0d8dde2013-02-12 16:46:46 +053030#include <video/omap-panel-data.h>
Tomi Valkeinen0191bf32012-11-05 15:14:17 +020031
Tony Lindgrene8d3d472012-12-16 11:29:58 -080032#include "soc.h"
Tomi Valkeinen0191bf32012-11-05 15:14:17 +020033#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 */
44static struct tfp410_platform_data omap4_dvi_panel = {
45 .i2c_bus_num = 3,
46 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
47};
48
49static 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 .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
56 .channel = OMAP_DSS_CHANNEL_LCD2,
57};
58
59static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
60 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
61 .ls_oe_gpio = HDMI_GPIO_LS_OE,
62 .hpd_gpio = HDMI_GPIO_HPD,
63};
64
65static struct omap_dss_device omap4_panda_hdmi_device = {
66 .name = "hdmi",
67 .driver_name = "hdmi_panel",
68 .type = OMAP_DISPLAY_TYPE_HDMI,
69 .channel = OMAP_DSS_CHANNEL_DIGIT,
70 .data = &omap4_panda_hdmi_data,
71};
72
73static struct omap_dss_device *omap4_panda_dss_devices[] = {
74 &omap4_panda_dvi_device,
75 &omap4_panda_hdmi_device,
76};
77
78static struct omap_dss_board_info omap4_panda_dss_data = {
79 .num_devices = ARRAY_SIZE(omap4_panda_dss_devices),
80 .devices = omap4_panda_dss_devices,
81 .default_device = &omap4_panda_dvi_device,
82};
83
84void __init omap4_panda_display_init(void)
85{
86 omap_display_init(&omap4_panda_dss_data);
87
88 /*
89 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
90 * later have external pull up on the HDMI I2C lines
91 */
92 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
93 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
94 else
95 omap_hdmi_init(0);
96
97 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
98 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
99 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
100}
101
102void __init omap4_panda_display_init_of(void)
103{
104 omap_display_init(&omap4_panda_dss_data);
105}
Tomi Valkeinen86cf29d2012-11-05 15:14:18 +0200106
107
108/* OMAP4 Blaze display data */
109
110#define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */
111#define DLP_POWER_ON_GPIO 40
112
113static struct nokia_dsi_panel_data dsi1_panel = {
114 .name = "taal",
115 .reset_gpio = 102,
116 .use_ext_te = false,
117 .ext_te_gpio = 101,
118 .esd_interval = 0,
119 .pin_config = {
120 .num_pins = 6,
121 .pins = { 0, 1, 2, 3, 4, 5 },
122 },
123};
124
125static struct omap_dss_device sdp4430_lcd_device = {
126 .name = "lcd",
127 .driver_name = "taal",
128 .type = OMAP_DISPLAY_TYPE_DSI,
129 .data = &dsi1_panel,
130 .phy.dsi = {
131 .module = 0,
132 },
133 .channel = OMAP_DSS_CHANNEL_LCD,
134};
135
136static struct nokia_dsi_panel_data dsi2_panel = {
137 .name = "taal",
138 .reset_gpio = 104,
139 .use_ext_te = false,
140 .ext_te_gpio = 103,
141 .esd_interval = 0,
142 .pin_config = {
143 .num_pins = 6,
144 .pins = { 0, 1, 2, 3, 4, 5 },
145 },
146};
147
148static struct omap_dss_device sdp4430_lcd2_device = {
149 .name = "lcd2",
150 .driver_name = "taal",
151 .type = OMAP_DISPLAY_TYPE_DSI,
152 .data = &dsi2_panel,
153 .phy.dsi = {
154
155 .module = 1,
156 },
157 .channel = OMAP_DSS_CHANNEL_LCD2,
158};
159
160static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
161 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
162 .ls_oe_gpio = HDMI_GPIO_LS_OE,
163 .hpd_gpio = HDMI_GPIO_HPD,
164};
165
166static struct omap_dss_device sdp4430_hdmi_device = {
167 .name = "hdmi",
168 .driver_name = "hdmi_panel",
169 .type = OMAP_DISPLAY_TYPE_HDMI,
170 .channel = OMAP_DSS_CHANNEL_DIGIT,
171 .data = &sdp4430_hdmi_data,
172};
173
174static struct picodlp_panel_data sdp4430_picodlp_pdata = {
175 .picodlp_adapter_id = 2,
176 .emu_done_gpio = 44,
177 .pwrgood_gpio = 45,
178};
179
180static void sdp4430_picodlp_init(void)
181{
182 int r;
183 const struct gpio picodlp_gpios[] = {
184 {DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
185 "DLP POWER ON"},
186 {sdp4430_picodlp_pdata.emu_done_gpio, GPIOF_IN,
187 "DLP EMU DONE"},
188 {sdp4430_picodlp_pdata.pwrgood_gpio, GPIOF_OUT_INIT_LOW,
189 "DLP PWRGOOD"},
190 };
191
192 r = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios));
193 if (r)
194 pr_err("Cannot request PicoDLP GPIOs, error %d\n", r);
195}
196
197static int sdp4430_panel_enable_picodlp(struct omap_dss_device *dssdev)
198{
199 gpio_set_value(DISPLAY_SEL_GPIO, 0);
200 gpio_set_value(DLP_POWER_ON_GPIO, 1);
201
202 return 0;
203}
204
205static void sdp4430_panel_disable_picodlp(struct omap_dss_device *dssdev)
206{
207 gpio_set_value(DLP_POWER_ON_GPIO, 0);
208 gpio_set_value(DISPLAY_SEL_GPIO, 1);
209}
210
211static struct omap_dss_device sdp4430_picodlp_device = {
212 .name = "picodlp",
213 .driver_name = "picodlp_panel",
214 .type = OMAP_DISPLAY_TYPE_DPI,
215 .phy.dpi.data_lines = 24,
216 .channel = OMAP_DSS_CHANNEL_LCD2,
217 .platform_enable = sdp4430_panel_enable_picodlp,
218 .platform_disable = sdp4430_panel_disable_picodlp,
219 .data = &sdp4430_picodlp_pdata,
220};
221
222static struct omap_dss_device *sdp4430_dss_devices[] = {
223 &sdp4430_lcd_device,
224 &sdp4430_lcd2_device,
225 &sdp4430_hdmi_device,
226 &sdp4430_picodlp_device,
227};
228
229static struct omap_dss_board_info sdp4430_dss_data = {
230 .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
231 .devices = sdp4430_dss_devices,
232 .default_device = &sdp4430_lcd_device,
233};
234
235void __init omap_4430sdp_display_init(void)
236{
237 int r;
238
239 /* Enable LCD2 by default (instead of Pico DLP) */
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 sdp4430_picodlp_init();
246 omap_display_init(&sdp4430_dss_data);
247 /*
248 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
249 * later have external pull up on the HDMI I2C lines
250 */
251 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
252 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
253 else
254 omap_hdmi_init(0);
255
256 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
257 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
258 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
259}
260
261void __init omap_4430sdp_display_init_of(void)
262{
263 int r;
264
265 /* Enable LCD2 by default (instead of Pico DLP) */
266 r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
267 "display_sel");
268 if (r)
269 pr_err("%s: Could not get display_sel GPIO\n", __func__);
270
271 sdp4430_picodlp_init();
272 omap_display_init(&sdp4430_dss_data);
273}