[PATCH 4/4] drm/exynos: support device tree for fimd

2012-12-14 Thread Joonyoung Shim
This adds the of_match_table to exynos-drm fimd driver to be probed from
the device tree.

Signed-off-by: Joonyoung Shim 
Signed-off-by: Kyungmin Park 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 1e4ea96..21a4f12 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #include 
@@ -106,9 +107,26 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+#ifdef CONFIG_OF
+static const struct of_device_id fimd_driver_dt_match[] = {
+   { .compatible = "samsung,exynos4-fimd",
+ .data = _fimd_driver_data },
+   { .compatible = "samsung,exynos5-fimd",
+ .data = _fimd_driver_data },
+   {},
+};
+MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
+#endif
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+   const struct of_device_id *of_id =
+   of_match_device(fimd_driver_dt_match, >dev);
+
+   if (of_id)
+   return (struct fimd_driver_data *)of_id->data;
+
return (struct fimd_driver_data *)
platform_get_device_id(pdev)->driver_data;
 }
@@ -1091,5 +1109,6 @@ struct platform_driver fimd_driver = {
.name   = "exynos4-fb",
.owner  = THIS_MODULE,
.pm = _pm_ops,
+   .of_match_table = of_match_ptr(fimd_driver_dt_match),
},
 };
-- 
1.7.9.5



[PATCH 4/4] drm/exynos: support device tree for fimd

2012-12-13 Thread Joonyoung Shim
This adds the of_match_table to exynos-drm fimd driver to be probed from
the device tree.

Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 1e4ea96..21a4f12 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -17,6 +17,7 @@
 #include linux/module.h
 #include linux/platform_device.h
 #include linux/clk.h
+#include linux/of_device.h
 #include linux/pm_runtime.h
 
 #include video/samsung_fimd.h
@@ -106,9 +107,26 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+#ifdef CONFIG_OF
+static const struct of_device_id fimd_driver_dt_match[] = {
+   { .compatible = samsung,exynos4-fimd,
+ .data = exynos4_fimd_driver_data },
+   { .compatible = samsung,exynos5-fimd,
+ .data = exynos5_fimd_driver_data },
+   {},
+};
+MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
+#endif
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+   const struct of_device_id *of_id =
+   of_match_device(fimd_driver_dt_match, pdev-dev);
+
+   if (of_id)
+   return (struct fimd_driver_data *)of_id-data;
+
return (struct fimd_driver_data *)
platform_get_device_id(pdev)-driver_data;
 }
@@ -1091,5 +1109,6 @@ struct platform_driver fimd_driver = {
.name   = exynos4-fb,
.owner  = THIS_MODULE,
.pm = fimd_pm_ops,
+   .of_match_table = of_match_ptr(fimd_driver_dt_match),
},
 };
-- 
1.7.9.5

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel