drm/tidss: Convert to Linux IRQ interfaces
authorThomas Zimmermann <tzimmermann@suse.de>
Tue, 3 Aug 2021 09:07:00 +0000 (11:07 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 10 Aug 2021 18:13:49 +0000 (20:13 +0200)
Drop the DRM IRQ midlayer in favor of Linux IRQ interfaces. DRM's
IRQ helpers are mostly useful for UMS drivers. Modern KMS drivers
don't benefit from using it.

DRM IRQ callbacks are now being called directly or inlined.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210803090704.32152-11-tzimmermann@suse.de
drivers/gpu/drm/tidss/tidss_drv.c
drivers/gpu/drm/tidss/tidss_drv.h
drivers/gpu/drm/tidss/tidss_irq.c
drivers/gpu/drm/tidss/tidss_irq.h

index 66e3c86eb5c7d6ea6a27cb7d58c0099a8154e89e..d620f35688da86a5b811440a16895372bf1c5c1e 100644 (file)
@@ -16,7 +16,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
-#include <drm/drm_irq.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
 
@@ -118,11 +117,6 @@ static const struct drm_driver tidss_driver = {
        .date                   = "20180215",
        .major                  = 1,
        .minor                  = 0,
-
-       .irq_preinstall         = tidss_irq_preinstall,
-       .irq_postinstall        = tidss_irq_postinstall,
-       .irq_handler            = tidss_irq_handler,
-       .irq_uninstall          = tidss_irq_uninstall,
 };
 
 static int tidss_probe(struct platform_device *pdev)
@@ -172,10 +166,11 @@ static int tidss_probe(struct platform_device *pdev)
                ret = irq;
                goto err_runtime_suspend;
        }
+       tidss->irq = irq;
 
-       ret = drm_irq_install(ddev, irq);
+       ret = tidss_irq_install(ddev, irq);
        if (ret) {
-               dev_err(dev, "drm_irq_install failed: %d\n", ret);
+               dev_err(dev, "tidss_irq_install failed: %d\n", ret);
                goto err_runtime_suspend;
        }
 
@@ -196,7 +191,7 @@ static int tidss_probe(struct platform_device *pdev)
        return 0;
 
 err_irq_uninstall:
-       drm_irq_uninstall(ddev);
+       tidss_irq_uninstall(ddev);
 
 err_runtime_suspend:
 #ifndef CONFIG_PM
@@ -219,7 +214,7 @@ static int tidss_remove(struct platform_device *pdev)
 
        drm_atomic_helper_shutdown(ddev);
 
-       drm_irq_uninstall(ddev);
+       tidss_irq_uninstall(ddev);
 
 #ifndef CONFIG_PM
        /* If we don't have PM, we need to call suspend manually */
index 7de4bba52e6fa67d7689a7bff79778dcb0ab2ba2..d7f27b0b031583902be3661fcb052d7b75aa4da9 100644 (file)
@@ -27,6 +27,8 @@ struct tidss_device {
        unsigned int num_planes;
        struct drm_plane *planes[TIDSS_MAX_PLANES];
 
+       unsigned int irq;
+
        spinlock_t wait_lock;   /* protects the irq masks */
        dispc_irq_t irq_mask;   /* enabled irqs in addition to wait_list */
 };
index 2ed3e32967766c366ea97275d84b6c443adae057..0c681c7600bcb290afc0eae3c626ed9c943bc85a 100644 (file)
@@ -4,6 +4,9 @@
  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  */
 
+#include <linux/platform_device.h>
+
+#include <drm/drm_drv.h>
 #include <drm/drm_print.h>
 
 #include "tidss_crtc.h"
@@ -50,7 +53,7 @@ void tidss_irq_disable_vblank(struct drm_crtc *crtc)
        spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-irqreturn_t tidss_irq_handler(int irq, void *arg)
+static irqreturn_t tidss_irq_handler(int irq, void *arg)
 {
        struct drm_device *ddev = (struct drm_device *)arg;
        struct tidss_device *tidss = to_tidss(ddev);
@@ -90,7 +93,7 @@ void tidss_irq_resume(struct tidss_device *tidss)
        spin_unlock_irqrestore(&tidss->wait_lock, flags);
 }
 
-void tidss_irq_preinstall(struct drm_device *ddev)
+static void tidss_irq_preinstall(struct drm_device *ddev)
 {
        struct tidss_device *tidss = to_tidss(ddev);
 
@@ -104,7 +107,7 @@ void tidss_irq_preinstall(struct drm_device *ddev)
        tidss_runtime_put(tidss);
 }
 
-int tidss_irq_postinstall(struct drm_device *ddev)
+static void tidss_irq_postinstall(struct drm_device *ddev)
 {
        struct tidss_device *tidss = to_tidss(ddev);
        unsigned long flags;
@@ -129,6 +132,22 @@ int tidss_irq_postinstall(struct drm_device *ddev)
        spin_unlock_irqrestore(&tidss->wait_lock, flags);
 
        tidss_runtime_put(tidss);
+}
+
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq)
+{
+       int ret;
+
+       if (irq == IRQ_NOTCONNECTED)
+               return -ENOTCONN;
+
+       tidss_irq_preinstall(ddev);
+
+       ret = request_irq(irq, tidss_irq_handler, 0, ddev->driver->name, ddev);
+       if (ret)
+               return ret;
+
+       tidss_irq_postinstall(ddev);
 
        return 0;
 }
@@ -140,4 +159,6 @@ void tidss_irq_uninstall(struct drm_device *ddev)
        tidss_runtime_get(tidss);
        dispc_set_irqenable(tidss->dispc, 0);
        tidss_runtime_put(tidss);
+
+       free_irq(tidss->irq, ddev);
 }
index 4aaad5dfd7c25fdc9af83ac4702621507cf55efd..b512614d58633cbc14dc40c23c561d96d961f293 100644 (file)
@@ -67,10 +67,8 @@ struct tidss_device;
 void tidss_irq_enable_vblank(struct drm_crtc *crtc);
 void tidss_irq_disable_vblank(struct drm_crtc *crtc);
 
-void tidss_irq_preinstall(struct drm_device *ddev);
-int tidss_irq_postinstall(struct drm_device *ddev);
+int tidss_irq_install(struct drm_device *ddev, unsigned int irq);
 void tidss_irq_uninstall(struct drm_device *ddev);
-irqreturn_t tidss_irq_handler(int irq, void *arg);
 
 void tidss_irq_resume(struct tidss_device *tidss);