aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2012-11-05 04:11:50 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-11-05 04:11:50 -0500
commit9296dbd79efb3a754f06d71510cc47af7eff0bee (patch)
tree79e1f93bb4e95bf3075acf4a12f780b788ffb0ef /drivers/video
parentf8fb7d7b7bbaa9336aa44675f56fd2f329516200 (diff)
parentffc81fc5f3f6070820cb7ef885daa37545291e97 (diff)
Merge branch '3.8/misc-2'
Merge omapdss miscellaneous patches.
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/displays/panel-acx565akm.c23
-rw-r--r--drivers/video/omap2/displays/panel-generic-dpi.c36
-rw-r--r--drivers/video/omap2/displays/panel-lgphilips-lb035q02.c34
-rw-r--r--drivers/video/omap2/displays/panel-n8x0.c50
-rw-r--r--drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c24
-rw-r--r--drivers/video/omap2/displays/panel-picodlp.c44
-rw-r--r--drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c17
-rw-r--r--drivers/video/omap2/displays/panel-taal.c72
-rw-r--r--drivers/video/omap2/displays/panel-tfp410.c33
-rw-r--r--drivers/video/omap2/displays/panel-tpo-td043mtea1.c20
-rw-r--r--drivers/video/omap2/dss/apply.c6
-rw-r--r--drivers/video/omap2/dss/core.c12
-rw-r--r--drivers/video/omap2/dss/dispc.c143
-rw-r--r--drivers/video/omap2/dss/display.c93
-rw-r--r--drivers/video/omap2/dss/dpi.c2
-rw-r--r--drivers/video/omap2/dss/dsi.c2
-rw-r--r--drivers/video/omap2/dss/dss.c5
-rw-r--r--drivers/video/omap2/dss/dss.h14
-rw-r--r--drivers/video/omap2/dss/hdmi.c124
-rw-r--r--drivers/video/omap2/dss/hdmi_panel.c78
-rw-r--r--drivers/video/omap2/dss/rfbi.c2
-rw-r--r--drivers/video/omap2/dss/sdi.c2
-rw-r--r--drivers/video/omap2/dss/venc.c2
-rw-r--r--drivers/video/omap2/dss/venc_panel.c19
-rw-r--r--drivers/video/omap2/omapfb/omapfb-main.c101
25 files changed, 302 insertions, 656 deletions
diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
index c835aa70f96..65eb76c840a 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -710,27 +710,6 @@ static void acx_panel_disable(struct omap_dss_device *dssdev)
710 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; 710 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
711} 711}
712 712
713static int acx_panel_suspend(struct omap_dss_device *dssdev)
714{
715 dev_dbg(&dssdev->dev, "%s\n", __func__);
716 acx_panel_power_off(dssdev);
717 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
718 return 0;
719}
720
721static int acx_panel_resume(struct omap_dss_device *dssdev)
722{
723 int r;
724
725 dev_dbg(&dssdev->dev, "%s\n", __func__);
726 r = acx_panel_power_on(dssdev);
727 if (r)
728 return r;
729
730 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
731 return 0;
732}
733
734static void acx_panel_set_timings(struct omap_dss_device *dssdev, 713static void acx_panel_set_timings(struct omap_dss_device *dssdev,
735 struct omap_video_timings *timings) 714 struct omap_video_timings *timings)
736{ 715{
@@ -752,8 +731,6 @@ static struct omap_dss_driver acx_panel_driver = {
752 731
753 .enable = acx_panel_enable, 732 .enable = acx_panel_enable,
754 .disable = acx_panel_disable, 733 .disable = acx_panel_disable,
755 .suspend = acx_panel_suspend,
756 .resume = acx_panel_resume,
757 734
758 .set_timings = acx_panel_set_timings, 735 .set_timings = acx_panel_set_timings,
759 .check_timings = acx_panel_check_timings, 736 .check_timings = acx_panel_check_timings,
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
index 88295c52681..54ca8ae2107 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -688,40 +688,6 @@ static void generic_dpi_panel_disable(struct omap_dss_device *dssdev)
688 mutex_unlock(&drv_data->lock); 688 mutex_unlock(&drv_data->lock);
689} 689}
690 690
691static int generic_dpi_panel_suspend(struct omap_dss_device *dssdev)
692{
693 struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
694
695 mutex_lock(&drv_data->lock);
696
697 generic_dpi_panel_power_off(dssdev);
698
699 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
700
701 mutex_unlock(&drv_data->lock);
702
703 return 0;
704}
705
706static int generic_dpi_panel_resume(struct omap_dss_device *dssdev)
707{
708 struct panel_drv_data *drv_data = dev_get_drvdata(&dssdev->dev);
709 int r;
710
711 mutex_lock(&drv_data->lock);
712
713 r = generic_dpi_panel_power_on(dssdev);
714 if (r)
715 goto err;
716
717 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
718
719err:
720 mutex_unlock(&drv_data->lock);
721
722 return r;
723}
724
725static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev, 691static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev,
726 struct omap_video_timings *timings) 692 struct omap_video_timings *timings)
727{ 693{
@@ -769,8 +735,6 @@ static struct omap_dss_driver dpi_driver = {
769 735
770 .enable = generic_dpi_panel_enable, 736 .enable = generic_dpi_panel_enable,
771 .disable = generic_dpi_panel_disable, 737 .disable = generic_dpi_panel_disable,
772 .suspend = generic_dpi_panel_suspend,
773 .resume = generic_dpi_panel_resume,
774 738
775 .set_timings = generic_dpi_panel_set_timings, 739 .set_timings = generic_dpi_panel_set_timings,
776 .get_timings = generic_dpi_panel_get_timings, 740 .get_timings = generic_dpi_panel_get_timings,
diff --git a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
index 90c1cabf244..ace419b801e 100644
--- a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
@@ -143,46 +143,12 @@ static void lb035q02_panel_disable(struct omap_dss_device *dssdev)
143 mutex_unlock(&ld->lock); 143 mutex_unlock(&ld->lock);
144} 144}
145 145
146static int lb035q02_panel_suspend(struct omap_dss_device *dssdev)
147{
148 struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev);
149
150 mutex_lock(&ld->lock);
151
152 lb035q02_panel_power_off(dssdev);
153 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
154
155 mutex_unlock(&ld->lock);
156 return 0;
157}
158
159static int lb035q02_panel_resume(struct omap_dss_device *dssdev)
160{
161 struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev);
162 int r;
163
164 mutex_lock(&ld->lock);
165
166 r = lb035q02_panel_power_on(dssdev);
167 if (r)
168 goto err;
169 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
170
171 mutex_unlock(&ld->lock);
172 return 0;
173err:
174 mutex_unlock(&ld->lock);
175 return r;
176}
177
178static struct omap_dss_driver lb035q02_driver = { 146static struct omap_dss_driver lb035q02_driver = {
179 .probe = lb035q02_panel_probe, 147 .probe = lb035q02_panel_probe,
180 .remove = lb035q02_panel_remove, 148 .remove = lb035q02_panel_remove,
181 149
182 .enable = lb035q02_panel_enable, 150 .enable = lb035q02_panel_enable,
183 .disable = lb035q02_panel_disable, 151 .disable = lb035q02_panel_disable,
184 .suspend = lb035q02_panel_suspend,
185 .resume = lb035q02_panel_resume,
186 152
187 .driver = { 153 .driver = {
188 .name = "lgphilips_lb035q02_panel", 154 .name = "lgphilips_lb035q02_panel",
diff --git a/drivers/video/omap2/displays/panel-n8x0.c b/drivers/video/omap2/displays/panel-n8x0.c
index 3fc5ad081a2..26532695555 100644
--- a/drivers/video/omap2/displays/panel-n8x0.c
+++ b/drivers/video/omap2/displays/panel-n8x0.c
@@ -574,54 +574,6 @@ static void n8x0_panel_disable(struct omap_dss_device *dssdev)
574 mutex_unlock(&ddata->lock); 574 mutex_unlock(&ddata->lock);
575} 575}
576 576
577static int n8x0_panel_suspend(struct omap_dss_device *dssdev)
578{
579 struct panel_drv_data *ddata = get_drv_data(dssdev);
580
581 dev_dbg(&dssdev->dev, "suspend\n");
582
583 mutex_lock(&ddata->lock);
584
585 rfbi_bus_lock();
586
587 n8x0_panel_power_off(dssdev);
588
589 rfbi_bus_unlock();
590
591 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
592
593 mutex_unlock(&ddata->lock);
594
595 return 0;
596}
597
598static int n8x0_panel_resume(struct omap_dss_device *dssdev)
599{
600 struct panel_drv_data *ddata = get_drv_data(dssdev);
601 int r;
602
603 dev_dbg(&dssdev->dev, "resume\n");
604
605 mutex_lock(&ddata->lock);
606
607 rfbi_bus_lock();
608
609 r = n8x0_panel_power_on(dssdev);
610
611 rfbi_bus_unlock();
612
613 if (r) {
614 mutex_unlock(&ddata->lock);
615 return r;
616 }
617
618 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
619
620 mutex_unlock(&ddata->lock);
621
622 return 0;
623}
624
625static void n8x0_panel_get_resolution(struct omap_dss_device *dssdev, 577static void n8x0_panel_get_resolution(struct omap_dss_device *dssdev,
626 u16 *xres, u16 *yres) 578 u16 *xres, u16 *yres)
627{ 579{
@@ -683,8 +635,6 @@ static struct omap_dss_driver n8x0_panel_driver = {
683 635
684 .enable = n8x0_panel_enable, 636 .enable = n8x0_panel_enable,
685 .disable = n8x0_panel_disable, 637 .disable = n8x0_panel_disable,
686 .suspend = n8x0_panel_suspend,
687 .resume = n8x0_panel_resume,
688 638
689 .update = n8x0_panel_update, 639 .update = n8x0_panel_update,
690 .sync = n8x0_panel_sync, 640 .sync = n8x0_panel_sync,
diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
index 908fd268f3d..2a79c283beb 100644
--- a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
+++ b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
@@ -236,28 +236,6 @@ static void nec_8048_panel_disable(struct omap_dss_device *dssdev)
236 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; 236 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
237} 237}
238 238
239static int nec_8048_panel_suspend(struct omap_dss_device *dssdev)
240{
241 nec_8048_panel_power_off(dssdev);
242
243 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
244
245 return 0;
246}
247
248static int nec_8048_panel_resume(struct omap_dss_device *dssdev)
249{
250 int r;
251
252 r = nec_8048_panel_power_on(dssdev);
253 if (r)
254 return r;
255
256 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
257
258 return 0;
259}
260
261static int nec_8048_recommended_bpp(struct omap_dss_device *dssdev) 239static int nec_8048_recommended_bpp(struct omap_dss_device *dssdev)
262{ 240{
263 return 16; 241 return 16;
@@ -268,8 +246,6 @@ static struct omap_dss_driver nec_8048_driver = {
268 .remove = nec_8048_panel_remove, 246 .remove = nec_8048_panel_remove,
269 .enable = nec_8048_panel_enable, 247 .enable = nec_8048_panel_enable,
270 .disable = nec_8048_panel_disable, 248 .disable = nec_8048_panel_disable,
271 .suspend = nec_8048_panel_suspend,
272 .resume = nec_8048_panel_resume,
273 .get_recommended_bpp = nec_8048_recommended_bpp, 249 .get_recommended_bpp = nec_8048_recommended_bpp,
274 250
275 .driver = { 251 .driver = {
diff --git a/drivers/video/omap2/displays/panel-picodlp.c b/drivers/video/omap2/displays/panel-picodlp.c
index 9df87640ddd..e3a6c199613 100644
--- a/drivers/video/omap2/displays/panel-picodlp.c
+++ b/drivers/video/omap2/displays/panel-picodlp.c
@@ -503,47 +503,6 @@ static void picodlp_panel_disable(struct omap_dss_device *dssdev)
503 dev_dbg(&dssdev->dev, "disabling picodlp panel\n"); 503 dev_dbg(&dssdev->dev, "disabling picodlp panel\n");
504} 504}
505 505
506static int picodlp_panel_suspend(struct omap_dss_device *dssdev)
507{
508 struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
509
510 mutex_lock(&picod->lock);
511 /* Turn off DLP Power */
512 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
513 mutex_unlock(&picod->lock);
514 dev_err(&dssdev->dev, "unable to suspend picodlp panel,"
515 " panel is not ACTIVE\n");
516 return -EINVAL;
517 }
518
519 picodlp_panel_power_off(dssdev);
520
521 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
522 mutex_unlock(&picod->lock);
523
524 dev_dbg(&dssdev->dev, "suspending picodlp panel\n");
525 return 0;
526}
527
528static int picodlp_panel_resume(struct omap_dss_device *dssdev)
529{
530 struct picodlp_data *picod = dev_get_drvdata(&dssdev->dev);
531 int r;
532
533 mutex_lock(&picod->lock);
534 if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) {
535 mutex_unlock(&picod->lock);
536 dev_err(&dssdev->dev, "unable to resume picodlp panel,"
537 " panel is not ACTIVE\n");
538 return -EINVAL;
539 }
540
541 r = picodlp_panel_power_on(dssdev);
542 mutex_unlock(&picod->lock);
543 dev_dbg(&dssdev->dev, "resuming picodlp panel\n");
544 return r;
545}
546
547static void picodlp_get_resolution(struct omap_dss_device *dssdev, 506static void picodlp_get_resolution(struct omap_dss_device *dssdev,
548 u16 *xres, u16 *yres) 507 u16 *xres, u16 *yres)
549{ 508{
@@ -560,9 +519,6 @@ static struct omap_dss_driver picodlp_driver = {
560 519
561 .get_resolution = picodlp_get_resolution, 520 .get_resolution = picodlp_get_resolution,
562 521
563 .suspend = picodlp_panel_suspend,
564 .resume = picodlp_panel_resume,
565
566 .driver = { 522 .driver = {
567 .name = "picodlp_panel", 523 .name = "picodlp_panel",
568 .owner = THIS_MODULE, 524 .owner = THIS_MODULE,
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
index 1ec3b277ff1..cada8c621e0 100644
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
@@ -194,29 +194,12 @@ static void sharp_ls_panel_disable(struct omap_dss_device *dssdev)
194 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; 194 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
195} 195}
196 196
197static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev)
198{
199 sharp_ls_power_off(dssdev);
200 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
201 return 0;
202}
203
204static int sharp_ls_panel_resume(struct omap_dss_device *dssdev)
205{
206 int r;
207 r = sharp_ls_power_on(dssdev);
208 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
209 return r;
210}
211
212static struct omap_dss_driver sharp_ls_driver = { 197static struct omap_dss_driver sharp_ls_driver = {
213 .probe = sharp_ls_panel_probe, 198 .probe = sharp_ls_panel_probe,
214 .remove = __exit_p(sharp_ls_panel_remove), 199 .remove = __exit_p(sharp_ls_panel_remove),
215 200
216 .enable = sharp_ls_panel_enable, 201 .enable = sharp_ls_panel_enable,
217 .disable = sharp_ls_panel_disable, 202 .disable = sharp_ls_panel_disable,
218 .suspend = sharp_ls_panel_suspend,
219 .resume = sharp_ls_panel_resume,
220 203
221 .driver = { 204 .driver = {
222 .name = "sharp_ls_panel", 205 .name = "sharp_ls_panel",
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index f2f644680ca..a32407a5735 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -1245,76 +1245,6 @@ static void taal_disable(struct omap_dss_device *dssdev)
1245 mutex_unlock(&td->lock); 1245 mutex_unlock(&td->lock);
1246} 1246}
1247 1247
1248static int taal_suspend(struct omap_dss_device *dssdev)
1249{
1250 struct taal_data *td = dev_get_drvdata(&dssdev->dev);
1251 int r;
1252
1253 dev_dbg(&dssdev->dev, "suspend\n");
1254
1255 mutex_lock(&td->lock);
1256
1257 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
1258 r = -EINVAL;
1259 goto err;
1260 }
1261
1262 taal_cancel_ulps_work(dssdev);
1263 taal_cancel_esd_work(dssdev);
1264
1265 dsi_bus_lock(dssdev);
1266
1267 r = taal_wake_up(dssdev);
1268 if (!r)
1269 taal_power_off(dssdev);
1270
1271 dsi_bus_unlock(dssdev);
1272
1273 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
1274
1275 mutex_unlock(&td->lock);
1276
1277 return 0;
1278err:
1279 mutex_unlock(&td->lock);
1280 return r;
1281}
1282
1283static int taal_resume(struct omap_dss_device *dssdev)
1284{
1285 struct taal_data *td = dev_get_drvdata(&dssdev->dev);
1286 int r;
1287
1288 dev_dbg(&dssdev->dev, "resume\n");
1289
1290 mutex_lock(&td->lock);
1291
1292 if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) {
1293 r = -EINVAL;
1294 goto err;
1295 }
1296
1297 dsi_bus_lock(dssdev);
1298
1299 r = taal_power_on(dssdev);
1300
1301 dsi_bus_unlock(dssdev);
1302
1303 if (r) {
1304 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
1305 } else {
1306 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
1307 taal_queue_esd_work(dssdev);
1308 }
1309
1310 mutex_unlock(&td->lock);
1311
1312 return r;
1313err:
1314 mutex_unlock(&td->lock);
1315 return r;
1316}
1317
1318static void taal_framedone_cb(int err, void *data) 1248static void taal_framedone_cb(int err, void *data)
1319{ 1249{
1320 struct omap_dss_device *dssdev = data; 1250 struct omap_dss_device *dssdev = data;
@@ -1818,8 +1748,6 @@ static struct omap_dss_driver taal_driver = {
1818 1748
1819 .enable = taal_enable, 1749 .enable = taal_enable,
1820 .disable = taal_disable, 1750 .disable = taal_disable,
1821 .suspend = taal_suspend,
1822 .resume = taal_resume,
1823 1751
1824 .update = taal_update, 1752 .update = taal_update,
1825 .sync = taal_sync, 1753 .sync = taal_sync,
diff --git a/drivers/video/omap2/displays/panel-tfp410.c b/drivers/video/omap2/displays/panel-tfp410.c
index 383811cf864..8281baafe1e 100644
--- a/drivers/video/omap2/displays/panel-tfp410.c
+++ b/drivers/video/omap2/displays/panel-tfp410.c
@@ -189,37 +189,6 @@ static void tfp410_disable(struct omap_dss_device *dssdev)
189 mutex_unlock(&ddata->lock); 189 mutex_unlock(&ddata->lock);
190} 190}
191 191
192static int tfp410_suspend(struct omap_dss_device *dssdev)
193{
194 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
195
196 mutex_lock(&ddata->lock);
197
198 tfp410_power_off(dssdev);
199
200 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
201
202 mutex_unlock(&ddata->lock);
203
204 return 0;
205}
206
207static int tfp410_resume(struct omap_dss_device *dssdev)
208{
209 struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev);
210 int r;
211
212 mutex_lock(&ddata->lock);
213
214 r = tfp410_power_on(dssdev);
215 if (r == 0)
216 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
217
218 mutex_unlock(&ddata->lock);
219
220 return r;
221}
222
223static void tfp410_set_timings(struct omap_dss_device *dssdev, 192static void tfp410_set_timings(struct omap_dss_device *dssdev,
224 struct omap_video_timings *timings) 193 struct omap_video_timings *timings)
225{ 194{
@@ -355,8 +324,6 @@ static struct omap_dss_driver tfp410_driver = {
355 324
356 .enable = tfp410_enable, 325 .enable = tfp410_enable,
357 .disable = tfp410_disable, 326 .disable = tfp410_disable,
358 .suspend = tfp410_suspend,
359 .resume = tfp410_resume,
360 327
361 .set_timings = tfp410_set_timings, 328 .set_timings = tfp410_set_timings,
362 .get_timings = tfp410_get_timings, 329 .get_timings = tfp410_get_timings,
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
index b5e6dbc59f0..316b3da6d2c 100644
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
+++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
@@ -401,24 +401,6 @@ static void tpo_td043_disable(struct omap_dss_device *dssdev)
401 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; 401 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
402} 402}
403 403
404static int tpo_td043_suspend(struct omap_dss_device *dssdev)
405{
406 dev_dbg(&dssdev->dev, "suspend\n");
407
408 tpo_td043_disable_dss(dssdev);
409
410 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
411
412 return 0;
413}
414
415static int tpo_td043_resume(struct omap_dss_device *dssdev)
416{
417 dev_dbg(&dssdev->dev, "resume\n");
418
419 return tpo_td043_enable_dss(dssdev);
420}
421
422static int tpo_td043_probe(struct omap_dss_device *dssdev) 404static int tpo_td043_probe(struct omap_dss_device *dssdev)
423{ 405{
424 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); 406 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev);
@@ -500,8 +482,6 @@ static struct omap_dss_driver tpo_td043_driver = {
500 482
501 .enable = tpo_td043_enable, 483 .enable = tpo_td043_enable,
502 .disable = tpo_td043_disable, 484 .disable = tpo_td043_disable,
503 .suspend = tpo_td043_suspend,
504 .resume = tpo_td043_resume,
505 .set_mirror = tpo_td043_set_hmirror, 485 .set_mirror = tpo_td043_set_hmirror,
506 .get_mirror = tpo_td043_get_hmirror, 486 .get_mirror = tpo_td043_get_hmirror,
507 487
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 7a61a2f7765..6a214439762 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -772,7 +772,7 @@ void dss_mgr_start_update(struct omap_overlay_manager *mgr)
772 if (!dss_data.irq_enabled && need_isr()) 772 if (!dss_data.irq_enabled && need_isr())
773 dss_register_vsync_isr(); 773 dss_register_vsync_isr();
774 774
775 dispc_mgr_enable(mgr->id); 775 dispc_mgr_enable_sync(mgr->id);
776 776
777 mgr_clear_shadow_dirty(mgr); 777 mgr_clear_shadow_dirty(mgr);
778 778
@@ -1027,7 +1027,7 @@ int dss_mgr_enable(struct omap_overlay_manager *mgr)
1027 spin_unlock_irqrestore(&data_lock, flags); 1027 spin_unlock_irqrestore(&data_lock, flags);
1028 1028
1029 if (!mgr_manual_update(mgr)) 1029 if (!mgr_manual_update(mgr))
1030 dispc_mgr_enable(mgr->id); 1030 dispc_mgr_enable_sync(mgr->id);
1031 1031
1032out: 1032out:
1033 mutex_unlock(&apply_lock); 1033 mutex_unlock(&apply_lock);
@@ -1052,7 +1052,7 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
1052 goto out; 1052 goto out;
1053 1053
1054 if (!mgr_manual_update(mgr)) 1054 if (!mgr_manual_update(mgr))
1055 dispc_mgr_disable(mgr->id); 1055 dispc_mgr_disable_sync(mgr->id);
1056 1056
1057 spin_lock_irqsave(&data_lock, flags); 1057 spin_lock_irqsave(&data_lock, flags);
1058 1058
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 00aa026e307..a2ea684169e 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -53,10 +53,18 @@ static char *def_disp_name;
53module_param_named(def_disp, def_disp_name, charp, 0); 53module_param_named(def_disp, def_disp_name, charp, 0);
54MODULE_PARM_DESC(def_disp, "default display name"); 54MODULE_PARM_DESC(def_disp, "default display name");
55 55
56const char *dss_get_default_display_name(void) 56const char *omapdss_get_default_display_name(void)
57{ 57{
58 return core.default_display_name; 58 return core.default_display_name;
59} 59}
60EXPORT_SYMBOL(omapdss_get_default_display_name);
61
62enum omapdss_version omapdss_get_version(void)
63{
64 struct omap_dss_board_info *pdata = core.pdev->dev.platform_data;
65 return pdata->version;
66}
67EXPORT_SYMBOL(omapdss_get_version);
60 68
61/* REGULATORS */ 69/* REGULATORS */
62 70
@@ -232,7 +240,7 @@ static int __init omap_dss_probe(struct platform_device *pdev)
232 240
233 core.pdev = pdev; 241 core.pdev = pdev;
234 242
235 dss_features_init(pdata->version); 243 dss_features_init(omapdss_get_version());
236 244
237 dss_apply_init(); 245 dss_apply_init();
238 246
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 6dd9eb4a2c5..05def42e528 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -497,7 +497,7 @@ static void dispc_restore_context(void)
497 if (dss_has_feature(FEAT_MGR_LCD3)) 497 if (dss_has_feature(FEAT_MGR_LCD3))
498 RR(CONTROL3); 498 RR(CONTROL3);
499 /* clear spurious SYNC_LOST_DIGIT interrupts */ 499 /* clear spurious SYNC_LOST_DIGIT interrupts */
500 dispc_write_reg(DISPC_IRQSTATUS, DISPC_IRQ_SYNC_LOST_DIGIT); 500 dispc_clear_irqstatus(DISPC_IRQ_SYNC_LOST_DIGIT);
501 501
502 /* 502 /*
503 * enable last so IRQs won't trigger before 503 * enable last so IRQs won't trigger before
@@ -1046,7 +1046,7 @@ static void dispc_configure_burst_sizes(void)
1046 const int burst_size = BURST_SIZE_X8; 1046 const int burst_size = BURST_SIZE_X8;
1047 1047
1048 /* Configure burst size always to maximum size */ 1048 /* Configure burst size always to maximum size */
1049 for (i = 0; i < omap_dss_get_num_overlays(); ++i) 1049 for (i = 0; i < dss_feat_get_num_ovls(); ++i)
1050 dispc_ovl_set_burst_size(i, burst_size); 1050 dispc_ovl_set_burst_size(i, burst_size);
1051} 1051}
1052 1052
@@ -1250,7 +1250,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane plane,
1250 1250
1251 if (use_fifomerge) { 1251 if (use_fifomerge) {
1252 total_fifo_size = 0; 1252 total_fifo_size = 0;
1253 for (i = 0; i < omap_dss_get_num_overlays(); ++i) 1253 for (i = 0; i < dss_feat_get_num_ovls(); ++i)
1254 total_fifo_size += dispc_ovl_get_fifo_size(i); 1254 total_fifo_size += dispc_ovl_get_fifo_size(i);
1255 } else { 1255 } else {
1256 total_fifo_size = ovl_fifo_size; 1256 total_fifo_size = ovl_fifo_size;
@@ -2589,13 +2589,18 @@ int dispc_ovl_enable(enum omap_plane plane, bool enable)
2589 return 0; 2589 return 0;
2590} 2590}
2591 2591
2592bool dispc_ovl_enabled(enum omap_plane plane)
2593{
2594 return REG_GET(DISPC_OVL_ATTRIBUTES(plane), 0, 0);
2595}
2596
2592static void dispc_mgr_disable_isr(void *data, u32 mask) 2597static void dispc_mgr_disable_isr(void *data, u32 mask)
2593{ 2598{
2594 struct completion *compl = data; 2599 struct completion *compl = data;
2595 complete(compl); 2600 complete(compl);
2596} 2601}
2597 2602
2598static void _enable_mgr_out(enum omap_channel channel, bool enable) 2603void dispc_mgr_enable(enum omap_channel channel, bool enable)
2599{ 2604{
2600 mgr_fld_write(channel, DISPC_MGR_FLD_ENABLE, enable); 2605 mgr_fld_write(channel, DISPC_MGR_FLD_ENABLE, enable);
2601 /* flush posted write */ 2606 /* flush posted write */
@@ -2609,7 +2614,7 @@ bool dispc_mgr_is_enabled(enum omap_channel channel)
2609 2614
2610static void dispc_mgr_enable_lcd_out(enum omap_channel channel) 2615static void dispc_mgr_enable_lcd_out(enum omap_channel channel)
2611{ 2616{
2612 _enable_mgr_out(channel, true); 2617 dispc_mgr_enable(channel, true);
2613} 2618}
2614 2619
2615static void dispc_mgr_disable_lcd_out(enum omap_channel channel) 2620static void dispc_mgr_disable_lcd_out(enum omap_channel channel)
@@ -2633,7 +2638,7 @@ static void dispc_mgr_disable_lcd_out(enum omap_channel channel)
2633 if (r) 2638 if (r)
2634 DSSERR("failed to register FRAMEDONE isr\n"); 2639 DSSERR("failed to register FRAMEDONE isr\n");
2635 2640
2636 _enable_mgr_out(channel, false); 2641 dispc_mgr_enable(channel, false);
2637 2642
2638 /* if we couldn't register for framedone, just sleep and exit */ 2643 /* if we couldn't register for framedone, just sleep and exit */
2639 if (r) { 2644 if (r) {
@@ -2685,7 +2690,7 @@ static void dispc_mgr_enable_digit_out(void)
2685 return; 2690 return;
2686 } 2691 }
2687 2692
2688 _enable_mgr_out(OMAP_DSS_CHANNEL_DIGIT, true); 2693 dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, true);
2689 2694
2690 /* wait for the first evsync */ 2695 /* wait for the first evsync */
2691 if (!wait_for_completion_timeout(&vsync_compl, msecs_to_jiffies(100))) 2696 if (!wait_for_completion_timeout(&vsync_compl, msecs_to_jiffies(100)))
@@ -2735,7 +2740,7 @@ static void dispc_mgr_disable_digit_out(void)
2735 if (r) 2740 if (r)
2736 DSSERR("failed to register %x isr\n", irq_mask); 2741 DSSERR("failed to register %x isr\n", irq_mask);
2737 2742
2738 _enable_mgr_out(OMAP_DSS_CHANNEL_DIGIT, false); 2743 dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, false);
2739 2744
2740 /* if we couldn't register the irq, just sleep and exit */ 2745 /* if we couldn't register the irq, just sleep and exit */
2741 if (r) { 2746 if (r) {
@@ -2755,7 +2760,7 @@ static void dispc_mgr_disable_digit_out(void)
2755 DSSERR("failed to unregister %x isr\n", irq_mask); 2760 DSSERR("failed to unregister %x isr\n", irq_mask);
2756} 2761}
2757 2762
2758void dispc_mgr_enable(enum omap_channel channel) 2763void dispc_mgr_enable_sync(enum omap_channel channel)
2759{ 2764{
2760 if (dss_mgr_is_lcd(channel)) 2765 if (dss_mgr_is_lcd(channel))
2761 dispc_mgr_enable_lcd_out(channel); 2766 dispc_mgr_enable_lcd_out(channel);
@@ -2765,7 +2770,7 @@ void dispc_mgr_enable(enum omap_channel channel)
2765 WARN_ON(1); 2770 WARN_ON(1);
2766} 2771}
2767 2772
2768void dispc_mgr_disable(enum omap_channel channel) 2773void dispc_mgr_disable_sync(enum omap_channel channel)
2769{ 2774{
2770 if (dss_mgr_is_lcd(channel)) 2775 if (dss_mgr_is_lcd(channel))
2771 dispc_mgr_disable_lcd_out(channel); 2776 dispc_mgr_disable_lcd_out(channel);
@@ -3167,28 +3172,32 @@ unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)
3167 unsigned long r; 3172 unsigned long r;
3168 u32 l; 3173 u32 l;
3169 3174
3170 l = dispc_read_reg(DISPC_DIVISORo(channel)); 3175 if (dss_mgr_is_lcd(channel)) {
3176 l = dispc_read_reg(DISPC_DIVISORo(channel));
3171 3177
3172 lcd = FLD_GET(l, 23, 16); 3178 lcd = FLD_GET(l, 23, 16);
3173 3179
3174 switch (dss_get_lcd_clk_source(channel)) { 3180 switch (dss_get_lcd_clk_source(channel)) {
3175 case OMAP_DSS_CLK_SRC_FCK: 3181 case OMAP_DSS_CLK_SRC_FCK:
3176 r = clk_get_rate(dispc.dss_clk); 3182 r = clk_get_rate(dispc.dss_clk);
3177 break; 3183 break;
3178 case OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC: 3184 case OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC:
3179 dsidev = dsi_get_dsidev_from_id(0); 3185 dsidev = dsi_get_dsidev_from_id(0);
3180 r = dsi_get_pll_hsdiv_dispc_rate(dsidev); 3186 r = dsi_get_pll_hsdiv_dispc_rate(dsidev);
3181 break; 3187 break;
3182 case OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC: 3188 case OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC:
3183 dsidev = dsi_get_dsidev_from_id(1); 3189 dsidev = dsi_get_dsidev_from_id(1);
3184 r = dsi_get_pll_hsdiv_dispc_rate(dsidev); 3190 r = dsi_get_pll_hsdiv_dispc_rate(dsidev);
3185 break; 3191 break;
3186 default: 3192 default:
3187 BUG(); 3193 BUG();
3188 return 0; 3194 return 0;
3189 } 3195 }
3190 3196
3191 return r / lcd; 3197 return r / lcd;
3198 } else {
3199 return dispc_fclk_rate();
3200 }
3192} 3201}
3193 3202
3194unsigned long dispc_mgr_pclk_rate(enum omap_channel channel) 3203unsigned long dispc_mgr_pclk_rate(enum omap_channel channel)
@@ -3247,12 +3256,9 @@ static unsigned long dispc_plane_lclk_rate(enum omap_plane plane)
3247{ 3256{
3248 enum omap_channel channel = dispc_ovl_get_channel_out(plane); 3257 enum omap_channel channel = dispc_ovl_get_channel_out(plane);
3249 3258
3250 if (dss_mgr_is_lcd(channel)) 3259 return dispc_mgr_lclk_rate(channel);
3251 return dispc_mgr_lclk_rate(channel);
3252 else
3253 return dispc_fclk_rate();
3254
3255} 3260}
3261
3256static void dispc_dump_clocks_channel(struct seq_file *s, enum omap_channel channel) 3262static void dispc_dump_clocks_channel(struct seq_file *s, enum omap_channel channel)
3257{ 3263{
3258 int lcd, pcd; 3264 int lcd, pcd;
@@ -3621,11 +3627,35 @@ int dispc_mgr_get_clock_div(enum omap_channel channel,
3621 return 0; 3627 return 0;
3622} 3628}
3623 3629
3630u32 dispc_read_irqstatus(void)
3631{
3632 return dispc_read_reg(DISPC_IRQSTATUS);
3633}
3634
3635void dispc_clear_irqstatus(u32 mask)
3636{
3637 dispc_write_reg(DISPC_IRQSTATUS, mask);
3638}
3639
3640u32 dispc_read_irqenable(void)
3641{
3642 return dispc_read_reg(DISPC_IRQENABLE);
3643}
3644
3645void dispc_write_irqenable(u32 mask)
3646{
3647 u32 old_mask = dispc_read_reg(DISPC_IRQENABLE);
3648
3649 /* clear the irqstatus for newly enabled irqs */
3650 dispc_clear_irqstatus((mask ^ old_mask) & mask);
3651
3652 dispc_write_reg(DISPC_IRQENABLE, mask);
3653}
3654
3624/* dispc.irq_lock has to be locked by the caller */ 3655/* dispc.irq_lock has to be locked by the caller */
3625static void _omap_dispc_set_irqs(void) 3656static void _omap_dispc_set_irqs(void)
3626{ 3657{
3627 u32 mask; 3658 u32 mask;
3628 u32 old_mask;
3629 int i; 3659 int i;
3630 struct omap_dispc_isr_data *isr_data; 3660 struct omap_dispc_isr_data *isr_data;
3631 3661
@@ -3640,11 +3670,7 @@ static void _omap_dispc_set_irqs(void)
3640 mask |= isr_data->mask; 3670 mask |= isr_data->mask;
3641 } 3671 }
3642 3672
3643 old_mask = dispc_read_reg(DISPC_IRQENABLE); 3673 dispc_write_irqenable(mask);
3644 /* clear the irqstatus for newly enabled irqs */
3645 dispc_write_reg(DISPC_IRQSTATUS, (mask ^ old_mask) & mask);
3646
3647 dispc_write_reg(DISPC_IRQENABLE, mask);
3648} 3674}
3649 3675
3650int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask) 3676int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask)
@@ -3771,8 +3797,8 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *arg)
3771 3797
3772 spin_lock(&dispc.irq_lock); 3798 spin_lock(&dispc.irq_lock);
3773 3799
3774 irqstatus = dispc_read_reg(DISPC_IRQSTATUS); 3800 irqstatus = dispc_read_irqstatus();
3775 irqenable = dispc_read_reg(DISPC_IRQENABLE); 3801 irqenable = dispc_read_irqenable();
3776 3802
3777 /* IRQ is not for us */ 3803 /* IRQ is not for us */
3778 if (!(irqstatus & irqenable)) { 3804 if (!(irqstatus & irqenable)) {
@@ -3791,9 +3817,9 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *arg)
3791 3817
3792 /* Ack the interrupt. Do it here before clocks are possibly turned 3818 /* Ack the interrupt. Do it here before clocks are possibly turned
3793 * off */ 3819 * off */
3794 dispc_write_reg(DISPC_IRQSTATUS, irqstatus); 3820 dispc_clear_irqstatus(irqstatus);
3795 /* flush posted write */ 3821 /* flush posted write */
3796 dispc_read_reg(DISPC_IRQSTATUS); 3822 dispc_read_irqstatus();
3797 3823
3798 /* make a copy and unlock, so that isrs can unregister 3824 /* make a copy and unlock, so that isrs can unregister
3799 * themselves */ 3825 * themselves */
@@ -3875,30 +3901,24 @@ static void dispc_error_worker(struct work_struct *work)
3875 bit = mgr_desc[i].sync_lost_irq; 3901 bit = mgr_desc[i].sync_lost_irq;
3876 3902
3877 if (bit & errors) { 3903 if (bit & errors) {
3878 struct omap_dss_device *dssdev = mgr->get_device(mgr); 3904 int j;
3879 bool enable;
3880 3905
3881 DSSERR("SYNC_LOST on channel %s, restarting the output " 3906 DSSERR("SYNC_LOST on channel %s, restarting the output "
3882 "with video overlays disabled\n", 3907 "with video overlays disabled\n",
3883 mgr->name); 3908 mgr->name);
3884 3909
3885 enable = dssdev->state == OMAP_DSS_DISPLAY_ACTIVE; 3910 dss_mgr_disable(mgr);
3886 dssdev->driver->disable(dssdev);
3887 3911
3888 for (i = 0; i < omap_dss_get_num_overlays(); ++i) { 3912 for (j = 0; j < omap_dss_get_num_overlays(); ++j) {
3889 struct omap_overlay *ovl; 3913 struct omap_overlay *ovl;
3890 ovl = omap_dss_get_overlay(i); 3914 ovl = omap_dss_get_overlay(j);
3891 3915
3892 if (ovl->id != OMAP_DSS_GFX && 3916 if (ovl->id != OMAP_DSS_GFX &&
3893 ovl->manager == mgr) 3917 ovl->manager == mgr)
3894 dispc_ovl_enable(ovl->id, false); 3918 ovl->disable(ovl);
3895 } 3919 }
3896 3920
3897 dispc_mgr_go(mgr->id); 3921 dss_mgr_enable(mgr);
3898 msleep(50);
3899
3900 if (enable)
3901 dssdev->driver->enable(dssdev);
3902 } 3922 }
3903 } 3923 }
3904 3924
@@ -3906,13 +3926,9 @@ static void dispc_error_worker(struct work_struct *work)
3906 DSSERR("OCP_ERR\n"); 3926 DSSERR("OCP_ERR\n");
3907 for (i = 0; i < omap_dss_get_num_overlay_managers(); ++i) { 3927 for (i = 0; i < omap_dss_get_num_overlay_managers(); ++i) {
3908 struct omap_overlay_manager *mgr; 3928 struct omap_overlay_manager *mgr;
3909 struct omap_dss_device *dssdev;
3910 3929
3911 mgr = omap_dss_get_overlay_manager(i); 3930 mgr = omap_dss_get_overlay_manager(i);
3912 dssdev = mgr->get_device(mgr); 3931 dss_mgr_disable(mgr);
3913
3914 if (dssdev && dssdev->driver)
3915 dssdev->driver->disable(dssdev);
3916 } 3932 }
3917 } 3933 }
3918 3934
@@ -4002,7 +4018,7 @@ static void _omap_dispc_initialize_irq(void)
4002 4018
4003 /* there's SYNC_LOST_DIGIT waiting after enabling the DSS, 4019 /* there's SYNC_LOST_DIGIT waiting after enabling the DSS,
4004 * so clear it */ 4020 * so clear it */
4005 dispc_write_reg(DISPC_IRQSTATUS, dispc_read_reg(DISPC_IRQSTATUS)); 4021 dispc_clear_irqstatus(dispc_read_irqstatus());
4006 4022
4007 _omap_dispc_set_irqs(); 4023 _omap_dispc_set_irqs();
4008 4024
@@ -4098,7 +4114,6 @@ static const struct dispc_features omap44xx_dispc_feats __initconst = {
4098 4114
4099static int __init dispc_init_features(struct platform_device *pdev) 4115static int __init dispc_init_features(struct platform_device *pdev)
4100{ 4116{
4101 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
4102 const struct dispc_features *src; 4117 const struct dispc_features *src;
4103 struct dispc_features *dst; 4118 struct dispc_features *dst;
4104 4119
@@ -4108,7 +4123,7 @@ static int __init dispc_init_features(struct platform_device *pdev)
4108 return -ENOMEM; 4123 return -ENOMEM;
4109 } 4124 }
4110 4125
4111 switch (pdata->version) { 4126 switch (omapdss_get_version()) {
4112 case OMAPDSS_VER_OMAP24xx: 4127 case OMAPDSS_VER_OMAP24xx:
4113 src = &omap24xx_dispc_feats; 4128 src = &omap24xx_dispc_feats;
4114 break; 4129 break;
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index ccf8550fafd..6d33112c599 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -320,86 +320,21 @@ void omapdss_default_get_timings(struct omap_dss_device *dssdev,
320} 320}
321EXPORT_SYMBOL(omapdss_default_get_timings); 321EXPORT_SYMBOL(omapdss_default_get_timings);
322 322
323/* 323int dss_init_device(struct platform_device *pdev,
324 * Connect dssdev to a manager if the manager is free or if force is specified. 324 struct omap_dss_device *dssdev)
325 * Connect all overlays to that manager if they are free or if force is
326 * specified.
327 */
328static int dss_init_connections(struct omap_dss_device *dssdev, bool force)
329{ 325{
326 struct device_attribute *attr;
330 struct omap_dss_output *out; 327 struct omap_dss_output *out;
331 struct omap_overlay_manager *mgr;
332 int i, r; 328 int i, r;
333 329
334 out = omapdss_get_output_from_dssdev(dssdev); 330 out = omapdss_get_output_from_dssdev(dssdev);
335 331
336 WARN_ON(dssdev->output);
337 WARN_ON(out->device);
338
339 r = omapdss_output_set_device(out, dssdev); 332 r = omapdss_output_set_device(out, dssdev);
340 if (r) { 333 if (r) {
341 DSSERR("failed to connect output to new device\n"); 334 DSSERR("failed to connect output to new device\n");
342 return r; 335 return r;
343 } 336 }
344 337
345 mgr = omap_dss_get_overlay_manager(dssdev->channel);
346
347 if (mgr->output && !force)
348 return 0;
349
350 if (mgr->output)
351 mgr->unset_output(mgr);
352
353 r = mgr->set_output(mgr, out);
354 if (r) {
355 DSSERR("failed to connect manager to output of new device\n");
356
357 /* remove the output-device connection we just made */
358 omapdss_output_unset_device(out);
359 return r;
360 }
361
362 for (i = 0; i < omap_dss_get_num_overlays(); ++i) {
363 struct omap_overlay *ovl = omap_dss_get_overlay(i);
364
365 if (!ovl->manager || force) {
366 if (ovl->manager)
367 ovl->unset_manager(ovl);
368
369 r = ovl->set_manager(ovl, mgr);
370 if (r) {
371 DSSERR("failed to set initial overlay\n");
372 return r;
373 }
374 }
375 }
376
377 return 0;
378}
379
380static void dss_uninit_connections(struct omap_dss_device *dssdev)
381{
382 if (dssdev->output) {
383 struct omap_overlay_manager *mgr = dssdev->output->manager;
384
385 if (mgr)
386 mgr->unset_output(mgr);
387
388 omapdss_output_unset_device(dssdev->output);
389 }
390}
391
392int dss_init_device(struct platform_device *pdev,
393 struct omap_dss_device *dssdev)
394{
395 struct device_attribute *attr;
396 int i, r;
397 const char *def_disp_name = dss_get_default_display_name();
398 bool force;
399
400 force = def_disp_name && strcmp(def_disp_name, dssdev->name) == 0;
401 dss_init_connections(dssdev, force);
402
403 /* create device sysfs files */ 338 /* create device sysfs files */
404 i = 0; 339 i = 0;
405 while ((attr = display_sysfs_attrs[i++]) != NULL) { 340 while ((attr = display_sysfs_attrs[i++]) != NULL) {
@@ -410,7 +345,7 @@ int dss_init_device(struct platform_device *pdev,
410 device_remove_file(&dssdev->dev, attr); 345 device_remove_file(&dssdev->dev, attr);
411 } 346 }
412 347
413 dss_uninit_connections(dssdev); 348 omapdss_output_unset_device(dssdev->output);
414 349
415 DSSERR("failed to create sysfs file\n"); 350 DSSERR("failed to create sysfs file\n");
416 return r; 351 return r;
@@ -424,7 +359,7 @@ int dss_init_device(struct platform_device *pdev,
424 while ((attr = display_sysfs_attrs[i++]) != NULL) 359 while ((attr = display_sysfs_attrs[i++]) != NULL)
425 device_remove_file(&dssdev->dev, attr); 360 device_remove_file(&dssdev->dev, attr);
426 361
427 dss_uninit_connections(dssdev); 362 omapdss_output_unset_device(dssdev->output);
428 363
429 DSSERR("failed to create sysfs display link\n"); 364 DSSERR("failed to create sysfs display link\n");
430 return r; 365 return r;
@@ -444,12 +379,12 @@ void dss_uninit_device(struct platform_device *pdev,
444 while ((attr = display_sysfs_attrs[i++]) != NULL) 379 while ((attr = display_sysfs_attrs[i++]) != NULL)
445 device_remove_file(&dssdev->dev, attr); 380 device_remove_file(&dssdev->dev, attr);
446 381
447 dss_uninit_connections(dssdev); 382 if (dssdev->output)
383 omapdss_output_unset_device(dssdev->output);
448} 384}
449 385
450static int dss_suspend_device(struct device *dev, void *data) 386static int dss_suspend_device(struct device *dev, void *data)
451{ 387{
452 int r;
453 struct omap_dss_device *dssdev = to_dss_device(dev); 388 struct omap_dss_device *dssdev = to_dss_device(dev);
454 389
455 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { 390 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
@@ -457,15 +392,7 @@ static int dss_suspend_device(struct device *dev, void *data)
457 return 0; 392 return 0;
458 } 393 }
459 394
460 if (!dssdev->driver->suspend) { 395 dssdev->driver->disable(dssdev);
461 DSSERR("display '%s' doesn't implement suspend\n",
462 dssdev->name);
463 return -ENOSYS;
464 }
465
466 r = dssdev->driver->suspend(dssdev);
467 if (r)
468 return r;
469 396
470 dssdev->activate_after_resume = true; 397 dssdev->activate_after_resume = true;
471 398
@@ -492,8 +419,8 @@ static int dss_resume_device(struct device *dev, void *data)
492 int r; 419 int r;
493 struct omap_dss_device *dssdev = to_dss_device(dev); 420 struct omap_dss_device *dssdev = to_dss_device(dev);
494 421
495 if (dssdev->activate_after_resume && dssdev->driver->resume) { 422 if (dssdev->activate_after_resume) {
496 r = dssdev->driver->resume(dssdev); 423 r = dssdev->driver->enable(dssdev);
497 if (r) 424 if (r)
498 return r; 425 return r;
499 } 426 }
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 56748cf8760..11d64b09cff 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -389,7 +389,7 @@ static int __init dpi_init_display(struct omap_dss_device *dssdev)
389static struct omap_dss_device * __init dpi_find_dssdev(struct platform_device *pdev) 389static struct omap_dss_device * __init dpi_find_dssdev(struct platform_device *pdev)
390{ 390{
391 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 391 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
392 const char *def_disp_name = dss_get_default_display_name(); 392 const char *def_disp_name = omapdss_get_default_display_name();
393 struct omap_dss_device *def_dssdev; 393 struct omap_dss_device *def_dssdev;
394 int i; 394 int i;
395 395
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 7d0db2bf2fc..2ba505b3315 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -5100,7 +5100,7 @@ static struct omap_dss_device * __init dsi_find_dssdev(struct platform_device *p
5100{ 5100{
5101 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 5101 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
5102 struct dsi_data *dsi = dsi_get_dsidrv_data(pdev); 5102 struct dsi_data *dsi = dsi_get_dsidrv_data(pdev);
5103 const char *def_disp_name = dss_get_default_display_name(); 5103 const char *def_disp_name = omapdss_get_default_display_name();
5104 struct omap_dss_device *def_dssdev; 5104 struct omap_dss_device *def_dssdev;
5105 int i; 5105 int i;
5106 5106
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 37ee465c1a0..456118beb1f 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -97,6 +97,8 @@ static const char * const dss_generic_clk_source_names[] = {
97 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI_PLL_HSDIV_DISPC", 97 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI_PLL_HSDIV_DISPC",
98 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI_PLL_HSDIV_DSI", 98 [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI_PLL_HSDIV_DSI",
99 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCK", 99 [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCK",
100 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "DSI_PLL2_HSDIV_DISPC",
101 [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "DSI_PLL2_HSDIV_DSI",
100}; 102};
101 103
102static inline void dss_write_reg(const struct dss_reg idx, u32 val) 104static inline void dss_write_reg(const struct dss_reg idx, u32 val)
@@ -793,7 +795,6 @@ static const struct dss_features omap54xx_dss_feats __initconst = {
793 795
794static int __init dss_init_features(struct platform_device *pdev) 796static int __init dss_init_features(struct platform_device *pdev)
795{ 797{
796 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
797 const struct dss_features *src; 798 const struct dss_features *src;
798 struct dss_features *dst; 799 struct dss_features *dst;
799 800
@@ -803,7 +804,7 @@ static int __init dss_init_features(struct platform_device *pdev)
803 return -ENOMEM; 804 return -ENOMEM;
804 } 805 }
805 806
806 switch (pdata->version) { 807 switch (omapdss_get_version()) {
807 case OMAPDSS_VER_OMAP24xx: 808 case OMAPDSS_VER_OMAP24xx:
808 src = &omap24xx_dss_feats; 809 src = &omap24xx_dss_feats;
809 break; 810 break;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index fb891656f1f..ff7a55b54b8 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -160,7 +160,6 @@ struct seq_file;
160struct platform_device; 160struct platform_device;
161 161
162/* core */ 162/* core */
163const char *dss_get_default_display_name(void);
164struct bus_type *dss_get_bus(void); 163struct bus_type *dss_get_bus(void);
165struct regulator *dss_get_vdds_dsi(void); 164struct regulator *dss_get_vdds_dsi(void);
166struct regulator *dss_get_vdds_sdi(void); 165struct regulator *dss_get_vdds_sdi(void);
@@ -398,7 +397,10 @@ void dpi_uninit_platform_driver(void) __exit;
398int dispc_init_platform_driver(void) __init; 397int dispc_init_platform_driver(void) __init;
399void dispc_uninit_platform_driver(void) __exit; 398void dispc_uninit_platform_driver(void) __exit;
400void dispc_dump_clocks(struct seq_file *s); 399void dispc_dump_clocks(struct seq_file *s);
401void dispc_irq_handler(void); 400u32 dispc_read_irqstatus(void);
401void dispc_clear_irqstatus(u32 mask);
402u32 dispc_read_irqenable(void);
403void dispc_write_irqenable(u32 mask);
402 404
403int dispc_runtime_get(void); 405int dispc_runtime_get(void);
404void dispc_runtime_put(void); 406void dispc_runtime_put(void);
@@ -429,6 +431,7 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
429 bool replication, const struct omap_video_timings *mgr_timings, 431 bool replication, const struct omap_video_timings *mgr_timings,
430 bool mem_to_mem); 432 bool mem_to_mem);
431int dispc_ovl_enable(enum omap_plane plane, bool enable); 433int dispc_ovl_enable(enum omap_plane plane, bool enable);
434bool dispc_ovl_enabled(enum omap_plane plane);
432void dispc_ovl_set_channel_out(enum omap_plane plane, 435void dispc_ovl_set_channel_out(enum omap_plane plane,
433 enum omap_channel channel); 436 enum omap_channel channel);
434 437
@@ -437,9 +440,10 @@ u32 dispc_mgr_get_framedone_irq(enum omap_channel channel);
437u32 dispc_mgr_get_sync_lost_irq(enum omap_channel channel); 440u32 dispc_mgr_get_sync_lost_irq(enum omap_channel channel);
438bool dispc_mgr_go_busy(enum omap_channel channel); 441bool dispc_mgr_go_busy(enum omap_channel channel);
439void dispc_mgr_go(enum omap_channel channel); 442void dispc_mgr_go(enum omap_channel channel);
443void dispc_mgr_enable(enum omap_channel channel, bool enable);
440bool dispc_mgr_is_enabled(enum omap_channel channel); 444bool dispc_mgr_is_enabled(enum omap_channel channel);
441void dispc_mgr_enable(enum omap_channel channel); 445void dispc_mgr_enable_sync(enum omap_channel channel);
442void dispc_mgr_disable(enum omap_channel channel); 446void dispc_mgr_disable_sync(enum omap_channel channel);
443bool dispc_mgr_is_channel_enabled(enum omap_channel channel); 447bool dispc_mgr_is_channel_enabled(enum omap_channel channel);
444void dispc_mgr_set_lcd_config(enum omap_channel channel, 448void dispc_mgr_set_lcd_config(enum omap_channel channel,
445 const struct dss_lcd_mgr_config *config); 449 const struct dss_lcd_mgr_config *config);
@@ -505,6 +509,8 @@ static inline unsigned long hdmi_get_pixel_clock(void)
505#endif 509#endif
506int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev); 510int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev);
507void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev); 511void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev);
512int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev);
513void omapdss_hdmi_core_disable(struct omap_dss_device *dssdev);
508void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev, 514void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev,
509 struct omap_video_timings *timings); 515 struct omap_video_timings *timings);
510int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev, 516int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 0d6d7213a85..2aada9db0a0 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -295,6 +295,12 @@ static const struct hdmi_config vesa_timings[] = {
295 false, }, 295 false, },
296 { 0x55, HDMI_DVI }, 296 { 0x55, HDMI_DVI },
297 }, 297 },
298 {
299 { 1920, 1200, 154000, 32, 48, 80, 6, 3, 26,
300 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
301 false, },
302 { 0x44, HDMI_DVI },
303 },
298}; 304};
299 305
300static int hdmi_runtime_get(void) 306static int hdmi_runtime_get(void)
@@ -323,7 +329,6 @@ static void hdmi_runtime_put(void)
323 329
324static int __init hdmi_init_display(struct omap_dss_device *dssdev) 330static int __init hdmi_init_display(struct omap_dss_device *dssdev)
325{ 331{
326 struct omap_dss_board_info *pdata = hdmi.pdev->dev.platform_data;
327 int r; 332 int r;
328 333
329 struct gpio gpios[] = { 334 struct gpio gpios[] = {
@@ -334,7 +339,7 @@ static int __init hdmi_init_display(struct omap_dss_device *dssdev)
334 339
335 DSSDBG("init_display\n"); 340 DSSDBG("init_display\n");
336 341
337 dss_init_hdmi_ip_ops(&hdmi.ip_data, pdata->version); 342 dss_init_hdmi_ip_ops(&hdmi.ip_data, omapdss_get_version());
338 343
339 if (hdmi.vdda_hdmi_dac_reg == NULL) { 344 if (hdmi.vdda_hdmi_dac_reg == NULL) {
340 struct regulator *reg; 345 struct regulator *reg;
@@ -399,7 +404,8 @@ static bool hdmi_timings_compare(struct omap_video_timings *timing1,
399{ 404{
400 int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync; 405 int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync;
401 406
402 if ((timing2->pixel_clock == timing1->pixel_clock) && 407 if ((DIV_ROUND_CLOSEST(timing2->pixel_clock, 1000) ==
408 DIV_ROUND_CLOSEST(timing1->pixel_clock, 1000)) &&
403 (timing2->x_res == timing1->x_res) && 409 (timing2->x_res == timing1->x_res) &&
404 (timing2->y_res == timing1->y_res)) { 410 (timing2->y_res == timing1->y_res)) {
405 411
@@ -501,12 +507,9 @@ static void hdmi_compute_pll(struct omap_dss_device *dssdev, int phy,
501 DSSDBG("range = %d sd = %d\n", pi->dcofreq, pi->regsd); 507 DSSDBG("range = %d sd = %d\n", pi->dcofreq, pi->regsd);
502} 508}
503 509
504static int hdmi_power_on(struct omap_dss_device *dssdev) 510static int hdmi_power_on_core(struct omap_dss_device *dssdev)
505{ 511{
506 int r; 512 int r;
507 struct omap_video_timings *p;
508 struct omap_overlay_manager *mgr = dssdev->output->manager;
509 unsigned long phy;
510 513
511 gpio_set_value(hdmi.ct_cp_hpd_gpio, 1); 514 gpio_set_value(hdmi.ct_cp_hpd_gpio, 1);
512 gpio_set_value(hdmi.ls_oe_gpio, 1); 515 gpio_set_value(hdmi.ls_oe_gpio, 1);
@@ -522,6 +525,46 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
522 if (r) 525 if (r)
523 goto err_runtime_get; 526 goto err_runtime_get;
524 527
528 /* Make selection of HDMI in DSS */
529 dss_select_hdmi_venc_clk_source(DSS_HDMI_M_PCLK);
530
531 /* Select the dispc clock source as PRCM clock, to ensure that it is not
532 * DSI PLL source as the clock selected by DSI PLL might not be
533 * sufficient for the resolution selected / that can be changed
534 * dynamically by user. This can be moved to single location , say
535 * Boardfile.
536 */
537 dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src);
538
539 return 0;
540
541err_runtime_get:
542 regulator_disable(hdmi.vdda_hdmi_dac_reg);
543err_vdac_enable:
544 gpio_set_value(hdmi.ct_cp_hpd_gpio, 0);
545 gpio_set_value(hdmi.ls_oe_gpio, 0);
546 return r;
547}
548
549static void hdmi_power_off_core(struct omap_dss_device *dssdev)
550{
551 hdmi_runtime_put();
552 regulator_disable(hdmi.vdda_hdmi_dac_reg);
553 gpio_set_value(hdmi.ct_cp_hpd_gpio, 0);
554 gpio_set_value(hdmi.ls_oe_gpio, 0);
555}
556
557static int hdmi_power_on_full(struct omap_dss_device *dssdev)
558{
559 int r;
560 struct omap_video_timings *p;
561 struct omap_overlay_manager *mgr = dssdev->output->manager;
562 unsigned long phy;
563
564 r = hdmi_power_on_core(dssdev);
565 if (r)
566 return r;
567
525 dss_mgr_disable(mgr); 568 dss_mgr_disable(mgr);
526 569
527 p = &hdmi.ip_data.cfg.timings; 570 p = &hdmi.ip_data.cfg.timings;
@@ -549,17 +592,6 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
549 592
550 hdmi.ip_data.ops->video_configure(&hdmi.ip_data); 593 hdmi.ip_data.ops->video_configure(&hdmi.ip_data);
551 594
552 /* Make selection of HDMI in DSS */
553 dss_select_hdmi_venc_clk_source(DSS_HDMI_M_PCLK);
554
555 /* Select the dispc clock source as PRCM clock, to ensure that it is not
556 * DSI PLL source as the clock selected by DSI PLL might not be
557 * sufficient for the resolution selected / that can be changed
558 * dynamically by user. This can be moved to single location , say
559 * Boardfile.
560 */
561 dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src);
562
563 /* bypass TV gamma table */ 595 /* bypass TV gamma table */
564 dispc_enable_gamma_table(0); 596 dispc_enable_gamma_table(0);
565 597
@@ -583,16 +615,11 @@ err_vid_enable:
583err_phy_enable: 615err_phy_enable:
584 hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); 616 hdmi.ip_data.ops->pll_disable(&hdmi.ip_data);
585err_pll_enable: 617err_pll_enable:
586 hdmi_runtime_put(); 618 hdmi_power_off_core(dssdev);
587err_runtime_get:
588 regulator_disable(hdmi.vdda_hdmi_dac_reg);
589err_vdac_enable:
590 gpio_set_value(hdmi.ct_cp_hpd_gpio, 0);
591 gpio_set_value(hdmi.ls_oe_gpio, 0);
592 return -EIO; 619 return -EIO;
593} 620}
594 621
595static void hdmi_power_off(struct omap_dss_device *dssdev) 622static void hdmi_power_off_full(struct omap_dss_device *dssdev)
596{ 623{
597 struct omap_overlay_manager *mgr = dssdev->output->manager; 624 struct omap_overlay_manager *mgr = dssdev->output->manager;
598 625
@@ -601,12 +628,8 @@ static void hdmi_power_off(struct omap_dss_device *dssdev)
601 hdmi.ip_data.ops->video_disable(&hdmi.ip_data); 628 hdmi.ip_data.ops->video_disable(&hdmi.ip_data);
602 hdmi.ip_data.ops->phy_disable(&hdmi.ip_data); 629 hdmi.ip_data.ops->phy_disable(&hdmi.ip_data);
603 hdmi.ip_data.ops->pll_disable(&hdmi.ip_data); 630 hdmi.ip_data.ops->pll_disable(&hdmi.ip_data);
604 hdmi_runtime_put();
605
606 regulator_disable(hdmi.vdda_hdmi_dac_reg);
607 631
608 gpio_set_value(hdmi.ct_cp_hpd_gpio, 0); 632 hdmi_power_off_core(dssdev);
609 gpio_set_value(hdmi.ls_oe_gpio, 0);
610} 633}
611 634
612int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev, 635int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
@@ -716,7 +739,7 @@ int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
716 goto err0; 739 goto err0;
717 } 740 }
718 741
719 r = hdmi_power_on(dssdev); 742 r = hdmi_power_on_full(dssdev);
720 if (r) { 743 if (r) {
721 DSSERR("failed to power on device\n"); 744 DSSERR("failed to power on device\n");
722 goto err1; 745 goto err1;
@@ -738,13 +761,48 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev)
738 761
739 mutex_lock(&hdmi.lock); 762 mutex_lock(&hdmi.lock);
740 763
741 hdmi_power_off(dssdev); 764 hdmi_power_off_full(dssdev);
742 765
743 omap_dss_stop_device(dssdev); 766 omap_dss_stop_device(dssdev);
744 767
745 mutex_unlock(&hdmi.lock); 768 mutex_unlock(&hdmi.lock);
746} 769}
747 770
771int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev)
772{
773 int r = 0;
774
775 DSSDBG("ENTER omapdss_hdmi_core_enable\n");
776
777 mutex_lock(&hdmi.lock);
778
779 hdmi.ip_data.hpd_gpio = hdmi.hpd_gpio;
780
781 r = hdmi_power_on_core(dssdev);
782 if (r) {
783 DSSERR("failed to power on device\n");
784 goto err0;
785 }
786
787 mutex_unlock(&hdmi.lock);
788 return 0;
789
790err0:
791 mutex_unlock(&hdmi.lock);
792 return r;
793}
794
795void omapdss_hdmi_core_disable(struct omap_dss_device *dssdev)
796{
797 DSSDBG("Enter omapdss_hdmi_core_disable\n");
798
799 mutex_lock(&hdmi.lock);
800
801 hdmi_power_off_core(dssdev);
802
803 mutex_unlock(&hdmi.lock);
804}
805
748static int hdmi_get_clocks(struct platform_device *pdev) 806static int hdmi_get_clocks(struct platform_device *pdev)
749{ 807{
750 struct clk *clk; 808 struct clk *clk;
@@ -913,7 +971,7 @@ int hdmi_audio_config(struct omap_dss_audio *audio)
913static struct omap_dss_device * __init hdmi_find_dssdev(struct platform_device *pdev) 971static struct omap_dss_device * __init hdmi_find_dssdev(struct platform_device *pdev)
914{ 972{
915 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 973 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
916 const char *def_disp_name = dss_get_default_display_name(); 974 const char *def_disp_name = omapdss_get_default_display_name();
917 struct omap_dss_device *def_dssdev; 975 struct omap_dss_device *def_dssdev;
918 int i; 976 int i;
919 977
diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c
index 69fb115bab3..a385b69a018 100644
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ b/drivers/video/omap2/dss/hdmi_panel.c
@@ -280,58 +280,6 @@ static void hdmi_panel_disable(struct omap_dss_device *dssdev)
280 mutex_unlock(&hdmi.lock); 280 mutex_unlock(&hdmi.lock);
281} 281}
282 282
283static int hdmi_panel_suspend(struct omap_dss_device *dssdev)
284{
285 int r = 0;
286
287 mutex_lock(&hdmi.lock);
288
289 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) {
290 r = -EINVAL;
291 goto err;
292 }
293
294 /*
295 * TODO: notify audio users that the display was suspended. For now,
296 * disable audio locally to not break our audio state machine.
297 */
298 hdmi_panel_audio_disable(dssdev);
299
300 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
301 omapdss_hdmi_display_disable(dssdev);
302
303err:
304 mutex_unlock(&hdmi.lock);
305
306 return r;
307}
308
309static int hdmi_panel_resume(struct omap_dss_device *dssdev)
310{
311 int r = 0;
312
313 mutex_lock(&hdmi.lock);
314
315 if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) {
316 r = -EINVAL;
317 goto err;
318 }
319
320 r = omapdss_hdmi_display_enable(dssdev);
321 if (r) {
322 DSSERR("failed to power on\n");
323 goto err;
324 }
325 /* TODO: notify audio users that the panel resumed. */
326
327 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
328
329err:
330 mutex_unlock(&hdmi.lock);
331
332 return r;
333}
334
335static void hdmi_get_timings(struct omap_dss_device *dssdev, 283static void hdmi_get_timings(struct omap_dss_device *dssdev,
336 struct omap_video_timings *timings) 284 struct omap_video_timings *timings)
337{ 285{
@@ -379,20 +327,22 @@ static int hdmi_check_timings(struct omap_dss_device *dssdev,
379static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len) 327static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len)
380{ 328{
381 int r; 329 int r;
330 bool need_enable;
382 331
383 mutex_lock(&hdmi.lock); 332 mutex_lock(&hdmi.lock);
384 333
385 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { 334 need_enable = dssdev->state == OMAP_DSS_DISPLAY_DISABLED;
386 r = omapdss_hdmi_display_enable(dssdev); 335
336 if (need_enable) {
337 r = omapdss_hdmi_core_enable(dssdev);
387 if (r) 338 if (r)
388 goto err; 339 goto err;
389 } 340 }
390 341
391 r = omapdss_hdmi_read_edid(buf, len); 342 r = omapdss_hdmi_read_edid(buf, len);
392 343
393 if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || 344 if (need_enable)
394 dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) 345 omapdss_hdmi_core_disable(dssdev);
395 omapdss_hdmi_display_disable(dssdev);
396err: 346err:
397 mutex_unlock(&hdmi.lock); 347 mutex_unlock(&hdmi.lock);
398 348
@@ -402,20 +352,22 @@ err:
402static bool hdmi_detect(struct omap_dss_device *dssdev) 352static bool hdmi_detect(struct omap_dss_device *dssdev)
403{ 353{
404 int r; 354 int r;
355 bool need_enable;
405 356
406 mutex_lock(&hdmi.lock); 357 mutex_lock(&hdmi.lock);
407 358
408 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { 359 need_enable = dssdev->state == OMAP_DSS_DISPLAY_DISABLED;
409 r = omapdss_hdmi_display_enable(dssdev); 360
361 if (need_enable) {
362 r = omapdss_hdmi_core_enable(dssdev);
410 if (r) 363 if (r)
411 goto err; 364 goto err;
412 } 365 }
413 366
414 r = omapdss_hdmi_detect(); 367 r = omapdss_hdmi_detect();
415 368
416 if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || 369 if (need_enable)
417 dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) 370 omapdss_hdmi_core_disable(dssdev);
418 omapdss_hdmi_display_disable(dssdev);
419err: 371err:
420 mutex_unlock(&hdmi.lock); 372 mutex_unlock(&hdmi.lock);
421 373
@@ -427,8 +379,6 @@ static struct omap_dss_driver hdmi_driver = {
427 .remove = hdmi_panel_remove, 379 .remove = hdmi_panel_remove,
428 .enable = hdmi_panel_enable, 380 .enable = hdmi_panel_enable,
429 .disable = hdmi_panel_disable, 381 .disable = hdmi_panel_disable,
430 .suspend = hdmi_panel_suspend,
431 .resume = hdmi_panel_resume,
432 .get_timings = hdmi_get_timings, 382 .get_timings = hdmi_get_timings,
433 .set_timings = hdmi_set_timings, 383 .set_timings = hdmi_set_timings,
434 .check_timings = hdmi_check_timings, 384 .check_timings = hdmi_check_timings,
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 7282e5af3e1..7bfeb13cf3d 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -950,7 +950,7 @@ static int __init rfbi_init_display(struct omap_dss_device *dssdev)
950static struct omap_dss_device * __init rfbi_find_dssdev(struct platform_device *pdev) 950static struct omap_dss_device * __init rfbi_find_dssdev(struct platform_device *pdev)
951{ 951{
952 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 952 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
953 const char *def_disp_name = dss_get_default_display_name(); 953 const char *def_disp_name = omapdss_get_default_display_name();
954 struct omap_dss_device *def_dssdev; 954 struct omap_dss_device *def_dssdev;
955 int i; 955 int i;
956 956
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 7760851f6e5..882ce89765e 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -205,7 +205,7 @@ static int __init sdi_init_display(struct omap_dss_device *dssdev)
205static struct omap_dss_device * __init sdi_find_dssdev(struct platform_device *pdev) 205static struct omap_dss_device * __init sdi_find_dssdev(struct platform_device *pdev)
206{ 206{
207 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 207 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
208 const char *def_disp_name = dss_get_default_display_name(); 208 const char *def_disp_name = omapdss_get_default_display_name();
209 struct omap_dss_device *def_dssdev; 209 struct omap_dss_device *def_dssdev;
210 int i; 210 int i;
211 211
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 56efa3bb465..e8fddc9012c 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -744,7 +744,7 @@ static void venc_put_clocks(void)
744static struct omap_dss_device * __init venc_find_dssdev(struct platform_device *pdev) 744static struct omap_dss_device * __init venc_find_dssdev(struct platform_device *pdev)
745{ 745{
746 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 746 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
747 const char *def_disp_name = dss_get_default_display_name(); 747 const char *def_disp_name = omapdss_get_default_display_name();
748 struct omap_dss_device *def_dssdev; 748 struct omap_dss_device *def_dssdev;
749 int i; 749 int i;
750 750
diff --git a/drivers/video/omap2/dss/venc_panel.c b/drivers/video/omap2/dss/venc_panel.c
index d55b8784ecf..0d2b1a0834a 100644
--- a/drivers/video/omap2/dss/venc_panel.c
+++ b/drivers/video/omap2/dss/venc_panel.c
@@ -157,12 +157,6 @@ static void venc_panel_disable(struct omap_dss_device *dssdev)
157 if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) 157 if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED)
158 goto end; 158 goto end;
159 159
160 if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) {
161 /* suspended is the same as disabled with venc */
162 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
163 goto end;
164 }
165
166 omapdss_venc_display_disable(dssdev); 160 omapdss_venc_display_disable(dssdev);
167 161
168 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; 162 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
@@ -170,17 +164,6 @@ end:
170 mutex_unlock(&venc_panel.lock); 164 mutex_unlock(&venc_panel.lock);
171} 165}
172 166
173static int venc_panel_suspend(struct omap_dss_device *dssdev)
174{
175 venc_panel_disable(dssdev);
176 return 0;
177}
178
179static int venc_panel_resume(struct omap_dss_device *dssdev)
180{
181 return venc_panel_enable(dssdev);
182}
183
184static void venc_panel_set_timings(struct omap_dss_device *dssdev, 167static void venc_panel_set_timings(struct omap_dss_device *dssdev,
185 struct omap_video_timings *timings) 168 struct omap_video_timings *timings)
186{ 169{
@@ -222,8 +205,6 @@ static struct omap_dss_driver venc_driver = {
222 205
223 .enable = venc_panel_enable, 206 .enable = venc_panel_enable,
224 .disable = venc_panel_disable, 207 .disable = venc_panel_disable,
225 .suspend = venc_panel_suspend,
226 .resume = venc_panel_resume,
227 208
228 .get_resolution = omapdss_default_get_resolution, 209 .get_resolution = omapdss_default_get_resolution,
229 .get_recommended_bpp = omapdss_default_get_recommended_bpp, 210 .get_recommended_bpp = omapdss_default_get_recommended_bpp,
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index bc225e46fdd..be9096ced79 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -1258,11 +1258,10 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
1258 1258
1259 switch (blank) { 1259 switch (blank) {
1260 case FB_BLANK_UNBLANK: 1260 case FB_BLANK_UNBLANK:
1261 if (display->state != OMAP_DSS_DISPLAY_SUSPENDED) 1261 if (display->state == OMAP_DSS_DISPLAY_ACTIVE)
1262 goto exit; 1262 goto exit;
1263 1263
1264 if (display->driver->resume) 1264 r = display->driver->enable(display);
1265 r = display->driver->resume(display);
1266 1265
1267 if ((display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) && 1266 if ((display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) &&
1268 d->update_mode == OMAPFB_AUTO_UPDATE && 1267 d->update_mode == OMAPFB_AUTO_UPDATE &&
@@ -1283,8 +1282,7 @@ static int omapfb_blank(int blank, struct fb_info *fbi)
1283 if (d->auto_update_work_enabled) 1282 if (d->auto_update_work_enabled)
1284 omapfb_stop_auto_update(fbdev, display); 1283 omapfb_stop_auto_update(fbdev, display);
1285 1284
1286 if (display->driver->suspend) 1285 display->driver->disable(display);
1287 r = display->driver->suspend(display);
1288 1286
1289 break; 1287 break;
1290 1288
@@ -2258,7 +2256,7 @@ static int omapfb_find_best_mode(struct omap_dss_device *display,
2258{ 2256{
2259 struct fb_monspecs *specs; 2257 struct fb_monspecs *specs;
2260 u8 *edid; 2258 u8 *edid;
2261 int r, i, best_xres, best_idx, len; 2259 int r, i, best_idx, len;
2262 2260
2263 if (!display->driver->read_edid) 2261 if (!display->driver->read_edid)
2264 return -ENODEV; 2262 return -ENODEV;
@@ -2274,10 +2272,6 @@ static int omapfb_find_best_mode(struct omap_dss_device *display,
2274 2272
2275 fb_edid_to_monspecs(edid, specs); 2273 fb_edid_to_monspecs(edid, specs);
2276 2274
2277 if (edid[126] > 0)
2278 fb_edid_add_monspecs(edid + 0x80, specs);
2279
2280 best_xres = 0;
2281 best_idx = -1; 2275 best_idx = -1;
2282 2276
2283 for (i = 0; i < specs->modedb_len; ++i) { 2277 for (i = 0; i < specs->modedb_len; ++i) {
@@ -2293,16 +2287,20 @@ static int omapfb_find_best_mode(struct omap_dss_device *display,
2293 if (m->xres == 2880 || m->xres == 1440) 2287 if (m->xres == 2880 || m->xres == 1440)
2294 continue; 2288 continue;
2295 2289
2290 if (m->vmode & FB_VMODE_INTERLACED ||
2291 m->vmode & FB_VMODE_DOUBLE)
2292 continue;
2293
2296 fb_videomode_to_omap_timings(m, display, &t); 2294 fb_videomode_to_omap_timings(m, display, &t);
2297 2295
2298 r = display->driver->check_timings(display, &t); 2296 r = display->driver->check_timings(display, &t);
2299 if (r == 0 && best_xres < m->xres) { 2297 if (r == 0) {
2300 best_xres = m->xres;
2301 best_idx = i; 2298 best_idx = i;
2299 break;
2302 } 2300 }
2303 } 2301 }
2304 2302
2305 if (best_xres == 0) { 2303 if (best_idx == -1) {
2306 r = -ENOENT; 2304 r = -ENOENT;
2307 goto err2; 2305 goto err2;
2308 } 2306 }
@@ -2371,15 +2369,52 @@ static int omapfb_init_display(struct omapfb2_device *fbdev,
2371 return 0; 2369 return 0;
2372} 2370}
2373 2371
2372static int omapfb_init_connections(struct omapfb2_device *fbdev,
2373 struct omap_dss_device *dssdev)
2374{
2375 int i, r;
2376 struct omap_overlay_manager *mgr = NULL;
2377
2378 for (i = 0; i < fbdev->num_managers; i++) {
2379 mgr = fbdev->managers[i];
2380
2381 if (dssdev->channel == mgr->id)
2382 break;
2383 }
2384
2385 if (i == fbdev->num_managers)
2386 return -ENODEV;
2387
2388 if (mgr->output)
2389 mgr->unset_output(mgr);
2390
2391 r = mgr->set_output(mgr, dssdev->output);
2392 if (r)
2393 return r;
2394
2395 for (i = 0; i < fbdev->num_overlays; i++) {
2396 struct omap_overlay *ovl = fbdev->overlays[i];
2397
2398 if (ovl->manager)
2399 ovl->unset_manager(ovl);
2400
2401 r = ovl->set_manager(ovl, mgr);
2402 if (r)
2403 dev_warn(fbdev->dev,
2404 "failed to connect overlay %s to manager %s\n",
2405 ovl->name, mgr->name);
2406 }
2407
2408 return 0;
2409}
2410
2374static int __init omapfb_probe(struct platform_device *pdev) 2411static int __init omapfb_probe(struct platform_device *pdev)
2375{ 2412{
2376 struct omapfb2_device *fbdev = NULL; 2413 struct omapfb2_device *fbdev = NULL;
2377 int r = 0; 2414 int r = 0;
2378 int i; 2415 int i;
2379 struct omap_overlay *ovl;
2380 struct omap_dss_device *def_display; 2416 struct omap_dss_device *def_display;
2381 struct omap_dss_device *dssdev; 2417 struct omap_dss_device *dssdev;
2382 struct omap_dss_device *ovl_device;
2383 2418
2384 DBG("omapfb_probe\n"); 2419 DBG("omapfb_probe\n");
2385 2420
@@ -2447,15 +2482,33 @@ static int __init omapfb_probe(struct platform_device *pdev)
2447 for (i = 0; i < fbdev->num_managers; i++) 2482 for (i = 0; i < fbdev->num_managers; i++)
2448 fbdev->managers[i] = omap_dss_get_overlay_manager(i); 2483 fbdev->managers[i] = omap_dss_get_overlay_manager(i);
2449 2484
2450 /* gfx overlay should be the default one. find a display 2485 def_display = NULL;
2451 * connected to that, and use it as default display */ 2486
2452 ovl = omap_dss_get_overlay(0); 2487 for (i = 0; i < fbdev->num_displays; ++i) {
2453 ovl_device = ovl->get_device(ovl); 2488 struct omap_dss_device *dssdev;
2454 if (ovl_device) { 2489 const char *def_name;
2455 def_display = ovl_device; 2490
2456 } else { 2491 def_name = omapdss_get_default_display_name();
2457 dev_warn(&pdev->dev, "cannot find default display\n"); 2492
2458 def_display = NULL; 2493 dssdev = fbdev->displays[i].dssdev;
2494
2495 if (def_name == NULL ||
2496 (dssdev->name && strcmp(def_name, dssdev->name) == 0)) {
2497 def_display = dssdev;
2498 break;
2499 }
2500 }
2501
2502 if (def_display == NULL) {
2503 dev_err(fbdev->dev, "failed to find default display\n");
2504 r = -EINVAL;
2505 goto cleanup;
2506 }
2507
2508 r = omapfb_init_connections(fbdev, def_display);
2509 if (r) {
2510 dev_err(fbdev->dev, "failed to init overlay connections\n");
2511 goto cleanup;
2459 } 2512 }
2460 2513
2461 if (def_mode && strlen(def_mode) > 0) { 2514 if (def_mode && strlen(def_mode) > 0) {