aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos
diff options
context:
space:
mode:
authorInki Dae <inki.dae@samsung.com>2014-09-11 04:04:03 -0400
committerInki Dae <daeinki@gmail.com>2014-09-19 11:56:13 -0400
commit53c5558d95f544864a09372a8ffeffac55e60b7c (patch)
treee1e4d53caf67381f7f360207678372976c86228c /drivers/gpu/drm/exynos
parent18383cb92f0d19e76e0374e573067e627cab9c92 (diff)
drm/exynos: update to use component match support
Update Exynos's DRM driver to use component match support rater than add_components. Changelog v2: - release devices and drivers if failed. - change compare_of to compare_dev. Signed-off-by: Inki Dae <inki.dae@samsung.com> Tested-by: Andrzej Hajda <a.hajda@samsung.com>
Diffstat (limited to 'drivers/gpu/drm/exynos')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 5aae95cf5b23..3f6ec9670659 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -486,21 +486,20 @@ void exynos_drm_component_del(struct device *dev,
486 mutex_unlock(&drm_component_lock); 486 mutex_unlock(&drm_component_lock);
487} 487}
488 488
489static int compare_of(struct device *dev, void *data) 489static int compare_dev(struct device *dev, void *data)
490{ 490{
491 return dev == (struct device *)data; 491 return dev == (struct device *)data;
492} 492}
493 493
494static int exynos_drm_add_components(struct device *dev, struct master *m) 494static struct component_match *exynos_drm_match_add(struct device *dev)
495{ 495{
496 struct component_match *match = NULL;
496 struct component_dev *cdev; 497 struct component_dev *cdev;
497 unsigned int attach_cnt = 0; 498 unsigned int attach_cnt = 0;
498 499
499 mutex_lock(&drm_component_lock); 500 mutex_lock(&drm_component_lock);
500 501
501 list_for_each_entry(cdev, &drm_component_list, list) { 502 list_for_each_entry(cdev, &drm_component_list, list) {
502 int ret;
503
504 /* 503 /*
505 * Add components to master only in case that crtc and 504 * Add components to master only in case that crtc and
506 * encoder/connector device objects exist. 505 * encoder/connector device objects exist.
@@ -515,16 +514,10 @@ static int exynos_drm_add_components(struct device *dev, struct master *m)
515 /* 514 /*
516 * fimd and dpi modules have same device object so add 515 * fimd and dpi modules have same device object so add
517 * only crtc device object in this case. 516 * only crtc device object in this case.
518 *
519 * TODO. if dpi module follows driver-model driver then
520 * below codes can be removed.
521 */ 517 */
522 if (cdev->crtc_dev == cdev->conn_dev) { 518 if (cdev->crtc_dev == cdev->conn_dev) {
523 ret = component_master_add_child(m, compare_of, 519 component_match_add(dev, &match, compare_dev,
524 cdev->crtc_dev); 520 cdev->crtc_dev);
525 if (ret < 0)
526 return ret;
527
528 goto out_lock; 521 goto out_lock;
529 } 522 }
530 523
@@ -534,11 +527,8 @@ static int exynos_drm_add_components(struct device *dev, struct master *m)
534 * connector/encoder need pipe number of crtc when they 527 * connector/encoder need pipe number of crtc when they
535 * are created. 528 * are created.
536 */ 529 */
537 ret = component_master_add_child(m, compare_of, cdev->crtc_dev); 530 component_match_add(dev, &match, compare_dev, cdev->crtc_dev);
538 ret |= component_master_add_child(m, compare_of, 531 component_match_add(dev, &match, compare_dev, cdev->conn_dev);
539 cdev->conn_dev);
540 if (ret < 0)
541 return ret;
542 532
543out_lock: 533out_lock:
544 mutex_lock(&drm_component_lock); 534 mutex_lock(&drm_component_lock);
@@ -546,7 +536,7 @@ out_lock:
546 536
547 mutex_unlock(&drm_component_lock); 537 mutex_unlock(&drm_component_lock);
548 538
549 return attach_cnt ? 0 : -ENODEV; 539 return attach_cnt ? match : ERR_PTR(-EPROBE_DEFER);
550} 540}
551 541
552static int exynos_drm_bind(struct device *dev) 542static int exynos_drm_bind(struct device *dev)
@@ -560,13 +550,13 @@ static void exynos_drm_unbind(struct device *dev)
560} 550}
561 551
562static const struct component_master_ops exynos_drm_ops = { 552static const struct component_master_ops exynos_drm_ops = {
563 .add_components = exynos_drm_add_components,
564 .bind = exynos_drm_bind, 553 .bind = exynos_drm_bind,
565 .unbind = exynos_drm_unbind, 554 .unbind = exynos_drm_unbind,
566}; 555};
567 556
568static int exynos_drm_platform_probe(struct platform_device *pdev) 557static int exynos_drm_platform_probe(struct platform_device *pdev)
569{ 558{
559 struct component_match *match;
570 int ret; 560 int ret;
571 561
572 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 562 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
@@ -633,13 +623,23 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
633 goto err_unregister_ipp_drv; 623 goto err_unregister_ipp_drv;
634#endif 624#endif
635 625
636 ret = component_master_add(&pdev->dev, &exynos_drm_ops); 626 match = exynos_drm_match_add(&pdev->dev);
627 if (IS_ERR(match)) {
628 ret = PTR_ERR(match);
629 goto err_unregister_resources;
630 }
631
632 ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops,
633 match);
637 if (ret < 0) 634 if (ret < 0)
638 DRM_DEBUG_KMS("re-tried by last sub driver probed later.\n"); 635 goto err_unregister_resources;
639 636
640 return 0; 637 return ret;
638
639err_unregister_resources:
641 640
642#ifdef CONFIG_DRM_EXYNOS_IPP 641#ifdef CONFIG_DRM_EXYNOS_IPP
642 exynos_platform_device_ipp_unregister();
643err_unregister_ipp_drv: 643err_unregister_ipp_drv:
644 platform_driver_unregister(&ipp_driver); 644 platform_driver_unregister(&ipp_driver);
645err_unregister_gsc_drv: 645err_unregister_gsc_drv: