aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-05-10 12:55:44 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-05-10 13:24:14 -0400
commit9b71fb5cbcdd83c65e5fe6db9cd12246f7ea0262 (patch)
treed034047d7cd562700c59a0b1b3ba707367939fe7 /drivers/video
parent1dfafbc655b3723e37120d4b30e82d1c87767dd1 (diff)
parente4a9e94cc58ed6e4efb02b80be3a9bf57f448d07 (diff)
Merge branch 'for-l-o-3.5'
Conflicts: drivers/video/omap2/displays/panel-taal.c Merge OMAP DSS related board file changes. The branch will also be merged through linux-omap tree to solve conflicts.
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/displays/Kconfig8
-rw-r--r--drivers/video/omap2/displays/Makefile2
-rw-r--r--drivers/video/omap2/displays/panel-taal.c22
-rw-r--r--drivers/video/omap2/displays/panel-tfp410.c (renamed from drivers/video/omap2/displays/panel-dvi.c)134
-rw-r--r--drivers/video/omap2/dss/dsi.c133
5 files changed, 171 insertions, 128 deletions
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
index 408a9927be9..c3853c92279 100644
--- a/drivers/video/omap2/displays/Kconfig
+++ b/drivers/video/omap2/displays/Kconfig
@@ -10,12 +10,12 @@ config PANEL_GENERIC_DPI
10 Supports LCD Panel used in TI SDP3430 and EVM boards, 10 Supports LCD Panel used in TI SDP3430 and EVM boards,
11 OMAP3517 EVM boards and CM-T35. 11 OMAP3517 EVM boards and CM-T35.
12 12
13config PANEL_DVI 13config PANEL_TFP410
14 tristate "DVI output" 14 tristate "TFP410 DPI-to-DVI chip"
15 depends on OMAP2_DSS_DPI && I2C 15 depends on OMAP2_DSS_DPI && I2C
16 help 16 help
17 Driver for external monitors, connected via DVI. The driver uses i2c 17 Driver for TFP410 DPI-to-DVI chip. The driver uses i2c to read EDID
18 to read EDID information from the monitor. 18 information from the monitor.
19 19
20config PANEL_LGPHILIPS_LB035Q02 20config PANEL_LGPHILIPS_LB035Q02
21 tristate "LG.Philips LB035Q02 LCD Panel" 21 tristate "LG.Philips LB035Q02 LCD Panel"
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
index fbfafc6eebb..58a5176b07b 100644
--- a/drivers/video/omap2/displays/Makefile
+++ b/drivers/video/omap2/displays/Makefile
@@ -1,5 +1,5 @@
1obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o 1obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o
2obj-$(CONFIG_PANEL_DVI) += panel-dvi.o 2obj-$(CONFIG_PANEL_TFP410) += panel-tfp410.o
3obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o 3obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o
4obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o 4obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
5obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o 5obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 3053399faf9..2ce9992f403 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -912,6 +912,15 @@ static int taal_probe(struct omap_dss_device *dssdev)
912 912
913 dev_set_drvdata(&dssdev->dev, td); 913 dev_set_drvdata(&dssdev->dev, td);
914 914
915 if (gpio_is_valid(panel_data->reset_gpio)) {
916 r = gpio_request_one(panel_data->reset_gpio, GPIOF_OUT_INIT_LOW,
917 "taal rst");
918 if (r) {
919 dev_err(&dssdev->dev, "failed to request reset gpio\n");
920 goto err_rst_gpio;
921 }
922 }
923
915 taal_hw_reset(dssdev); 924 taal_hw_reset(dssdev);
916 925
917 if (panel_data->use_dsi_backlight) { 926 if (panel_data->use_dsi_backlight) {
@@ -992,6 +1001,9 @@ err_gpio:
992 if (bldev != NULL) 1001 if (bldev != NULL)
993 backlight_device_unregister(bldev); 1002 backlight_device_unregister(bldev);
994err_bl: 1003err_bl:
1004 if (gpio_is_valid(panel_data->reset_gpio))
1005 gpio_free(panel_data->reset_gpio);
1006err_rst_gpio:
995 destroy_workqueue(td->workqueue); 1007 destroy_workqueue(td->workqueue);
996err_wq: 1008err_wq:
997 kfree(td); 1009 kfree(td);
@@ -1030,15 +1042,25 @@ static void __exit taal_remove(struct omap_dss_device *dssdev)
1030 /* reset, to be sure that the panel is in a valid state */ 1042 /* reset, to be sure that the panel is in a valid state */
1031 taal_hw_reset(dssdev); 1043 taal_hw_reset(dssdev);
1032 1044
1045 if (gpio_is_valid(panel_data->reset_gpio))
1046 gpio_free(panel_data->reset_gpio);
1047
1033 kfree(td); 1048 kfree(td);
1034} 1049}
1035 1050
1036static int taal_power_on(struct omap_dss_device *dssdev) 1051static int taal_power_on(struct omap_dss_device *dssdev)
1037{ 1052{
1038 struct taal_data *td = dev_get_drvdata(&dssdev->dev); 1053 struct taal_data *td = dev_get_drvdata(&dssdev->dev);
1054 struct nokia_dsi_panel_data *panel_data = get_panel_data(dssdev);
1039 u8 id1, id2, id3; 1055 u8 id1, id2, id3;
1040 int r; 1056 int r;
1041 1057
1058 r = omapdss_dsi_configure_pins(dssdev, &panel_data->pin_config);
1059 if (r) {
1060 dev_err(&dssdev->dev, "failed to configure DSI pins\n");
1061 goto err0;
1062 };
1063
1042 r = omapdss_dsi_display_enable(dssdev); 1064 r = omapdss_dsi_display_enable(dssdev);
1043 if (r) { 1065 if (r) {
1044 dev_err(&dssdev->dev, "failed to enable DSI\n"); 1066 dev_err(&dssdev->dev, "failed to enable DSI\n");
diff --git a/drivers/video/omap2/displays/panel-dvi.c b/drivers/video/omap2/displays/panel-tfp410.c
index 03eb14af33e..52637fa8fda 100644
--- a/drivers/video/omap2/displays/panel-dvi.c
+++ b/drivers/video/omap2/displays/panel-tfp410.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * DVI output support 2 * TFP410 DPI-to-DVI chip
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments Inc 4 * Copyright (C) 2011 Texas Instruments Inc
5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> 5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
@@ -21,11 +21,12 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <video/omapdss.h> 22#include <video/omapdss.h>
23#include <linux/i2c.h> 23#include <linux/i2c.h>
24#include <linux/gpio.h>
24#include <drm/drm_edid.h> 25#include <drm/drm_edid.h>
25 26
26#include <video/omap-panel-dvi.h> 27#include <video/omap-panel-tfp410.h>
27 28
28static const struct omap_video_timings panel_dvi_default_timings = { 29static const struct omap_video_timings tfp410_default_timings = {
29 .x_res = 640, 30 .x_res = 640,
30 .y_res = 480, 31 .y_res = 480,
31 32
@@ -44,17 +45,19 @@ struct panel_drv_data {
44 struct omap_dss_device *dssdev; 45 struct omap_dss_device *dssdev;
45 46
46 struct mutex lock; 47 struct mutex lock;
48
49 int pd_gpio;
47}; 50};
48 51
49static inline struct panel_dvi_platform_data 52static inline struct tfp410_platform_data
50*get_pdata(const struct omap_dss_device *dssdev) 53*get_pdata(const struct omap_dss_device *dssdev)
51{ 54{
52 return dssdev->data; 55 return dssdev->data;
53} 56}
54 57
55static int panel_dvi_power_on(struct omap_dss_device *dssdev) 58static int tfp410_power_on(struct omap_dss_device *dssdev)
56{ 59{
57 struct panel_dvi_platform_data *pdata = get_pdata(dssdev); 60 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
58 int r; 61 int r;
59 62
60 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) 63 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
@@ -64,57 +67,72 @@ static int panel_dvi_power_on(struct omap_dss_device *dssdev)
64 if (r) 67 if (r)
65 goto err0; 68 goto err0;
66 69
67 if (pdata->platform_enable) { 70 if (gpio_is_valid(ddata->pd_gpio))
68 r = pdata->platform_enable(dssdev); 71 gpio_set_value(ddata->pd_gpio, 1);
69 if (r)
70 goto err1;
71 }
72 72
73 return 0; 73 return 0;
74err1:
75 omapdss_dpi_display_disable(dssdev);
76err0: 74err0:
77 return r; 75 return r;
78} 76}
79 77
80static void panel_dvi_power_off(struct omap_dss_device *dssdev) 78static void tfp410_power_off(struct omap_dss_device *dssdev)
81{ 79{
82 struct panel_dvi_platform_data *pdata = get_pdata(dssdev); 80 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
83 81
84 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) 82 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
85 return; 83 return;
86 84
87 if (pdata->platform_disable) 85 if (gpio_is_valid(ddata->pd_gpio))
88 pdata->platform_disable(dssdev); 86 gpio_set_value(ddata->pd_gpio, 0);
89 87
90 omapdss_dpi_display_disable(dssdev); 88 omapdss_dpi_display_disable(dssdev);
91} 89}
92 90
93static int panel_dvi_probe(struct omap_dss_device *dssdev) 91static int tfp410_probe(struct omap_dss_device *dssdev)
94{ 92{
93 struct tfp410_platform_data *pdata = get_pdata(dssdev);
95 struct panel_drv_data *ddata; 94 struct panel_drv_data *ddata;
95 int r;
96 96
97 ddata = kzalloc(sizeof(*ddata), GFP_KERNEL); 97 ddata = kzalloc(sizeof(*ddata), GFP_KERNEL);
98 if (!ddata) 98 if (!ddata)
99 return -ENOMEM; 99 return -ENOMEM;
100 100
101 dssdev->panel.timings = panel_dvi_default_timings; 101 dssdev->panel.timings = tfp410_default_timings;
102 dssdev->panel.config = OMAP_DSS_LCD_TFT; 102 dssdev->panel.config = OMAP_DSS_LCD_TFT;
103 103
104 ddata->dssdev = dssdev; 104 ddata->dssdev = dssdev;
105 mutex_init(&ddata->lock); 105 mutex_init(&ddata->lock);
106 106
107 if (pdata)
108 ddata->pd_gpio = pdata->power_down_gpio;
109 else
110 ddata->pd_gpio = -1;
111
112 if (gpio_is_valid(ddata->pd_gpio)) {
113 r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW,
114 "tfp410 pd");
115 if (r) {
116 dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n",
117 ddata->pd_gpio);
118 ddata->pd_gpio = -1;
119 }
120 }
121
107 dev_set_drvdata(&dssdev->dev, ddata); 122 dev_set_drvdata(&dssdev->dev, ddata);
108 123
109 return 0; 124 return 0;
110} 125}
111 126
112static void __exit panel_dvi_remove(struct omap_dss_device *dssdev) 127static void __exit tfp410_remove(struct omap_dss_device *dssdev)
113{ 128{
114 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 129 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
115 130
116 mutex_lock(&ddata->lock); 131 mutex_lock(&ddata->lock);
117 132
133 if (gpio_is_valid(ddata->pd_gpio))
134 gpio_free(ddata->pd_gpio);
135
118 dev_set_drvdata(&dssdev->dev, NULL); 136 dev_set_drvdata(&dssdev->dev, NULL);
119 137
120 mutex_unlock(&ddata->lock); 138 mutex_unlock(&ddata->lock);
@@ -122,14 +140,14 @@ static void __exit panel_dvi_remove(struct omap_dss_device *dssdev)
122 kfree(ddata); 140 kfree(ddata);
123} 141}
124 142
125static int panel_dvi_enable(struct omap_dss_device *dssdev) 143static int tfp410_enable(struct omap_dss_device *dssdev)
126{ 144{
127 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 145 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
128 int r; 146 int r;
129 147
130 mutex_lock(&ddata->lock); 148 mutex_lock(&ddata->lock);
131 149
132 r = panel_dvi_power_on(dssdev); 150 r = tfp410_power_on(dssdev);
133 if (r == 0) 151 if (r == 0)
134 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; 152 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
135 153
@@ -138,26 +156,26 @@ static int panel_dvi_enable(struct omap_dss_device *dssdev)
138 return r; 156 return r;
139} 157}
140 158
141static void panel_dvi_disable(struct omap_dss_device *dssdev) 159static void tfp410_disable(struct omap_dss_device *dssdev)
142{ 160{
143 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 161 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
144 162
145 mutex_lock(&ddata->lock); 163 mutex_lock(&ddata->lock);
146 164
147 panel_dvi_power_off(dssdev); 165 tfp410_power_off(dssdev);
148 166
149 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; 167 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
150 168
151 mutex_unlock(&ddata->lock); 169 mutex_unlock(&ddata->lock);
152} 170}
153 171
154static int panel_dvi_suspend(struct omap_dss_device *dssdev) 172static int tfp410_suspend(struct omap_dss_device *dssdev)
155{ 173{
156 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 174 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
157 175
158 mutex_lock(&ddata->lock); 176 mutex_lock(&ddata->lock);
159 177
160 panel_dvi_power_off(dssdev); 178 tfp410_power_off(dssdev);
161 179
162 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; 180 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
163 181
@@ -166,14 +184,14 @@ static int panel_dvi_suspend(struct omap_dss_device *dssdev)
166 return 0; 184 return 0;
167} 185}
168 186
169static int panel_dvi_resume(struct omap_dss_device *dssdev) 187static int tfp410_resume(struct omap_dss_device *dssdev)
170{ 188{
171 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 189 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
172 int r; 190 int r;
173 191
174 mutex_lock(&ddata->lock); 192 mutex_lock(&ddata->lock);
175 193
176 r = panel_dvi_power_on(dssdev); 194 r = tfp410_power_on(dssdev);
177 if (r == 0) 195 if (r == 0)
178 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; 196 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
179 197
@@ -182,7 +200,7 @@ static int panel_dvi_resume(struct omap_dss_device *dssdev)
182 return r; 200 return r;
183} 201}
184 202
185static void panel_dvi_set_timings(struct omap_dss_device *dssdev, 203static void tfp410_set_timings(struct omap_dss_device *dssdev,
186 struct omap_video_timings *timings) 204 struct omap_video_timings *timings)
187{ 205{
188 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 206 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
@@ -192,7 +210,7 @@ static void panel_dvi_set_timings(struct omap_dss_device *dssdev,
192 mutex_unlock(&ddata->lock); 210 mutex_unlock(&ddata->lock);
193} 211}
194 212
195static void panel_dvi_get_timings(struct omap_dss_device *dssdev, 213static void tfp410_get_timings(struct omap_dss_device *dssdev,
196 struct omap_video_timings *timings) 214 struct omap_video_timings *timings)
197{ 215{
198 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 216 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
@@ -202,7 +220,7 @@ static void panel_dvi_get_timings(struct omap_dss_device *dssdev,
202 mutex_unlock(&ddata->lock); 220 mutex_unlock(&ddata->lock);
203} 221}
204 222
205static int panel_dvi_check_timings(struct omap_dss_device *dssdev, 223static int tfp410_check_timings(struct omap_dss_device *dssdev,
206 struct omap_video_timings *timings) 224 struct omap_video_timings *timings)
207{ 225{
208 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 226 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
@@ -216,7 +234,7 @@ static int panel_dvi_check_timings(struct omap_dss_device *dssdev,
216} 234}
217 235
218 236
219static int panel_dvi_ddc_read(struct i2c_adapter *adapter, 237static int tfp410_ddc_read(struct i2c_adapter *adapter,
220 unsigned char *buf, u16 count, u8 offset) 238 unsigned char *buf, u16 count, u8 offset)
221{ 239{
222 int r, retries; 240 int r, retries;
@@ -247,11 +265,11 @@ static int panel_dvi_ddc_read(struct i2c_adapter *adapter,
247 return r < 0 ? r : -EIO; 265 return r < 0 ? r : -EIO;
248} 266}
249 267
250static int panel_dvi_read_edid(struct omap_dss_device *dssdev, 268static int tfp410_read_edid(struct omap_dss_device *dssdev,
251 u8 *edid, int len) 269 u8 *edid, int len)
252{ 270{
253 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 271 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
254 struct panel_dvi_platform_data *pdata = get_pdata(dssdev); 272 struct tfp410_platform_data *pdata = get_pdata(dssdev);
255 struct i2c_adapter *adapter; 273 struct i2c_adapter *adapter;
256 int r, l, bytes_read; 274 int r, l, bytes_read;
257 275
@@ -271,7 +289,7 @@ static int panel_dvi_read_edid(struct omap_dss_device *dssdev,
271 } 289 }
272 290
273 l = min(EDID_LENGTH, len); 291 l = min(EDID_LENGTH, len);
274 r = panel_dvi_ddc_read(adapter, edid, l, 0); 292 r = tfp410_ddc_read(adapter, edid, l, 0);
275 if (r) 293 if (r)
276 goto err; 294 goto err;
277 295
@@ -281,7 +299,7 @@ static int panel_dvi_read_edid(struct omap_dss_device *dssdev,
281 if (len > EDID_LENGTH && edid[0x7e] > 0) { 299 if (len > EDID_LENGTH && edid[0x7e] > 0) {
282 l = min(EDID_LENGTH, len - EDID_LENGTH); 300 l = min(EDID_LENGTH, len - EDID_LENGTH);
283 301
284 r = panel_dvi_ddc_read(adapter, edid + EDID_LENGTH, 302 r = tfp410_ddc_read(adapter, edid + EDID_LENGTH,
285 l, EDID_LENGTH); 303 l, EDID_LENGTH);
286 if (r) 304 if (r)
287 goto err; 305 goto err;
@@ -298,10 +316,10 @@ err:
298 return r; 316 return r;
299} 317}
300 318
301static bool panel_dvi_detect(struct omap_dss_device *dssdev) 319static bool tfp410_detect(struct omap_dss_device *dssdev)
302{ 320{
303 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); 321 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
304 struct panel_dvi_platform_data *pdata = get_pdata(dssdev); 322 struct tfp410_platform_data *pdata = get_pdata(dssdev);
305 struct i2c_adapter *adapter; 323 struct i2c_adapter *adapter;
306 unsigned char out; 324 unsigned char out;
307 int r; 325 int r;
@@ -315,7 +333,7 @@ static bool panel_dvi_detect(struct omap_dss_device *dssdev)
315 if (!adapter) 333 if (!adapter)
316 goto out; 334 goto out;
317 335
318 r = panel_dvi_ddc_read(adapter, &out, 1, 0); 336 r = tfp410_ddc_read(adapter, &out, 1, 0);
319 337
320 mutex_unlock(&ddata->lock); 338 mutex_unlock(&ddata->lock);
321 339
@@ -326,38 +344,38 @@ out:
326 return true; 344 return true;
327} 345}
328 346
329static struct omap_dss_driver panel_dvi_driver = { 347static struct omap_dss_driver tfp410_driver = {
330 .probe = panel_dvi_probe, 348 .probe = tfp410_probe,
331 .remove = __exit_p(panel_dvi_remove), 349 .remove = __exit_p(tfp410_remove),
332 350
333 .enable = panel_dvi_enable, 351 .enable = tfp410_enable,
334 .disable = panel_dvi_disable, 352 .disable = tfp410_disable,
335 .suspend = panel_dvi_suspend, 353 .suspend = tfp410_suspend,
336 .resume = panel_dvi_resume, 354 .resume = tfp410_resume,
337 355
338 .set_timings = panel_dvi_set_timings, 356 .set_timings = tfp410_set_timings,
339 .get_timings = panel_dvi_get_timings, 357 .get_timings = tfp410_get_timings,
340 .check_timings = panel_dvi_check_timings, 358 .check_timings = tfp410_check_timings,
341 359
342 .read_edid = panel_dvi_read_edid, 360 .read_edid = tfp410_read_edid,
343 .detect = panel_dvi_detect, 361 .detect = tfp410_detect,
344 362
345 .driver = { 363 .driver = {
346 .name = "dvi", 364 .name = "tfp410",
347 .owner = THIS_MODULE, 365 .owner = THIS_MODULE,
348 }, 366 },
349}; 367};
350 368
351static int __init panel_dvi_init(void) 369static int __init tfp410_init(void)
352{ 370{
353 return omap_dss_register_driver(&panel_dvi_driver); 371 return omap_dss_register_driver(&tfp410_driver);
354} 372}
355 373
356static void __exit panel_dvi_exit(void) 374static void __exit tfp410_exit(void)
357{ 375{
358 omap_dss_unregister_driver(&panel_dvi_driver); 376 omap_dss_unregister_driver(&tfp410_driver);
359} 377}
360 378
361module_init(panel_dvi_init); 379module_init(tfp410_init);
362module_exit(panel_dvi_exit); 380module_exit(tfp410_exit);
363MODULE_LICENSE("GPL"); 381MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 95bc9964ab9..446e1366747 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -2045,65 +2045,6 @@ static unsigned dsi_get_line_buf_size(struct platform_device *dsidev)
2045 } 2045 }
2046} 2046}
2047 2047
2048static int dsi_parse_lane_config(struct omap_dss_device *dssdev)
2049{
2050 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
2051 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
2052 u8 lanes[DSI_MAX_NR_LANES];
2053 u8 polarities[DSI_MAX_NR_LANES];
2054 int num_lanes, i;
2055
2056 static const enum dsi_lane_function functions[] = {
2057 DSI_LANE_CLK,
2058 DSI_LANE_DATA1,
2059 DSI_LANE_DATA2,
2060 DSI_LANE_DATA3,
2061 DSI_LANE_DATA4,
2062 };
2063
2064 lanes[0] = dssdev->phy.dsi.clk_lane;
2065 lanes[1] = dssdev->phy.dsi.data1_lane;
2066 lanes[2] = dssdev->phy.dsi.data2_lane;
2067 lanes[3] = dssdev->phy.dsi.data3_lane;
2068 lanes[4] = dssdev->phy.dsi.data4_lane;
2069 polarities[0] = dssdev->phy.dsi.clk_pol;
2070 polarities[1] = dssdev->phy.dsi.data1_pol;
2071 polarities[2] = dssdev->phy.dsi.data2_pol;
2072 polarities[3] = dssdev->phy.dsi.data3_pol;
2073 polarities[4] = dssdev->phy.dsi.data4_pol;
2074
2075 num_lanes = 0;
2076
2077 for (i = 0; i < dsi->num_lanes_supported; ++i)
2078 dsi->lanes[i].function = DSI_LANE_UNUSED;
2079
2080 for (i = 0; i < dsi->num_lanes_supported; ++i) {
2081 int num;
2082
2083 if (lanes[i] == DSI_LANE_UNUSED)
2084 break;
2085
2086 num = lanes[i] - 1;
2087
2088 if (num >= dsi->num_lanes_supported)
2089 return -EINVAL;
2090
2091 if (dsi->lanes[num].function != DSI_LANE_UNUSED)
2092 return -EINVAL;
2093
2094 dsi->lanes[num].function = functions[i];
2095 dsi->lanes[num].polarity = polarities[i];
2096 num_lanes++;
2097 }
2098
2099 if (num_lanes < 2 || num_lanes > dsi->num_lanes_supported)
2100 return -EINVAL;
2101
2102 dsi->num_lanes_used = num_lanes;
2103
2104 return 0;
2105}
2106
2107static int dsi_set_lane_config(struct omap_dss_device *dssdev) 2048static int dsi_set_lane_config(struct omap_dss_device *dssdev)
2108{ 2049{
2109 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 2050 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -3944,6 +3885,74 @@ static void dsi_proto_timings(struct omap_dss_device *dssdev)
3944 } 3885 }
3945} 3886}
3946 3887
3888int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
3889 const struct omap_dsi_pin_config *pin_cfg)
3890{
3891 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
3892 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
3893 int num_pins;
3894 const int *pins;
3895 struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
3896 int num_lanes;
3897 int i;
3898
3899 static const enum dsi_lane_function functions[] = {
3900 DSI_LANE_CLK,
3901 DSI_LANE_DATA1,
3902 DSI_LANE_DATA2,
3903 DSI_LANE_DATA3,
3904 DSI_LANE_DATA4,
3905 };
3906
3907 num_pins = pin_cfg->num_pins;
3908 pins = pin_cfg->pins;
3909
3910 if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
3911 || num_pins % 2 != 0)
3912 return -EINVAL;
3913
3914 for (i = 0; i < DSI_MAX_NR_LANES; ++i)
3915 lanes[i].function = DSI_LANE_UNUSED;
3916
3917 num_lanes = 0;
3918
3919 for (i = 0; i < num_pins; i += 2) {
3920 u8 lane, pol;
3921 int dx, dy;
3922
3923 dx = pins[i];
3924 dy = pins[i + 1];
3925
3926 if (dx < 0 || dx >= dsi->num_lanes_supported * 2)
3927 return -EINVAL;
3928
3929 if (dy < 0 || dy >= dsi->num_lanes_supported * 2)
3930 return -EINVAL;
3931
3932 if (dx & 1) {
3933 if (dy != dx - 1)
3934 return -EINVAL;
3935 pol = 1;
3936 } else {
3937 if (dy != dx + 1)
3938 return -EINVAL;
3939 pol = 0;
3940 }
3941
3942 lane = dx / 2;
3943
3944 lanes[lane].function = functions[i / 2];
3945 lanes[lane].polarity = pol;
3946 num_lanes++;
3947 }
3948
3949 memcpy(dsi->lanes, lanes, sizeof(dsi->lanes));
3950 dsi->num_lanes_used = num_lanes;
3951
3952 return 0;
3953}
3954EXPORT_SYMBOL(omapdss_dsi_configure_pins);
3955
3947int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) 3956int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
3948{ 3957{
3949 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 3958 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -4301,12 +4310,6 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev)
4301 int dsi_module = dsi_get_dsidev_id(dsidev); 4310 int dsi_module = dsi_get_dsidev_id(dsidev);
4302 int r; 4311 int r;
4303 4312
4304 r = dsi_parse_lane_config(dssdev);
4305 if (r) {
4306 DSSERR("illegal lane config");
4307 goto err0;
4308 }
4309
4310 r = dsi_pll_init(dsidev, true, true); 4313 r = dsi_pll_init(dsidev, true, true);
4311 if (r) 4314 if (r)
4312 goto err0; 4315 goto err0;