diff options
Diffstat (limited to 'arch/arm/mach-omap2/display.c')
-rw-r--r-- | arch/arm/mach-omap2/display.c | 111 |
1 files changed, 53 insertions, 58 deletions
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 9500b6e27380..f86b72d1d59e 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -209,11 +209,61 @@ static int __init omapdss_init_fbdev(void) | |||
209 | 209 | ||
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | #else | 212 | |
213 | static inline int omapdss_init_fbdev(void) | 213 | static const char * const omapdss_compat_names[] __initconst = { |
214 | "ti,omap2-dss", | ||
215 | "ti,omap3-dss", | ||
216 | "ti,omap4-dss", | ||
217 | "ti,omap5-dss", | ||
218 | "ti,dra7-dss", | ||
219 | }; | ||
220 | |||
221 | static struct device_node * __init omapdss_find_dss_of_node(void) | ||
214 | { | 222 | { |
215 | return 0; | 223 | struct device_node *node; |
224 | int i; | ||
225 | |||
226 | for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) { | ||
227 | node = of_find_compatible_node(NULL, NULL, | ||
228 | omapdss_compat_names[i]); | ||
229 | if (node) | ||
230 | return node; | ||
231 | } | ||
232 | |||
233 | return NULL; | ||
216 | } | 234 | } |
235 | |||
236 | static int __init omapdss_init_of(void) | ||
237 | { | ||
238 | int r; | ||
239 | struct device_node *node; | ||
240 | struct platform_device *pdev; | ||
241 | |||
242 | /* only create dss helper devices if dss is enabled in the .dts */ | ||
243 | |||
244 | node = omapdss_find_dss_of_node(); | ||
245 | if (!node) | ||
246 | return 0; | ||
247 | |||
248 | if (!of_device_is_available(node)) | ||
249 | return 0; | ||
250 | |||
251 | pdev = of_find_device_by_node(node); | ||
252 | |||
253 | if (!pdev) { | ||
254 | pr_err("Unable to find DSS platform device\n"); | ||
255 | return -ENODEV; | ||
256 | } | ||
257 | |||
258 | r = of_platform_populate(node, NULL, NULL, &pdev->dev); | ||
259 | if (r) { | ||
260 | pr_err("Unable to populate DSS submodule devices\n"); | ||
261 | return r; | ||
262 | } | ||
263 | |||
264 | return omapdss_init_fbdev(); | ||
265 | } | ||
266 | omap_device_initcall(omapdss_init_of); | ||
217 | #endif /* CONFIG_FB_OMAP2 */ | 267 | #endif /* CONFIG_FB_OMAP2 */ |
218 | 268 | ||
219 | static void dispc_disable_outputs(void) | 269 | static void dispc_disable_outputs(void) |
@@ -361,58 +411,3 @@ int omap_dss_reset(struct omap_hwmod *oh) | |||
361 | 411 | ||
362 | return r; | 412 | return r; |
363 | } | 413 | } |
364 | |||
365 | static const char * const omapdss_compat_names[] __initconst = { | ||
366 | "ti,omap2-dss", | ||
367 | "ti,omap3-dss", | ||
368 | "ti,omap4-dss", | ||
369 | "ti,omap5-dss", | ||
370 | "ti,dra7-dss", | ||
371 | }; | ||
372 | |||
373 | static struct device_node * __init omapdss_find_dss_of_node(void) | ||
374 | { | ||
375 | struct device_node *node; | ||
376 | int i; | ||
377 | |||
378 | for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) { | ||
379 | node = of_find_compatible_node(NULL, NULL, | ||
380 | omapdss_compat_names[i]); | ||
381 | if (node) | ||
382 | return node; | ||
383 | } | ||
384 | |||
385 | return NULL; | ||
386 | } | ||
387 | |||
388 | static int __init omapdss_init_of(void) | ||
389 | { | ||
390 | int r; | ||
391 | struct device_node *node; | ||
392 | struct platform_device *pdev; | ||
393 | |||
394 | /* only create dss helper devices if dss is enabled in the .dts */ | ||
395 | |||
396 | node = omapdss_find_dss_of_node(); | ||
397 | if (!node) | ||
398 | return 0; | ||
399 | |||
400 | if (!of_device_is_available(node)) | ||
401 | return 0; | ||
402 | |||
403 | pdev = of_find_device_by_node(node); | ||
404 | |||
405 | if (!pdev) { | ||
406 | pr_err("Unable to find DSS platform device\n"); | ||
407 | return -ENODEV; | ||
408 | } | ||
409 | |||
410 | r = of_platform_populate(node, NULL, NULL, &pdev->dev); | ||
411 | if (r) { | ||
412 | pr_err("Unable to populate DSS submodule devices\n"); | ||
413 | return r; | ||
414 | } | ||
415 | |||
416 | return omapdss_init_fbdev(); | ||
417 | } | ||
418 | omap_device_initcall(omapdss_init_of); | ||