diff options
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_hdmi.c')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_hdmi.c | 87 |
1 files changed, 4 insertions, 83 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index ed86bddf81da..14eb26b0ba1c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
@@ -38,7 +38,6 @@ struct drm_hdmi_context { | |||
38 | struct exynos_drm_subdrv subdrv; | 38 | struct exynos_drm_subdrv subdrv; |
39 | struct exynos_drm_hdmi_context *hdmi_ctx; | 39 | struct exynos_drm_hdmi_context *hdmi_ctx; |
40 | struct exynos_drm_hdmi_context *mixer_ctx; | 40 | struct exynos_drm_hdmi_context *mixer_ctx; |
41 | struct work_struct work; | ||
42 | }; | 41 | }; |
43 | 42 | ||
44 | void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | 43 | void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops |
@@ -49,7 +48,6 @@ void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | |||
49 | if (display_ops) | 48 | if (display_ops) |
50 | hdmi_display_ops = display_ops; | 49 | hdmi_display_ops = display_ops; |
51 | } | 50 | } |
52 | EXPORT_SYMBOL(exynos_drm_display_ops_register); | ||
53 | 51 | ||
54 | void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | 52 | void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops |
55 | *manager_ops) | 53 | *manager_ops) |
@@ -59,7 +57,6 @@ void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | |||
59 | if (manager_ops) | 57 | if (manager_ops) |
60 | hdmi_manager_ops = manager_ops; | 58 | hdmi_manager_ops = manager_ops; |
61 | } | 59 | } |
62 | EXPORT_SYMBOL(exynos_drm_manager_ops_register); | ||
63 | 60 | ||
64 | void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | 61 | void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops |
65 | *overlay_ops) | 62 | *overlay_ops) |
@@ -69,7 +66,6 @@ void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | |||
69 | if (overlay_ops) | 66 | if (overlay_ops) |
70 | hdmi_overlay_ops = overlay_ops; | 67 | hdmi_overlay_ops = overlay_ops; |
71 | } | 68 | } |
72 | EXPORT_SYMBOL(exynos_drm_overlay_ops_register); | ||
73 | 69 | ||
74 | static bool drm_hdmi_is_connected(struct device *dev) | 70 | static bool drm_hdmi_is_connected(struct device *dev) |
75 | { | 71 | { |
@@ -277,7 +273,6 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev, | |||
277 | struct drm_hdmi_context *ctx; | 273 | struct drm_hdmi_context *ctx; |
278 | struct platform_device *pdev = to_platform_device(dev); | 274 | struct platform_device *pdev = to_platform_device(dev); |
279 | struct exynos_drm_common_hdmi_pd *pd; | 275 | struct exynos_drm_common_hdmi_pd *pd; |
280 | int ret; | ||
281 | 276 | ||
282 | DRM_DEBUG_KMS("%s\n", __FILE__); | 277 | DRM_DEBUG_KMS("%s\n", __FILE__); |
283 | 278 | ||
@@ -298,26 +293,13 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev, | |||
298 | return -EFAULT; | 293 | return -EFAULT; |
299 | } | 294 | } |
300 | 295 | ||
301 | ret = platform_driver_register(&hdmi_driver); | ||
302 | if (ret) { | ||
303 | DRM_DEBUG_KMS("failed to register hdmi driver.\n"); | ||
304 | return ret; | ||
305 | } | ||
306 | |||
307 | ret = platform_driver_register(&mixer_driver); | ||
308 | if (ret) { | ||
309 | DRM_DEBUG_KMS("failed to register mixer driver.\n"); | ||
310 | goto err_hdmidrv; | ||
311 | } | ||
312 | |||
313 | ctx = get_ctx_from_subdrv(subdrv); | 296 | ctx = get_ctx_from_subdrv(subdrv); |
314 | 297 | ||
315 | ctx->hdmi_ctx = (struct exynos_drm_hdmi_context *) | 298 | ctx->hdmi_ctx = (struct exynos_drm_hdmi_context *) |
316 | to_context(pd->hdmi_dev); | 299 | to_context(pd->hdmi_dev); |
317 | if (!ctx->hdmi_ctx) { | 300 | if (!ctx->hdmi_ctx) { |
318 | DRM_DEBUG_KMS("hdmi context is null.\n"); | 301 | DRM_DEBUG_KMS("hdmi context is null.\n"); |
319 | ret = -EFAULT; | 302 | return -EFAULT; |
320 | goto err_mixerdrv; | ||
321 | } | 303 | } |
322 | 304 | ||
323 | ctx->hdmi_ctx->drm_dev = drm_dev; | 305 | ctx->hdmi_ctx->drm_dev = drm_dev; |
@@ -326,42 +308,12 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev, | |||
326 | to_context(pd->mixer_dev); | 308 | to_context(pd->mixer_dev); |
327 | if (!ctx->mixer_ctx) { | 309 | if (!ctx->mixer_ctx) { |
328 | DRM_DEBUG_KMS("mixer context is null.\n"); | 310 | DRM_DEBUG_KMS("mixer context is null.\n"); |
329 | ret = -EFAULT; | 311 | return -EFAULT; |
330 | goto err_mixerdrv; | ||
331 | } | 312 | } |
332 | 313 | ||
333 | ctx->mixer_ctx->drm_dev = drm_dev; | 314 | ctx->mixer_ctx->drm_dev = drm_dev; |
334 | 315 | ||
335 | return 0; | 316 | return 0; |
336 | |||
337 | err_mixerdrv: | ||
338 | platform_driver_unregister(&mixer_driver); | ||
339 | err_hdmidrv: | ||
340 | platform_driver_unregister(&hdmi_driver); | ||
341 | return ret; | ||
342 | } | ||
343 | |||
344 | static void hdmi_subdrv_remove(struct drm_device *drm_dev) | ||
345 | { | ||
346 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
347 | |||
348 | platform_driver_unregister(&hdmi_driver); | ||
349 | platform_driver_unregister(&mixer_driver); | ||
350 | } | ||
351 | |||
352 | static void exynos_drm_hdmi_late_probe(struct work_struct *work) | ||
353 | { | ||
354 | struct drm_hdmi_context *ctx = container_of(work, | ||
355 | struct drm_hdmi_context, work); | ||
356 | |||
357 | /* | ||
358 | * this function calls subdrv->probe() so this must be called | ||
359 | * after probe context. | ||
360 | * | ||
361 | * PS. subdrv->probe() will call platform_driver_register() to probe | ||
362 | * hdmi and mixer driver. | ||
363 | */ | ||
364 | exynos_drm_subdrv_register(&ctx->subdrv); | ||
365 | } | 317 | } |
366 | 318 | ||
367 | static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) | 319 | static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) |
@@ -381,7 +333,6 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) | |||
381 | subdrv = &ctx->subdrv; | 333 | subdrv = &ctx->subdrv; |
382 | 334 | ||
383 | subdrv->probe = hdmi_subdrv_probe; | 335 | subdrv->probe = hdmi_subdrv_probe; |
384 | subdrv->remove = hdmi_subdrv_remove; | ||
385 | subdrv->manager.pipe = -1; | 336 | subdrv->manager.pipe = -1; |
386 | subdrv->manager.ops = &drm_hdmi_manager_ops; | 337 | subdrv->manager.ops = &drm_hdmi_manager_ops; |
387 | subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops; | 338 | subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops; |
@@ -390,9 +341,7 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) | |||
390 | 341 | ||
391 | platform_set_drvdata(pdev, subdrv); | 342 | platform_set_drvdata(pdev, subdrv); |
392 | 343 | ||
393 | INIT_WORK(&ctx->work, exynos_drm_hdmi_late_probe); | 344 | exynos_drm_subdrv_register(subdrv); |
394 | |||
395 | schedule_work(&ctx->work); | ||
396 | 345 | ||
397 | return 0; | 346 | return 0; |
398 | } | 347 | } |
@@ -428,7 +377,7 @@ static int __devexit exynos_drm_hdmi_remove(struct platform_device *pdev) | |||
428 | return 0; | 377 | return 0; |
429 | } | 378 | } |
430 | 379 | ||
431 | static struct platform_driver exynos_drm_common_hdmi_driver = { | 380 | struct platform_driver exynos_drm_common_hdmi_driver = { |
432 | .probe = exynos_drm_hdmi_probe, | 381 | .probe = exynos_drm_hdmi_probe, |
433 | .remove = __devexit_p(exynos_drm_hdmi_remove), | 382 | .remove = __devexit_p(exynos_drm_hdmi_remove), |
434 | .driver = { | 383 | .driver = { |
@@ -437,31 +386,3 @@ static struct platform_driver exynos_drm_common_hdmi_driver = { | |||
437 | .pm = &hdmi_pm_ops, | 386 | .pm = &hdmi_pm_ops, |
438 | }, | 387 | }, |
439 | }; | 388 | }; |
440 | |||
441 | static int __init exynos_drm_hdmi_init(void) | ||
442 | { | ||
443 | int ret; | ||
444 | |||
445 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
446 | |||
447 | ret = platform_driver_register(&exynos_drm_common_hdmi_driver); | ||
448 | if (ret) { | ||
449 | DRM_DEBUG_KMS("failed to register hdmi common driver.\n"); | ||
450 | return ret; | ||
451 | } | ||
452 | |||
453 | return ret; | ||
454 | } | ||
455 | |||
456 | static void __exit exynos_drm_hdmi_exit(void) | ||
457 | { | ||
458 | platform_driver_unregister(&exynos_drm_common_hdmi_driver); | ||
459 | } | ||
460 | |||
461 | module_init(exynos_drm_hdmi_init); | ||
462 | module_exit(exynos_drm_hdmi_exit); | ||
463 | |||
464 | MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>"); | ||
465 | MODULE_AUTHOR("Seung-Woo Kim, <sw0312.kim@samsung.com>"); | ||
466 | MODULE_DESCRIPTION("Samsung SoC DRM HDMI Driver"); | ||
467 | MODULE_LICENSE("GPL"); | ||