aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-05-24 06:19:50 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-06-17 07:01:00 -0400
commitfb8efa49660ea450ad632c9d8b70f12e4a43a495 (patch)
tree04d9704190f3e7700966a786b7f377368744affc
parent7700c2d4f79c423f29a5c2c10ca5a9b9c8c5c60f (diff)
OMAPDSS: AnalogTV: Add ops
Add "ops" style method for using analog TV functionality. Ops style calls will allow us to have arbitrarily long display pipelines, where each entity can call ops in the previous display entity. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--drivers/video/omap2/dss/venc.c72
-rw-r--r--include/video/omapdss.h26
2 files changed, 98 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index e47b64eee62c..496a106fe823 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -564,6 +564,16 @@ int omapdss_venc_check_timings(struct omap_dss_device *dssdev,
564 return -EINVAL; 564 return -EINVAL;
565} 565}
566 566
567static void venc_get_timings(struct omap_dss_device *dssdev,
568 struct omap_video_timings *timings)
569{
570 mutex_lock(&venc.venc_lock);
571
572 *timings = venc.timings;
573
574 mutex_unlock(&venc.venc_lock);
575}
576
567u32 omapdss_venc_get_wss(struct omap_dss_device *dssdev) 577u32 omapdss_venc_get_wss(struct omap_dss_device *dssdev)
568{ 578{
569 /* Invert due to VENC_L21_WC_CTL:INV=1 */ 579 /* Invert due to VENC_L21_WC_CTL:INV=1 */
@@ -779,6 +789,67 @@ static int venc_probe_pdata(struct platform_device *vencdev)
779 return 0; 789 return 0;
780} 790}
781 791
792static int venc_connect(struct omap_dss_device *dssdev,
793 struct omap_dss_device *dst)
794{
795 struct omap_overlay_manager *mgr;
796 int r;
797
798 r = venc_init_regulator();
799 if (r)
800 return r;
801
802 mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel);
803 if (!mgr)
804 return -ENODEV;
805
806 r = dss_mgr_connect(mgr, dssdev);
807 if (r)
808 return r;
809
810 r = omapdss_output_set_device(dssdev, dst);
811 if (r) {
812 DSSERR("failed to connect output to new device: %s\n",
813 dst->name);
814 dss_mgr_disconnect(mgr, dssdev);
815 return r;
816 }
817
818 return 0;
819}
820
821static void venc_disconnect(struct omap_dss_device *dssdev,
822 struct omap_dss_device *dst)
823{
824 WARN_ON(dst != dssdev->device);
825
826 if (dst != dssdev->device)
827 return;
828
829 omapdss_output_unset_device(dssdev);
830
831 if (dssdev->manager)
832 dss_mgr_disconnect(dssdev->manager, dssdev);
833}
834
835static const struct omapdss_atv_ops venc_ops = {
836 .connect = venc_connect,
837 .disconnect = venc_disconnect,
838
839 .enable = omapdss_venc_display_enable,
840 .disable = omapdss_venc_display_disable,
841
842 .check_timings = omapdss_venc_check_timings,
843 .set_timings = omapdss_venc_set_timings,
844 .get_timings = venc_get_timings,
845
846 .set_type = omapdss_venc_set_type,
847 .invert_vid_out_polarity = omapdss_venc_invert_vid_out_polarity,
848
849 .set_wss = omapdss_venc_set_wss,
850 .get_wss = omapdss_venc_get_wss,
851};
852
782static void venc_init_output(struct platform_device *pdev) 853static void venc_init_output(struct platform_device *pdev)
783{ 854{
784 struct omap_dss_device *out = &venc.output; 855 struct omap_dss_device *out = &venc.output;
@@ -788,6 +859,7 @@ static void venc_init_output(struct platform_device *pdev)
788 out->output_type = OMAP_DISPLAY_TYPE_VENC; 859 out->output_type = OMAP_DISPLAY_TYPE_VENC;
789 out->name = "venc.0"; 860 out->name = "venc.0";
790 out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT; 861 out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
862 out->ops.atv = &venc_ops;
791 out->owner = THIS_MODULE; 863 out->owner = THIS_MODULE;
792 864
793 omapdss_register_output(out); 865 omapdss_register_output(out);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 3b3903fa1500..adb103633bd1 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -628,6 +628,31 @@ struct omapdss_dvi_ops {
628 struct omap_video_timings *timings); 628 struct omap_video_timings *timings);
629}; 629};
630 630
631struct omapdss_atv_ops {
632 int (*connect)(struct omap_dss_device *dssdev,
633 struct omap_dss_device *dst);
634 void (*disconnect)(struct omap_dss_device *dssdev,
635 struct omap_dss_device *dst);
636
637 int (*enable)(struct omap_dss_device *dssdev);
638 void (*disable)(struct omap_dss_device *dssdev);
639
640 int (*check_timings)(struct omap_dss_device *dssdev,
641 struct omap_video_timings *timings);
642 void (*set_timings)(struct omap_dss_device *dssdev,
643 struct omap_video_timings *timings);
644 void (*get_timings)(struct omap_dss_device *dssdev,
645 struct omap_video_timings *timings);
646
647 void (*set_type)(struct omap_dss_device *dssdev,
648 enum omap_dss_venc_type type);
649 void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
650 bool invert_polarity);
651
652 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
653 u32 (*get_wss)(struct omap_dss_device *dssdev);
654};
655
631struct omap_dss_device { 656struct omap_dss_device {
632 /* old device, to be removed */ 657 /* old device, to be removed */
633 struct device old_dev; 658 struct device old_dev;
@@ -697,6 +722,7 @@ struct omap_dss_device {
697 const struct omapdss_dpi_ops *dpi; 722 const struct omapdss_dpi_ops *dpi;
698 const struct omapdss_sdi_ops *sdi; 723 const struct omapdss_sdi_ops *sdi;
699 const struct omapdss_dvi_ops *dvi; 724 const struct omapdss_dvi_ops *dvi;
725 const struct omapdss_atv_ops *atv;
700 } ops; 726 } ops;
701 727
702 /* helper variable for driver suspend/resume */ 728 /* helper variable for driver suspend/resume */