diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2012-12-14 01:48:25 -0500 |
---|---|---|
committer | Inki Dae <daeinki@gmail.com> | 2012-12-14 12:28:40 -0500 |
commit | d636ead86fb806085de4ce98693e8d91c419d8f3 (patch) | |
tree | 5672402ca111d756fd3221019857dbc4d10dcc00 | |
parent | ca555e5ab701d00bd91a541778f5aa432d18d478 (diff) |
drm/exynos: support device tree for fimd
This adds the of_match_table to exynos-drm fimd driver to be probed from
the device tree.
Changelog v2:
- fix build error without CONFIG_OF.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimd.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 1e4ea96bbe3e..bf0d9baca2bc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
20 | #include <linux/of_device.h> | ||
20 | #include <linux/pm_runtime.h> | 21 | #include <linux/pm_runtime.h> |
21 | 22 | ||
22 | #include <video/samsung_fimd.h> | 23 | #include <video/samsung_fimd.h> |
@@ -106,9 +107,28 @@ struct fimd_context { | |||
106 | struct exynos_drm_panel_info *panel; | 107 | struct exynos_drm_panel_info *panel; |
107 | }; | 108 | }; |
108 | 109 | ||
110 | #ifdef CONFIG_OF | ||
111 | static const struct of_device_id fimd_driver_dt_match[] = { | ||
112 | { .compatible = "samsung,exynos4-fimd", | ||
113 | .data = &exynos4_fimd_driver_data }, | ||
114 | { .compatible = "samsung,exynos5-fimd", | ||
115 | .data = &exynos5_fimd_driver_data }, | ||
116 | {}, | ||
117 | }; | ||
118 | MODULE_DEVICE_TABLE(of, fimd_driver_dt_match); | ||
119 | #endif | ||
120 | |||
109 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( | 121 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( |
110 | struct platform_device *pdev) | 122 | struct platform_device *pdev) |
111 | { | 123 | { |
124 | #ifdef CONFIG_OF | ||
125 | const struct of_device_id *of_id = | ||
126 | of_match_device(fimd_driver_dt_match, &pdev->dev); | ||
127 | |||
128 | if (of_id) | ||
129 | return (struct fimd_driver_data *)of_id->data; | ||
130 | #endif | ||
131 | |||
112 | return (struct fimd_driver_data *) | 132 | return (struct fimd_driver_data *) |
113 | platform_get_device_id(pdev)->driver_data; | 133 | platform_get_device_id(pdev)->driver_data; |
114 | } | 134 | } |
@@ -1091,5 +1111,6 @@ struct platform_driver fimd_driver = { | |||
1091 | .name = "exynos4-fb", | 1111 | .name = "exynos4-fb", |
1092 | .owner = THIS_MODULE, | 1112 | .owner = THIS_MODULE, |
1093 | .pm = &fimd_pm_ops, | 1113 | .pm = &fimd_pm_ops, |
1114 | .of_match_table = of_match_ptr(fimd_driver_dt_match), | ||
1094 | }, | 1115 | }, |
1095 | }; | 1116 | }; |