From 81cb8ff1d21e854b642131ee782d6f7bfb394567 Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
Date: Tue, 21 Aug 2012 15:35:06 +0300
Subject: [PATCH 08/23] OMAPDSS: Add DT support to DSS, DISPC, DPI, HDMI, VENC

Add the code to make DSS, DISPC, DPI, HDMI and VENC drivers work with
device tree on OMAP3 and OMAP4. The only change is adding the
of_match_tables.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/omap2/dss/dispc.c |    7 +++++++
 drivers/video/omap2/dss/dpi.c   |    8 ++++++++
 drivers/video/omap2/dss/dss.c   |   10 ++++++++++
 drivers/video/omap2/dss/hdmi.c  |    6 ++++++
 drivers/video/omap2/dss/venc.c  |    7 +++++++
 5 files changed, 38 insertions(+)

Index: linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/dispc.c
===================================================================
--- linux-3.12.6-rt9-r7s6.orig/drivers/video/omap2/dss/dispc.c
+++ linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/dispc.c
@@ -3744,12 +3744,19 @@ static const struct dev_pm_ops dispc_pm_
 	.runtime_resume = dispc_runtime_resume,
 };
 
+static const struct of_device_id dispc_of_match[] = {
+	{ .compatible = "ti,omap3-dispc", },
+	{ .compatible = "ti,omap4-dispc", },
+	{},
+};
+
 static struct platform_driver omap_dispchw_driver = {
 	.remove         = __exit_p(omap_dispchw_remove),
 	.driver         = {
 		.name   = "omapdss_dispc",
 		.owner  = THIS_MODULE,
 		.pm	= &dispc_pm_ops,
+		.of_match_table = dispc_of_match,
 	},
 };
 
Index: linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/dpi.c
===================================================================
--- linux-3.12.6-rt9-r7s6.orig/drivers/video/omap2/dss/dpi.c
+++ linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/dpi.c
@@ -30,6 +30,7 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/string.h>
+#include <linux/of.h>
 
 #include <video/omapdss.h>
 
@@ -708,12 +709,19 @@ static int __exit omap_dpi_remove(struct
 	return 0;
 }
 
+static const struct of_device_id dpi_of_match[] = {
+	{ .compatible = "ti,omap3-dpi", },
+	{ .compatible = "ti,omap4-dpi", },
+	{},
+};
+
 static struct platform_driver omap_dpi_driver = {
 	.probe		= omap_dpi_probe,
 	.remove         = __exit_p(omap_dpi_remove),
 	.driver         = {
 		.name   = "omapdss_dpi",
 		.owner  = THIS_MODULE,
+		.of_match_table = dpi_of_match,
 	},
 };
 
Index: linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/dss.c
===================================================================
--- linux-3.12.6-rt9-r7s6.orig/drivers/video/omap2/dss/dss.c
+++ linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/dss.c
@@ -23,6 +23,7 @@
 #define DSS_SUBSYS_NAME "DSS"
 
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/io.h>
 #include <linux/export.h>
 #include <linux/err.h>
@@ -955,12 +956,21 @@ static const struct dev_pm_ops dss_pm_op
 	.runtime_resume = dss_runtime_resume,
 };
 
+static const struct of_device_id dss_of_match[] = {
+	{ .compatible = "ti,omap3-dss", },
+	{ .compatible = "ti,omap4-dss", },
+	{},
+};
+
+MODULE_DEVICE_TABLE(of, dss_of_match);
+
 static struct platform_driver omap_dsshw_driver = {
 	.remove         = __exit_p(omap_dsshw_remove),
 	.driver         = {
 		.name   = "omapdss_dss",
 		.owner  = THIS_MODULE,
 		.pm	= &dss_pm_ops,
+		.of_match_table = dss_of_match,
 	},
 };
 
Index: linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/hdmi.c
===================================================================
--- linux-3.12.6-rt9-r7s6.orig/drivers/video/omap2/dss/hdmi.c
+++ linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/hdmi.c
@@ -1158,6 +1158,11 @@ static const struct dev_pm_ops hdmi_pm_o
 	.runtime_resume = hdmi_runtime_resume,
 };
 
+static const struct of_device_id hdmi_of_match[] = {
+	{ .compatible = "ti,omap4-hdmi", },
+	{},
+};
+
 static struct platform_driver omapdss_hdmihw_driver = {
 	.probe		= omapdss_hdmihw_probe,
 	.remove         = __exit_p(omapdss_hdmihw_remove),
@@ -1165,6 +1170,7 @@ static struct platform_driver omapdss_hd
 		.name   = "omapdss_hdmi",
 		.owner  = THIS_MODULE,
 		.pm	= &hdmi_pm_ops,
+		.of_match_table = hdmi_of_match,
 	},
 };
 
Index: linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/venc.c
===================================================================
--- linux-3.12.6-rt9-r7s6.orig/drivers/video/omap2/dss/venc.c
+++ linux-3.12.6-rt9-r7s6/drivers/video/omap2/dss/venc.c
@@ -894,6 +894,12 @@ static const struct dev_pm_ops venc_pm_o
 	.runtime_resume = venc_runtime_resume,
 };
 
+
+static const struct of_device_id venc_of_match[] = {
+	{ .compatible = "ti,omap3-venc", },
+	{},
+};
+
 static struct platform_driver omap_venchw_driver = {
 	.probe		= omap_venchw_probe,
 	.remove         = __exit_p(omap_venchw_remove),
@@ -901,6 +907,7 @@ static struct platform_driver omap_vench
 		.name   = "omapdss_venc",
 		.owner  = THIS_MODULE,
 		.pm	= &venc_pm_ops,
+		.of_match_table = venc_of_match,
 	},
 };