DRM: move irq request after crtc created.
authorsky zhou <sky.zhou@amlogic.com>
Thu, 21 Jun 2018 04:49:06 +0000 (12:49 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 2 Jul 2018 08:32:52 +0000 (01:32 -0700)
PD#168985: fix vblank irq panic when crtc not created.

Change-Id: I369a8a0159549001ae0ef216391be730664a4690
Signed-off-by: sky zhou <sky.zhou@amlogic.com>
drivers/amlogic/drm/am_meson_vpu.c

index 3e5c323..10a9543 100644 (file)
@@ -732,20 +732,6 @@ static int am_meson_vpu_bind(struct device *dev,
 
        dev_set_drvdata(dev, amcrtc);
 
-       irq = platform_get_irq(pdev, 0);
-       if (irq < 0) {
-               dev_err(dev, "cannot find irq for vpu\n");
-               return irq;
-       }
-       amcrtc->irq = (unsigned int)irq;
-
-       ret = devm_request_irq(dev, amcrtc->irq, am_meson_vpu_irq,
-               IRQF_SHARED, dev_name(dev), drm_dev);
-       if (ret)
-               return ret;
-       /* IRQ is initially disabled; it gets enabled in crtc_enable */
-       disable_irq(amcrtc->irq);
-
        /* init reserved memory */
        ret = of_reserved_mem_device_init(&pdev->dev);
        if (ret != 0)
@@ -782,6 +768,22 @@ static int am_meson_vpu_bind(struct device *dev,
                return ret;
 
        am_meson_register_crtc_funcs(private->crtc, &meson_private_crtc_funcs);
+
+       /*vsync irq.*/
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+               dev_err(dev, "cannot find irq for vpu\n");
+               return irq;
+       }
+       amcrtc->irq = (unsigned int)irq;
+
+       ret = devm_request_irq(dev, amcrtc->irq, am_meson_vpu_irq,
+               IRQF_SHARED, dev_name(dev), drm_dev);
+       if (ret)
+               return ret;
+       /* IRQ is initially disabled; it gets enabled in crtc_enable */
+       disable_irq(amcrtc->irq);
+
        INIT_DELAYED_WORK(&osd_dwork, mem_free_work);
        schedule_delayed_work(&osd_dwork, msecs_to_jiffies(60 * 1000));