diff options
-rw-r--r-- | drivers/video/omap2/dss/dpi.c | 70 | ||||
-rw-r--r-- | include/video/omapdss.h | 23 |
2 files changed, 93 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 5351d02e3064..6433eab6bcf2 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c | |||
@@ -461,6 +461,16 @@ void omapdss_dpi_set_timings(struct omap_dss_device *dssdev, | |||
461 | } | 461 | } |
462 | EXPORT_SYMBOL(omapdss_dpi_set_timings); | 462 | EXPORT_SYMBOL(omapdss_dpi_set_timings); |
463 | 463 | ||
464 | static void dpi_get_timings(struct omap_dss_device *dssdev, | ||
465 | struct omap_video_timings *timings) | ||
466 | { | ||
467 | mutex_lock(&dpi.lock); | ||
468 | |||
469 | *timings = dpi.timings; | ||
470 | |||
471 | mutex_unlock(&dpi.lock); | ||
472 | } | ||
473 | |||
464 | int dpi_check_timings(struct omap_dss_device *dssdev, | 474 | int dpi_check_timings(struct omap_dss_device *dssdev, |
465 | struct omap_video_timings *timings) | 475 | struct omap_video_timings *timings) |
466 | { | 476 | { |
@@ -678,6 +688,65 @@ static int dpi_probe_pdata(struct platform_device *dpidev) | |||
678 | return 0; | 688 | return 0; |
679 | } | 689 | } |
680 | 690 | ||
691 | static int dpi_connect(struct omap_dss_device *dssdev, | ||
692 | struct omap_dss_device *dst) | ||
693 | { | ||
694 | struct omap_overlay_manager *mgr; | ||
695 | int r; | ||
696 | |||
697 | r = dpi_init_regulator(); | ||
698 | if (r) | ||
699 | return r; | ||
700 | |||
701 | dpi_init_pll(); | ||
702 | |||
703 | mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); | ||
704 | if (!mgr) | ||
705 | return -ENODEV; | ||
706 | |||
707 | r = dss_mgr_connect(mgr, dssdev); | ||
708 | if (r) | ||
709 | return r; | ||
710 | |||
711 | r = omapdss_output_set_device(dssdev, dst); | ||
712 | if (r) { | ||
713 | DSSERR("failed to connect output to new device: %s\n", | ||
714 | dst->name); | ||
715 | dss_mgr_disconnect(mgr, dssdev); | ||
716 | return r; | ||
717 | } | ||
718 | |||
719 | return 0; | ||
720 | } | ||
721 | |||
722 | static void dpi_disconnect(struct omap_dss_device *dssdev, | ||
723 | struct omap_dss_device *dst) | ||
724 | { | ||
725 | WARN_ON(dst != dssdev->device); | ||
726 | |||
727 | if (dst != dssdev->device) | ||
728 | return; | ||
729 | |||
730 | omapdss_output_unset_device(dssdev); | ||
731 | |||
732 | if (dssdev->manager) | ||
733 | dss_mgr_disconnect(dssdev->manager, dssdev); | ||
734 | } | ||
735 | |||
736 | static const struct omapdss_dpi_ops dpi_ops = { | ||
737 | .connect = dpi_connect, | ||
738 | .disconnect = dpi_disconnect, | ||
739 | |||
740 | .enable = omapdss_dpi_display_enable, | ||
741 | .disable = omapdss_dpi_display_disable, | ||
742 | |||
743 | .check_timings = dpi_check_timings, | ||
744 | .set_timings = omapdss_dpi_set_timings, | ||
745 | .get_timings = dpi_get_timings, | ||
746 | |||
747 | .set_data_lines = omapdss_dpi_set_data_lines, | ||
748 | }; | ||
749 | |||
681 | static void dpi_init_output(struct platform_device *pdev) | 750 | static void dpi_init_output(struct platform_device *pdev) |
682 | { | 751 | { |
683 | struct omap_dss_device *out = &dpi.output; | 752 | struct omap_dss_device *out = &dpi.output; |
@@ -687,6 +756,7 @@ static void dpi_init_output(struct platform_device *pdev) | |||
687 | out->output_type = OMAP_DISPLAY_TYPE_DPI; | 756 | out->output_type = OMAP_DISPLAY_TYPE_DPI; |
688 | out->name = "dpi.0"; | 757 | out->name = "dpi.0"; |
689 | out->dispc_channel = dpi_get_channel(); | 758 | out->dispc_channel = dpi_get_channel(); |
759 | out->ops.dpi = &dpi_ops; | ||
690 | out->owner = THIS_MODULE; | 760 | out->owner = THIS_MODULE; |
691 | 761 | ||
692 | omapdss_register_output(out); | 762 | omapdss_register_output(out); |
diff --git a/include/video/omapdss.h b/include/video/omapdss.h index cff514eec584..71fe1566ce01 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h | |||
@@ -573,6 +573,25 @@ struct omap_dss_writeback_info { | |||
573 | u8 pre_mult_alpha; | 573 | u8 pre_mult_alpha; |
574 | }; | 574 | }; |
575 | 575 | ||
576 | struct omapdss_dpi_ops { | ||
577 | int (*connect)(struct omap_dss_device *dssdev, | ||
578 | struct omap_dss_device *dst); | ||
579 | void (*disconnect)(struct omap_dss_device *dssdev, | ||
580 | struct omap_dss_device *dst); | ||
581 | |||
582 | int (*enable)(struct omap_dss_device *dssdev); | ||
583 | void (*disable)(struct omap_dss_device *dssdev); | ||
584 | |||
585 | int (*check_timings)(struct omap_dss_device *dssdev, | ||
586 | struct omap_video_timings *timings); | ||
587 | void (*set_timings)(struct omap_dss_device *dssdev, | ||
588 | struct omap_video_timings *timings); | ||
589 | void (*get_timings)(struct omap_dss_device *dssdev, | ||
590 | struct omap_video_timings *timings); | ||
591 | |||
592 | void (*set_data_lines)(struct omap_dss_device *dssdev, int data_lines); | ||
593 | }; | ||
594 | |||
576 | struct omap_dss_device { | 595 | struct omap_dss_device { |
577 | /* old device, to be removed */ | 596 | /* old device, to be removed */ |
578 | struct device old_dev; | 597 | struct device old_dev; |
@@ -638,6 +657,10 @@ struct omap_dss_device { | |||
638 | 657 | ||
639 | struct omap_dss_driver *driver; | 658 | struct omap_dss_driver *driver; |
640 | 659 | ||
660 | union { | ||
661 | const struct omapdss_dpi_ops *dpi; | ||
662 | } ops; | ||
663 | |||
641 | /* helper variable for driver suspend/resume */ | 664 | /* helper variable for driver suspend/resume */ |
642 | bool activate_after_resume; | 665 | bool activate_after_resume; |
643 | 666 | ||