diff options
-rw-r--r-- | arch/arm/mach-omap2/display.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 5369bf13652b..40c135696007 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -243,6 +243,46 @@ err: | |||
243 | return ERR_PTR(r); | 243 | return ERR_PTR(r); |
244 | } | 244 | } |
245 | 245 | ||
246 | static struct platform_device *create_simple_dss_pdev(const char *pdev_name, | ||
247 | int pdev_id, void *pdata, int pdata_len, | ||
248 | struct platform_device *parent) | ||
249 | { | ||
250 | struct platform_device *pdev; | ||
251 | int r; | ||
252 | |||
253 | pdev = platform_device_alloc(pdev_name, pdev_id); | ||
254 | if (!pdev) { | ||
255 | pr_err("Could not create pdev for %s\n", pdev_name); | ||
256 | r = -ENOMEM; | ||
257 | goto err; | ||
258 | } | ||
259 | |||
260 | if (parent != NULL) | ||
261 | pdev->dev.parent = &parent->dev; | ||
262 | |||
263 | if (pdev->id != -1) | ||
264 | dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); | ||
265 | else | ||
266 | dev_set_name(&pdev->dev, "%s", pdev->name); | ||
267 | |||
268 | r = platform_device_add_data(pdev, pdata, pdata_len); | ||
269 | if (r) { | ||
270 | pr_err("Could not set pdata for %s\n", pdev_name); | ||
271 | goto err; | ||
272 | } | ||
273 | |||
274 | r = omap_device_register(pdev); | ||
275 | if (r) { | ||
276 | pr_err("Could not register omap_device for %s\n", pdev_name); | ||
277 | goto err; | ||
278 | } | ||
279 | |||
280 | return pdev; | ||
281 | |||
282 | err: | ||
283 | return ERR_PTR(r); | ||
284 | } | ||
285 | |||
246 | int __init omap_display_init(struct omap_dss_board_info *board_data) | 286 | int __init omap_display_init(struct omap_dss_board_info *board_data) |
247 | { | 287 | { |
248 | int r = 0; | 288 | int r = 0; |
@@ -312,6 +352,23 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) | |||
312 | } | 352 | } |
313 | } | 353 | } |
314 | 354 | ||
355 | /* Create devices for DPI and SDI */ | ||
356 | |||
357 | pdev = create_simple_dss_pdev("omapdss_dpi", -1, NULL, 0, dss_pdev); | ||
358 | if (IS_ERR(pdev)) { | ||
359 | pr_err("Could not build platform_device for omapdss_dpi\n"); | ||
360 | return PTR_ERR(pdev); | ||
361 | } | ||
362 | |||
363 | if (cpu_is_omap34xx()) { | ||
364 | pdev = create_simple_dss_pdev("omapdss_sdi", -1, NULL, 0, | ||
365 | dss_pdev); | ||
366 | if (IS_ERR(pdev)) { | ||
367 | pr_err("Could not build platform_device for omapdss_sdi\n"); | ||
368 | return PTR_ERR(pdev); | ||
369 | } | ||
370 | } | ||
371 | |||
315 | return 0; | 372 | return 0; |
316 | } | 373 | } |
317 | 374 | ||