aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos
diff options
context:
space:
mode:
authorInki Dae <inki.dae@samsung.com>2014-11-24 00:55:41 -0500
committerInki Dae <inki.dae@samsung.com>2014-11-24 21:58:37 -0500
commit1d50aa9c6fb01356238ec21039f145fc2d81f7e7 (patch)
tree061bc04658138c665d76cca63e156aa604dd3672 /drivers/gpu/drm/exynos
parent33e2192fb1e329c26847c92edbd90f7e93eecacf (diff)
drm/exynos: vidi: add component support
This patch adds component support for vidi driver. vidi driver is a kms driver so it doesn't need to be registered to exynos_drm_subdrv_list. For this, it changes for the component framework to be used for vidi driver. This patch fixes below error also, # echo 1 > /sys/devices/platform/exynos-drm-vidi/connection [ 55.618529] ------------[ cut here ]------------ [ 55.621960] WARNING: CPU: 0 PID: 1397 at drivers/gpu/drm/drm_irq.c:1203 exynos_drm_crtc_dpms+0x88/0x17c() [ 55.631268] Modules linked in: [ 55.634278] CPU: 0 PID: 1397 Comm: sh Not tainted 3.18.0-rc2-146253-g31449d7 #1154 [ 55.641885] [<c0014400>] (unwind_backtrace) from [<c0011570>] (show_stack+0x10/0x14) [ 55.649597] [<c0011570>] (show_stack) from [<c04764f4>] (dump_stack+0x84/0xc4) [ 55.656802] [<c04764f4>] (dump_stack) from [<c00218b8>] (warn_slowpath_common+0x6c/0x88) [ 55.664866] [<c00218b8>] (warn_slowpath_common) from [<c0021970>] (warn_slowpath_null+0x1c/0x24) [ 55.673632] [<c0021970>] (warn_slowpath_null) from [<c027a780>] (exynos_drm_crtc_dpms+0x88/0x17c) [ 55.682482] [<c027a780>] (exynos_drm_crtc_dpms) from [<c027a910>] (exynos_drm_crtc_commit+0x14/0x44) [ 55.691622] [<c027a910>] (exynos_drm_crtc_commit) from [<c025521c>] (drm_crtc_helper_set_mode+0x3d0/0x51c) [ 55.701233] [<c025521c>] (drm_crtc_helper_set_mode) from [<c0255d68>] (drm_crtc_helper_set_config+0x87c/0x9dc) [ 55.711230] [<c0255d68>] (drm_crtc_helper_set_config) from [<c026afa8>] (drm_mode_set_config_internal+0x58/0xd4) [ 55.721380] [<c026afa8>] (drm_mode_set_config_internal) from [<c025c208>] (restore_fbdev_mode+0xcc/0xec) [ 55.730834] [<c025c208>] (restore_fbdev_mode) from [<c025c244>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x30) [ 55.741424] [<c025c244>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c025e0a8>] (drm_fb_helper_set_par+0x1c/0x60) [ 55.752271] [<c025e0a8>] (drm_fb_helper_set_par) from [<c025e174>] (drm_fb_helper_hotplug_event+0x88/0xc4) [ 55.761906] [<c025e174>] (drm_fb_helper_hotplug_event) from [<c02571c4>] (drm_helper_hpd_irq_event+0xc8/0x134) [ 55.771898] [<c02571c4>] (drm_helper_hpd_irq_event) from [<c028e27c>] (vidi_store_connection+0x90/0xc8) [ 55.781268] [<c028e27c>] (vidi_store_connection) from [<c0125f80>] (kernfs_fop_write+0xc0/0x180) [ 55.790045] [<c0125f80>] (kernfs_fop_write) from [<c00cdf60>] (vfs_write+0xa0/0x1ac) [ 55.797757] [<c00cdf60>] (vfs_write) from [<c00ce468>] (SyS_write+0x44/0x9c) [ 55.804790] [<c00ce468>] (SyS_write) from [<c000e6a0>] (ret_fast_syscall+0x0/0x30) [ 55.812328] ---[ end trace 3c0fe4386702d4dd ]--- This issue occurs when modeset to vidi is tried in case that drm_vblank_init is called prior to crtc creation of vidi driver. In this case, crtc number of vidi is invalid so any requests with the crtc number will fail. This patch guarantees drm_vblank_init to be called after all kms drivers are ready by using component framework. Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm/exynos')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_vidi.c61
1 files changed, 45 insertions, 16 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index 3b6fdd614584..45899fb63272 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/component.h>
17 18
18#include <drm/exynos_drm.h> 19#include <drm/exynos_drm.h>
19 20
@@ -48,11 +49,11 @@ struct vidi_win_data {
48struct vidi_context { 49struct vidi_context {
49 struct exynos_drm_manager manager; 50 struct exynos_drm_manager manager;
50 struct exynos_drm_display display; 51 struct exynos_drm_display display;
52 struct platform_device *pdev;
51 struct drm_device *drm_dev; 53 struct drm_device *drm_dev;
52 struct drm_crtc *crtc; 54 struct drm_crtc *crtc;
53 struct drm_encoder *encoder; 55 struct drm_encoder *encoder;
54 struct drm_connector connector; 56 struct drm_connector connector;
55 struct exynos_drm_subdrv subdrv;
56 struct vidi_win_data win_data[WINDOWS_NR]; 57 struct vidi_win_data win_data[WINDOWS_NR];
57 struct edid *raw_edid; 58 struct edid *raw_edid;
58 unsigned int clkdiv; 59 unsigned int clkdiv;
@@ -560,9 +561,10 @@ static struct exynos_drm_display_ops vidi_display_ops = {
560 .create_connector = vidi_create_connector, 561 .create_connector = vidi_create_connector,
561}; 562};
562 563
563static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev) 564static int vidi_bind(struct device *dev, struct device *master, void *data)
564{ 565{
565 struct vidi_context *ctx = dev_get_drvdata(dev); 566 struct vidi_context *ctx = dev_get_drvdata(dev);
567 struct drm_device *drm_dev = data;
566 struct drm_crtc *crtc = ctx->crtc; 568 struct drm_crtc *crtc = ctx->crtc;
567 int ret; 569 int ret;
568 570
@@ -584,9 +586,18 @@ static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
584 return 0; 586 return 0;
585} 587}
586 588
589
590static void vidi_unbind(struct device *dev, struct device *master, void *data)
591{
592}
593
594static const struct component_ops vidi_component_ops = {
595 .bind = vidi_bind,
596 .unbind = vidi_unbind,
597};
598
587static int vidi_probe(struct platform_device *pdev) 599static int vidi_probe(struct platform_device *pdev)
588{ 600{
589 struct exynos_drm_subdrv *subdrv;
590 struct vidi_context *ctx; 601 struct vidi_context *ctx;
591 int ret; 602 int ret;
592 603
@@ -599,6 +610,17 @@ static int vidi_probe(struct platform_device *pdev)
599 ctx->display.type = EXYNOS_DISPLAY_TYPE_VIDI; 610 ctx->display.type = EXYNOS_DISPLAY_TYPE_VIDI;
600 ctx->display.ops = &vidi_display_ops; 611 ctx->display.ops = &vidi_display_ops;
601 ctx->default_win = 0; 612 ctx->default_win = 0;
613 ctx->pdev = pdev;
614
615 ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CRTC,
616 ctx->manager.type);
617 if (ret)
618 return ret;
619
620 ret = exynos_drm_component_add(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR,
621 ctx->display.type);
622 if (ret)
623 goto err_del_crtc_component;
602 624
603 INIT_WORK(&ctx->work, vidi_fake_vblank_handler); 625 INIT_WORK(&ctx->work, vidi_fake_vblank_handler);
604 626
@@ -606,23 +628,26 @@ static int vidi_probe(struct platform_device *pdev)
606 628
607 platform_set_drvdata(pdev, ctx); 629 platform_set_drvdata(pdev, ctx);
608 630
609 subdrv = &ctx->subdrv;
610 subdrv->dev = &pdev->dev;
611 subdrv->probe = vidi_subdrv_probe;
612
613 ret = exynos_drm_subdrv_register(subdrv);
614 if (ret < 0) {
615 dev_err(&pdev->dev, "failed to register drm vidi device\n");
616 return ret;
617 }
618
619 ret = device_create_file(&pdev->dev, &dev_attr_connection); 631 ret = device_create_file(&pdev->dev, &dev_attr_connection);
620 if (ret < 0) { 632 if (ret < 0) {
621 exynos_drm_subdrv_unregister(subdrv); 633 DRM_ERROR("failed to create connection sysfs.\n");
622 DRM_INFO("failed to create connection sysfs.\n"); 634 goto err_del_conn_component;
623 } 635 }
624 636
625 return 0; 637 ret = component_add(&pdev->dev, &vidi_component_ops);
638 if (ret)
639 goto err_remove_file;
640
641 return ret;
642
643err_remove_file:
644 device_remove_file(&pdev->dev, &dev_attr_connection);
645err_del_conn_component:
646 exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR);
647err_del_crtc_component:
648 exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CRTC);
649
650 return ret;
626} 651}
627 652
628static int vidi_remove(struct platform_device *pdev) 653static int vidi_remove(struct platform_device *pdev)
@@ -636,6 +661,10 @@ static int vidi_remove(struct platform_device *pdev)
636 return -EINVAL; 661 return -EINVAL;
637 } 662 }
638 663
664 component_del(&pdev->dev, &vidi_component_ops);
665 exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR);
666 exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CRTC);
667
639 return 0; 668 return 0;
640} 669}
641 670