aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-12-16 08:14:15 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-03-19 05:03:08 -0400
commita2207021f22d74cc0485042e296b016a2199e443 (patch)
tree84ce5eee0c35c11d635a4b31a4bb8e5dc9f0f7a5 /drivers/video
parent0465616d34e928ed0041f37b507cb1fa0b41372d (diff)
OMAPDSS: Add DT support to VENC
Add DT support to VENC. In contrast to non-DT version, the DT version gets the invert-polarity and connector type via venc's endpoint, not from the connector. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/venc.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 7d40e52ad6d1..fc7069a24515 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -34,6 +34,7 @@
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/regulator/consumer.h> 35#include <linux/regulator/consumer.h>
36#include <linux/pm_runtime.h> 36#include <linux/pm_runtime.h>
37#include <linux/of.h>
37 38
38#include <video/omapdss.h> 39#include <video/omapdss.h>
39 40
@@ -808,6 +809,48 @@ static void __exit venc_uninit_output(struct platform_device *pdev)
808 omapdss_unregister_output(out); 809 omapdss_unregister_output(out);
809} 810}
810 811
812static int venc_probe_of(struct platform_device *pdev)
813{
814 struct device_node *node = pdev->dev.of_node;
815 struct device_node *ep;
816 u32 channels;
817 int r;
818
819 ep = omapdss_of_get_first_endpoint(node);
820 if (!ep)
821 return 0;
822
823 venc.invert_polarity = of_property_read_bool(ep, "ti,invert-polarity");
824
825 r = of_property_read_u32(ep, "ti,channels", &channels);
826 if (r) {
827 dev_err(&pdev->dev,
828 "failed to read property 'ti,channels': %d\n", r);
829 goto err;
830 }
831
832 switch (channels) {
833 case 1:
834 venc.type = OMAP_DSS_VENC_TYPE_COMPOSITE;
835 break;
836 case 2:
837 venc.type = OMAP_DSS_VENC_TYPE_SVIDEO;
838 break;
839 default:
840 dev_err(&pdev->dev, "bad channel propert '%d'\n", channels);
841 r = -EINVAL;
842 goto err;
843 }
844
845 of_node_put(ep);
846
847 return 0;
848err:
849 of_node_put(ep);
850
851 return 0;
852}
853
811/* VENC HW IP initialisation */ 854/* VENC HW IP initialisation */
812static int omap_venchw_probe(struct platform_device *pdev) 855static int omap_venchw_probe(struct platform_device *pdev)
813{ 856{
@@ -849,12 +892,21 @@ static int omap_venchw_probe(struct platform_device *pdev)
849 892
850 venc_runtime_put(); 893 venc_runtime_put();
851 894
895 if (pdev->dev.of_node) {
896 r = venc_probe_of(pdev);
897 if (r) {
898 DSSERR("Invalid DT data\n");
899 goto err_probe_of;
900 }
901 }
902
852 dss_debugfs_create_file("venc", venc_dump_regs); 903 dss_debugfs_create_file("venc", venc_dump_regs);
853 904
854 venc_init_output(pdev); 905 venc_init_output(pdev);
855 906
856 return 0; 907 return 0;
857 908
909err_probe_of:
858err_runtime_get: 910err_runtime_get:
859 pm_runtime_disable(&pdev->dev); 911 pm_runtime_disable(&pdev->dev);
860 return r; 912 return r;
@@ -898,6 +950,14 @@ static const struct dev_pm_ops venc_pm_ops = {
898 .runtime_resume = venc_runtime_resume, 950 .runtime_resume = venc_runtime_resume,
899}; 951};
900 952
953
954static const struct of_device_id venc_of_match[] = {
955 { .compatible = "ti,omap2-venc", },
956 { .compatible = "ti,omap3-venc", },
957 { .compatible = "ti,omap4-venc", },
958 {},
959};
960
901static struct platform_driver omap_venchw_driver = { 961static struct platform_driver omap_venchw_driver = {
902 .probe = omap_venchw_probe, 962 .probe = omap_venchw_probe,
903 .remove = __exit_p(omap_venchw_remove), 963 .remove = __exit_p(omap_venchw_remove),
@@ -905,6 +965,7 @@ static struct platform_driver omap_venchw_driver = {
905 .name = "omapdss_venc", 965 .name = "omapdss_venc",
906 .owner = THIS_MODULE, 966 .owner = THIS_MODULE,
907 .pm = &venc_pm_ops, 967 .pm = &venc_pm_ops,
968 .of_match_table = venc_of_match,
908 }, 969 },
909}; 970};
910 971