Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 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> |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 27 | #include <linux/gpio.h> |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 28 | #include <linux/platform_device.h> |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 29 | |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 30 | #include <video/omapdss.h> |
Archit Taneja | a0d8dde | 2013-02-12 16:46:46 +0530 | [diff] [blame] | 31 | #include <video/omap-panel-data.h> |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 32 | |
Tony Lindgren | e8d3d47 | 2012-12-16 11:29:58 -0800 | [diff] [blame] | 33 | #include "soc.h" |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 34 | #include "dss-common.h" |
| 35 | #include "mux.h" |
| 36 | |
| 37 | #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */ |
| 38 | #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ |
| 39 | #define HDMI_GPIO_HPD 63 /* Hotplug detect */ |
| 40 | |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 41 | #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0 |
| 42 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 43 | /* DVI Connector */ |
| 44 | static struct connector_dvi_platform_data omap4_panda_dvi_connector_pdata = { |
| 45 | .name = "dvi", |
| 46 | .source = "tfp410.0", |
| 47 | .i2c_bus_num = 2, |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 48 | }; |
| 49 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 50 | static struct platform_device omap4_panda_dvi_connector_device = { |
| 51 | .name = "connector-dvi", |
| 52 | .id = 0, |
| 53 | .dev.platform_data = &omap4_panda_dvi_connector_pdata, |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 54 | }; |
| 55 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 56 | /* TFP410 DPI-to-DVI chip */ |
| 57 | static struct encoder_tfp410_platform_data omap4_panda_tfp410_pdata = { |
| 58 | .name = "tfp410.0", |
| 59 | .source = "dpi.0", |
| 60 | .data_lines = 24, |
| 61 | .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, |
| 62 | }; |
| 63 | |
| 64 | static struct platform_device omap4_panda_tfp410_device = { |
| 65 | .name = "tfp410", |
| 66 | .id = 0, |
| 67 | .dev.platform_data = &omap4_panda_tfp410_pdata, |
| 68 | }; |
| 69 | |
| 70 | /* HDMI Connector */ |
| 71 | static struct connector_hdmi_platform_data omap4_panda_hdmi_connector_pdata = { |
| 72 | .name = "hdmi", |
| 73 | .source = "tpd12s015.0", |
| 74 | }; |
| 75 | |
| 76 | static struct platform_device omap4_panda_hdmi_connector_device = { |
| 77 | .name = "connector-hdmi", |
| 78 | .id = 0, |
| 79 | .dev.platform_data = &omap4_panda_hdmi_connector_pdata, |
| 80 | }; |
| 81 | |
| 82 | /* TPD12S015 HDMI ESD protection & level shifter chip */ |
| 83 | static struct encoder_tpd12s015_platform_data omap4_panda_tpd_pdata = { |
| 84 | .name = "tpd12s015.0", |
| 85 | .source = "hdmi.0", |
| 86 | |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 87 | .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD, |
| 88 | .ls_oe_gpio = HDMI_GPIO_LS_OE, |
| 89 | .hpd_gpio = HDMI_GPIO_HPD, |
| 90 | }; |
| 91 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 92 | static struct platform_device omap4_panda_tpd_device = { |
| 93 | .name = "tpd12s015", |
| 94 | .id = 0, |
| 95 | .dev.platform_data = &omap4_panda_tpd_pdata, |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | static struct omap_dss_board_info omap4_panda_dss_data = { |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 99 | .default_display_name = "dvi", |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 100 | }; |
| 101 | |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 102 | void __init omap4_panda_display_init_of(void) |
| 103 | { |
| 104 | omap_display_init(&omap4_panda_dss_data); |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 105 | |
| 106 | platform_device_register(&omap4_panda_tfp410_device); |
| 107 | platform_device_register(&omap4_panda_dvi_connector_device); |
| 108 | |
| 109 | platform_device_register(&omap4_panda_tpd_device); |
| 110 | platform_device_register(&omap4_panda_hdmi_connector_device); |
Tomi Valkeinen | 0191bf3 | 2012-11-05 15:14:17 +0200 | [diff] [blame] | 111 | } |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 112 | |
| 113 | |
| 114 | /* OMAP4 Blaze display data */ |
| 115 | |
| 116 | #define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */ |
| 117 | #define DLP_POWER_ON_GPIO 40 |
| 118 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 119 | static struct panel_dsicm_platform_data dsi1_panel = { |
| 120 | .name = "lcd", |
| 121 | .source = "dsi.0", |
| 122 | .reset_gpio = 102, |
| 123 | .use_ext_te = false, |
| 124 | .ext_te_gpio = 101, |
| 125 | .pin_config = { |
| 126 | .num_pins = 6, |
| 127 | .pins = { 0, 1, 2, 3, 4, 5 }, |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 128 | }, |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 129 | }; |
| 130 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 131 | static struct platform_device sdp4430_lcd_device = { |
| 132 | .name = "panel-dsi-cm", |
| 133 | .id = 0, |
| 134 | .dev.platform_data = &dsi1_panel, |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 135 | }; |
| 136 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 137 | static struct panel_dsicm_platform_data dsi2_panel = { |
| 138 | .name = "lcd2", |
| 139 | .source = "dsi.1", |
| 140 | .reset_gpio = 104, |
| 141 | .use_ext_te = false, |
| 142 | .ext_te_gpio = 103, |
| 143 | .pin_config = { |
| 144 | .num_pins = 6, |
| 145 | .pins = { 0, 1, 2, 3, 4, 5 }, |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 146 | }, |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 147 | }; |
| 148 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 149 | static struct platform_device sdp4430_lcd2_device = { |
| 150 | .name = "panel-dsi-cm", |
| 151 | .id = 1, |
| 152 | .dev.platform_data = &dsi2_panel, |
| 153 | }; |
| 154 | |
| 155 | /* HDMI Connector */ |
| 156 | static struct connector_hdmi_platform_data sdp4430_hdmi_connector_pdata = { |
| 157 | .name = "hdmi", |
| 158 | .source = "tpd12s015.0", |
| 159 | }; |
| 160 | |
| 161 | static struct platform_device sdp4430_hdmi_connector_device = { |
| 162 | .name = "connector-hdmi", |
| 163 | .id = 0, |
| 164 | .dev.platform_data = &sdp4430_hdmi_connector_pdata, |
| 165 | }; |
| 166 | |
| 167 | /* TPD12S015 HDMI ESD protection & level shifter chip */ |
| 168 | static struct encoder_tpd12s015_platform_data sdp4430_tpd_pdata = { |
| 169 | .name = "tpd12s015.0", |
| 170 | .source = "hdmi.0", |
| 171 | |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 172 | .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD, |
| 173 | .ls_oe_gpio = HDMI_GPIO_LS_OE, |
| 174 | .hpd_gpio = HDMI_GPIO_HPD, |
| 175 | }; |
| 176 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 177 | static struct platform_device sdp4430_tpd_device = { |
| 178 | .name = "tpd12s015", |
| 179 | .id = 0, |
| 180 | .dev.platform_data = &sdp4430_tpd_pdata, |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 181 | }; |
| 182 | |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 183 | |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 184 | static struct omap_dss_board_info sdp4430_dss_data = { |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 185 | .default_display_name = "lcd", |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 186 | }; |
| 187 | |
Archit Taneja | e5e5332 | 2013-02-04 12:23:02 +0530 | [diff] [blame] | 188 | /* |
| 189 | * we select LCD2 by default (instead of Pico DLP) by setting DISPLAY_SEL_GPIO. |
| 190 | * Setting DLP_POWER_ON gpio enables the VDLP_2V5 VDLP_1V8 and VDLP_1V0 rails |
| 191 | * used by picodlp on the 4430sdp platform. Keep this gpio disabled as LCD2 is |
| 192 | * selected by default |
| 193 | */ |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 194 | void __init omap_4430sdp_display_init_of(void) |
| 195 | { |
| 196 | int r; |
| 197 | |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 198 | r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH, |
| 199 | "display_sel"); |
| 200 | if (r) |
| 201 | pr_err("%s: Could not get display_sel GPIO\n", __func__); |
| 202 | |
Archit Taneja | e5e5332 | 2013-02-04 12:23:02 +0530 | [diff] [blame] | 203 | r = gpio_request_one(DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW, |
| 204 | "DLP POWER ON"); |
| 205 | if (r) |
| 206 | pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__); |
| 207 | |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 208 | omap_display_init(&sdp4430_dss_data); |
Tomi Valkeinen | 7346582 | 2013-04-24 11:29:03 +0300 | [diff] [blame] | 209 | |
| 210 | platform_device_register(&sdp4430_lcd_device); |
| 211 | platform_device_register(&sdp4430_lcd2_device); |
| 212 | |
| 213 | platform_device_register(&sdp4430_tpd_device); |
| 214 | platform_device_register(&sdp4430_hdmi_connector_device); |
Tomi Valkeinen | 86cf29d | 2012-11-05 15:14:18 +0200 | [diff] [blame] | 215 | } |