aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/omap2/dss/core.c')
-rw-r--r--drivers/video/omap2/dss/core.c85
1 files changed, 52 insertions, 33 deletions
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 7ebe50b335e..b3a498f22d3 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -482,6 +482,14 @@ static void dss_uninitialize_debugfs(void)
482 if (dss_debugfs_dir) 482 if (dss_debugfs_dir)
483 debugfs_remove_recursive(dss_debugfs_dir); 483 debugfs_remove_recursive(dss_debugfs_dir);
484} 484}
485#else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
486static inline int dss_initialize_debugfs(void)
487{
488 return 0;
489}
490static inline void dss_uninitialize_debugfs(void)
491{
492}
485#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ 493#endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
486 494
487/* PLATFORM DEVICE */ 495/* PLATFORM DEVICE */
@@ -499,7 +507,7 @@ static int omap_dss_probe(struct platform_device *pdev)
499 507
500 r = dss_get_clocks(); 508 r = dss_get_clocks();
501 if (r) 509 if (r)
502 goto fail0; 510 goto err_clocks;
503 511
504 dss_clk_enable_all_no_ctx(); 512 dss_clk_enable_all_no_ctx();
505 513
@@ -515,64 +523,64 @@ static int omap_dss_probe(struct platform_device *pdev)
515 r = dss_init(skip_init); 523 r = dss_init(skip_init);
516 if (r) { 524 if (r) {
517 DSSERR("Failed to initialize DSS\n"); 525 DSSERR("Failed to initialize DSS\n");
518 goto fail0; 526 goto err_dss;
519 } 527 }
520 528
521#ifdef CONFIG_OMAP2_DSS_RFBI
522 r = rfbi_init(); 529 r = rfbi_init();
523 if (r) { 530 if (r) {
524 DSSERR("Failed to initialize rfbi\n"); 531 DSSERR("Failed to initialize rfbi\n");
525 goto fail0; 532 goto err_rfbi;
526 } 533 }
527#endif
528 534
529 r = dpi_init(pdev); 535 r = dpi_init(pdev);
530 if (r) { 536 if (r) {
531 DSSERR("Failed to initialize dpi\n"); 537 DSSERR("Failed to initialize dpi\n");
532 goto fail0; 538 goto err_dpi;
533 } 539 }
534 540
535 r = dispc_init(); 541 r = dispc_init();
536 if (r) { 542 if (r) {
537 DSSERR("Failed to initialize dispc\n"); 543 DSSERR("Failed to initialize dispc\n");
538 goto fail0; 544 goto err_dispc;
539 } 545 }
540#ifdef CONFIG_OMAP2_DSS_VENC 546
541 r = venc_init(pdev); 547 r = venc_init(pdev);
542 if (r) { 548 if (r) {
543 DSSERR("Failed to initialize venc\n"); 549 DSSERR("Failed to initialize venc\n");
544 goto fail0; 550 goto err_venc;
545 } 551 }
546#endif 552
547 if (cpu_is_omap34xx()) { 553 if (cpu_is_omap34xx()) {
548#ifdef CONFIG_OMAP2_DSS_SDI
549 r = sdi_init(skip_init); 554 r = sdi_init(skip_init);
550 if (r) { 555 if (r) {
551 DSSERR("Failed to initialize SDI\n"); 556 DSSERR("Failed to initialize SDI\n");
552 goto fail0; 557 goto err_sdi;
553 } 558 }
554#endif 559
555#ifdef CONFIG_OMAP2_DSS_DSI
556 r = dsi_init(pdev); 560 r = dsi_init(pdev);
557 if (r) { 561 if (r) {
558 DSSERR("Failed to initialize DSI\n"); 562 DSSERR("Failed to initialize DSI\n");
559 goto fail0; 563 goto err_dsi;
560 } 564 }
561#endif
562 } 565 }
563 566
564#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
565 r = dss_initialize_debugfs(); 567 r = dss_initialize_debugfs();
566 if (r) 568 if (r)
567 goto fail0; 569 goto err_debugfs;
568#endif
569 570
570 for (i = 0; i < pdata->num_devices; ++i) { 571 for (i = 0; i < pdata->num_devices; ++i) {
571 struct omap_dss_device *dssdev = pdata->devices[i]; 572 struct omap_dss_device *dssdev = pdata->devices[i];
572 573
573 r = omap_dss_register_device(dssdev); 574 r = omap_dss_register_device(dssdev);
574 if (r) 575 if (r) {
575 DSSERR("device reg failed %d\n", i); 576 DSSERR("device %d %s register failed %d\n", i,
577 dssdev->name ?: "unnamed", r);
578
579 while (--i >= 0)
580 omap_dss_unregister_device(pdata->devices[i]);
581
582 goto err_register;
583 }
576 584
577 if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0) 585 if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0)
578 pdata->default_device = dssdev; 586 pdata->default_device = dssdev;
@@ -582,8 +590,29 @@ static int omap_dss_probe(struct platform_device *pdev)
582 590
583 return 0; 591 return 0;
584 592
585 /* XXX fail correctly */ 593err_register:
586fail0: 594 dss_uninitialize_debugfs();
595err_debugfs:
596 if (cpu_is_omap34xx())
597 dsi_exit();
598err_dsi:
599 if (cpu_is_omap34xx())
600 sdi_exit();
601err_sdi:
602 venc_exit();
603err_venc:
604 dispc_exit();
605err_dispc:
606 dpi_exit();
607err_dpi:
608 rfbi_exit();
609err_rfbi:
610 dss_exit();
611err_dss:
612 dss_clk_disable_all_no_ctx();
613 dss_put_clocks();
614err_clocks:
615
587 return r; 616 return r;
588} 617}
589 618
@@ -593,25 +622,15 @@ static int omap_dss_remove(struct platform_device *pdev)
593 int i; 622 int i;
594 int c; 623 int c;
595 624
596#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
597 dss_uninitialize_debugfs(); 625 dss_uninitialize_debugfs();
598#endif
599 626
600#ifdef CONFIG_OMAP2_DSS_VENC
601 venc_exit(); 627 venc_exit();
602#endif
603 dispc_exit(); 628 dispc_exit();
604 dpi_exit(); 629 dpi_exit();
605#ifdef CONFIG_OMAP2_DSS_RFBI
606 rfbi_exit(); 630 rfbi_exit();
607#endif
608 if (cpu_is_omap34xx()) { 631 if (cpu_is_omap34xx()) {
609#ifdef CONFIG_OMAP2_DSS_DSI
610 dsi_exit(); 632 dsi_exit();
611#endif
612#ifdef CONFIG_OMAP2_DSS_SDI
613 sdi_exit(); 633 sdi_exit();
614#endif
615 } 634 }
616 635
617 dss_exit(); 636 dss_exit();