Commit a2207021 authored by Tomi Valkeinen's avatar Tomi Valkeinen

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: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarArchit Taneja <archit@ti.com>
parent 0465616d
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/of.h>
#include <video/omapdss.h> #include <video/omapdss.h>
...@@ -808,6 +809,48 @@ static void __exit venc_uninit_output(struct platform_device *pdev) ...@@ -808,6 +809,48 @@ static void __exit venc_uninit_output(struct platform_device *pdev)
omapdss_unregister_output(out); omapdss_unregister_output(out);
} }
static int venc_probe_of(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
struct device_node *ep;
u32 channels;
int r;
ep = omapdss_of_get_first_endpoint(node);
if (!ep)
return 0;
venc.invert_polarity = of_property_read_bool(ep, "ti,invert-polarity");
r = of_property_read_u32(ep, "ti,channels", &channels);
if (r) {
dev_err(&pdev->dev,
"failed to read property 'ti,channels': %d\n", r);
goto err;
}
switch (channels) {
case 1:
venc.type = OMAP_DSS_VENC_TYPE_COMPOSITE;
break;
case 2:
venc.type = OMAP_DSS_VENC_TYPE_SVIDEO;
break;
default:
dev_err(&pdev->dev, "bad channel propert '%d'\n", channels);
r = -EINVAL;
goto err;
}
of_node_put(ep);
return 0;
err:
of_node_put(ep);
return 0;
}
/* VENC HW IP initialisation */ /* VENC HW IP initialisation */
static int omap_venchw_probe(struct platform_device *pdev) static int omap_venchw_probe(struct platform_device *pdev)
{ {
...@@ -849,12 +892,21 @@ static int omap_venchw_probe(struct platform_device *pdev) ...@@ -849,12 +892,21 @@ static int omap_venchw_probe(struct platform_device *pdev)
venc_runtime_put(); venc_runtime_put();
if (pdev->dev.of_node) {
r = venc_probe_of(pdev);
if (r) {
DSSERR("Invalid DT data\n");
goto err_probe_of;
}
}
dss_debugfs_create_file("venc", venc_dump_regs); dss_debugfs_create_file("venc", venc_dump_regs);
venc_init_output(pdev); venc_init_output(pdev);
return 0; return 0;
err_probe_of:
err_runtime_get: err_runtime_get:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return r; return r;
...@@ -898,6 +950,14 @@ static const struct dev_pm_ops venc_pm_ops = { ...@@ -898,6 +950,14 @@ static const struct dev_pm_ops venc_pm_ops = {
.runtime_resume = venc_runtime_resume, .runtime_resume = venc_runtime_resume,
}; };
static const struct of_device_id venc_of_match[] = {
{ .compatible = "ti,omap2-venc", },
{ .compatible = "ti,omap3-venc", },
{ .compatible = "ti,omap4-venc", },
{},
};
static struct platform_driver omap_venchw_driver = { static struct platform_driver omap_venchw_driver = {
.probe = omap_venchw_probe, .probe = omap_venchw_probe,
.remove = __exit_p(omap_venchw_remove), .remove = __exit_p(omap_venchw_remove),
...@@ -905,6 +965,7 @@ static struct platform_driver omap_venchw_driver = { ...@@ -905,6 +965,7 @@ static struct platform_driver omap_venchw_driver = {
.name = "omapdss_venc", .name = "omapdss_venc",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &venc_pm_ops, .pm = &venc_pm_ops,
.of_match_table = venc_of_match,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment