diff mbox

[1/4] OMAPDSS: Add DT support to SDI

Message ID 1386958650-2404-2-git-send-email-sre@debian.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sebastian Reichel Dec. 13, 2013, 6:17 p.m. UTC
Add the code to make the SDI driver work with device tree on OMAP3.

Signed-off-by: Sebastian Reichel <sre@debian.org>
---
 drivers/video/omap2/dss/sdi.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox

Patch

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,
 	},
 };