drm/komeda: Initialize and enable output polling on Komeda
authorLowry Li (Arm Technology China) <Lowry.Li@arm.com>
Fri, 2 Aug 2019 08:07:52 +0000 (08:07 +0000)
committerjames qian wang (Arm Technology China) <james.qian.wang@arm.com>
Fri, 9 Aug 2019 06:56:54 +0000 (14:56 +0800)
Initialize and enable output polling on Komeda.

Changes since v1:
1. Enable the polling before registering the driver;
2. Disable the polling after unregistering the driver.

Changes since v2:
1. If driver register failed, disable the polling.

Signed-off-by: Lowry Li (Arm Technology China) <lowry.li@arm.com>
Reviewed-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Signed-off-by: james qian wang (Arm Technology China) <james.qian.wang@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1564733249-24329-1-git-send-email-lowry.li@arm.com
drivers/gpu/drm/arm/display/komeda/komeda_kms.c

index 419a8b0e5de8f2fe96be3d9e022e73405eb406f2..d50e75f0b2bdce5c5bdf3daa6dcfcdff2f5e0c2a 100644 (file)
@@ -15,6 +15,7 @@
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_irq.h>
 #include <drm/drm_vblank.h>
+#include <drm/drm_probe_helper.h>
 
 #include "komeda_dev.h"
 #include "komeda_framebuffer.h"
@@ -315,6 +316,8 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
 
        drm->irq_enabled = true;
 
+       drm_kms_helper_poll_init(drm);
+
        err = drm_dev_register(drm, 0);
        if (err)
                goto cleanup_mode_config;
@@ -322,6 +325,7 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
        return kms;
 
 cleanup_mode_config:
+       drm_kms_helper_poll_fini(drm);
        drm->irq_enabled = false;
        drm_mode_config_cleanup(drm);
        komeda_kms_cleanup_private_objs(kms);
@@ -338,6 +342,7 @@ void komeda_kms_detach(struct komeda_kms_dev *kms)
        drm->irq_enabled = false;
        mdev->funcs->disable_irq(mdev);
        drm_dev_unregister(drm);
+       drm_kms_helper_poll_fini(drm);
        component_unbind_all(mdev->dev, drm);
        komeda_kms_cleanup_private_objs(kms);
        drm_mode_config_cleanup(drm);