Add the code to make the SDI driver work with device tree on OMAP3.

Signed-off-by: Sebastian Reichel <[email protected]>
---
 drivers/video/omap2/dss/sdi.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index ccc569a..bdc6a68 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -26,6 +26,8 @@
 #include <linux/export.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
 
 #include <video/omapdss.h>
 #include "dss.h"
@@ -333,6 +335,9 @@ static const struct omapdss_sdi_ops sdi_ops = {
 
 static void sdi_init_output(struct platform_device *pdev)
 {
+       struct device_node *node = pdev->dev.of_node;
+       struct device_node *ep;
+
        struct omap_dss_device *out = &sdi.output;
 
        out->dev = &pdev->dev;
@@ -344,6 +349,15 @@ static void sdi_init_output(struct platform_device *pdev)
        out->owner = THIS_MODULE;
 
        omapdss_register_output(out);
+
+       if (!pdev->dev.of_node)
+               return;
+
+       ep = omapdss_of_get_first_endpoint(node);
+       if (!ep)
+               return;
+
+       of_property_read_u32(ep, "data-lines", &sdi.datapairs);
 }
 
 static void __exit sdi_uninit_output(struct platform_device *pdev)
@@ -369,12 +383,18 @@ static int __exit omap_sdi_remove(struct platform_device 
*pdev)
        return 0;
 }
 
+static const struct of_device_id sdi_of_match[] = {
+       { .compatible = "ti,omap3-sdi" },
+       {},
+};
+
 static struct platform_driver omap_sdi_driver = {
        .probe          = omap_sdi_probe,
        .remove         = __exit_p(omap_sdi_remove),
        .driver         = {
                .name   = "omapdss_sdi",
                .owner  = THIS_MODULE,
+               .of_match_table = sdi_of_match,
        },
 };
 
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to