Skip to content

Commit 5518572

Browse files
author
Thomas Zimmermann
committed
drm/tidss: Convert to Linux IRQ interfaces
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 <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Acked-by: Sam Ravnborg <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 14c615d commit 5518572

File tree

4 files changed

+32
-16
lines changed

4 files changed

+32
-16
lines changed

drivers/gpu/drm/tidss/tidss_drv.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <drm/drm_drv.h>
1717
#include <drm/drm_fb_helper.h>
1818
#include <drm/drm_gem_cma_helper.h>
19-
#include <drm/drm_irq.h>
2019
#include <drm/drm_managed.h>
2120
#include <drm/drm_probe_helper.h>
2221

@@ -118,11 +117,6 @@ static const struct drm_driver tidss_driver = {
118117
.date = "20180215",
119118
.major = 1,
120119
.minor = 0,
121-
122-
.irq_preinstall = tidss_irq_preinstall,
123-
.irq_postinstall = tidss_irq_postinstall,
124-
.irq_handler = tidss_irq_handler,
125-
.irq_uninstall = tidss_irq_uninstall,
126120
};
127121

128122
static int tidss_probe(struct platform_device *pdev)
@@ -172,10 +166,11 @@ static int tidss_probe(struct platform_device *pdev)
172166
ret = irq;
173167
goto err_runtime_suspend;
174168
}
169+
tidss->irq = irq;
175170

176-
ret = drm_irq_install(ddev, irq);
171+
ret = tidss_irq_install(ddev, irq);
177172
if (ret) {
178-
dev_err(dev, "drm_irq_install failed: %d\n", ret);
173+
dev_err(dev, "tidss_irq_install failed: %d\n", ret);
179174
goto err_runtime_suspend;
180175
}
181176

@@ -196,7 +191,7 @@ static int tidss_probe(struct platform_device *pdev)
196191
return 0;
197192

198193
err_irq_uninstall:
199-
drm_irq_uninstall(ddev);
194+
tidss_irq_uninstall(ddev);
200195

201196
err_runtime_suspend:
202197
#ifndef CONFIG_PM
@@ -219,7 +214,7 @@ static int tidss_remove(struct platform_device *pdev)
219214

220215
drm_atomic_helper_shutdown(ddev);
221216

222-
drm_irq_uninstall(ddev);
217+
tidss_irq_uninstall(ddev);
223218

224219
#ifndef CONFIG_PM
225220
/* If we don't have PM, we need to call suspend manually */

drivers/gpu/drm/tidss/tidss_drv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ struct tidss_device {
2727
unsigned int num_planes;
2828
struct drm_plane *planes[TIDSS_MAX_PLANES];
2929

30+
unsigned int irq;
31+
3032
spinlock_t wait_lock; /* protects the irq masks */
3133
dispc_irq_t irq_mask; /* enabled irqs in addition to wait_list */
3234
};

drivers/gpu/drm/tidss/tidss_irq.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* Author: Tomi Valkeinen <[email protected]>
55
*/
66

7+
#include <linux/platform_device.h>
8+
9+
#include <drm/drm_drv.h>
710
#include <drm/drm_print.h>
811

912
#include "tidss_crtc.h"
@@ -50,7 +53,7 @@ void tidss_irq_disable_vblank(struct drm_crtc *crtc)
5053
spin_unlock_irqrestore(&tidss->wait_lock, flags);
5154
}
5255

53-
irqreturn_t tidss_irq_handler(int irq, void *arg)
56+
static irqreturn_t tidss_irq_handler(int irq, void *arg)
5457
{
5558
struct drm_device *ddev = (struct drm_device *)arg;
5659
struct tidss_device *tidss = to_tidss(ddev);
@@ -90,7 +93,7 @@ void tidss_irq_resume(struct tidss_device *tidss)
9093
spin_unlock_irqrestore(&tidss->wait_lock, flags);
9194
}
9295

93-
void tidss_irq_preinstall(struct drm_device *ddev)
96+
static void tidss_irq_preinstall(struct drm_device *ddev)
9497
{
9598
struct tidss_device *tidss = to_tidss(ddev);
9699

@@ -104,7 +107,7 @@ void tidss_irq_preinstall(struct drm_device *ddev)
104107
tidss_runtime_put(tidss);
105108
}
106109

107-
int tidss_irq_postinstall(struct drm_device *ddev)
110+
static void tidss_irq_postinstall(struct drm_device *ddev)
108111
{
109112
struct tidss_device *tidss = to_tidss(ddev);
110113
unsigned long flags;
@@ -129,6 +132,22 @@ int tidss_irq_postinstall(struct drm_device *ddev)
129132
spin_unlock_irqrestore(&tidss->wait_lock, flags);
130133

131134
tidss_runtime_put(tidss);
135+
}
136+
137+
int tidss_irq_install(struct drm_device *ddev, unsigned int irq)
138+
{
139+
int ret;
140+
141+
if (irq == IRQ_NOTCONNECTED)
142+
return -ENOTCONN;
143+
144+
tidss_irq_preinstall(ddev);
145+
146+
ret = request_irq(irq, tidss_irq_handler, 0, ddev->driver->name, ddev);
147+
if (ret)
148+
return ret;
149+
150+
tidss_irq_postinstall(ddev);
132151

133152
return 0;
134153
}
@@ -140,4 +159,6 @@ void tidss_irq_uninstall(struct drm_device *ddev)
140159
tidss_runtime_get(tidss);
141160
dispc_set_irqenable(tidss->dispc, 0);
142161
tidss_runtime_put(tidss);
162+
163+
free_irq(tidss->irq, ddev);
143164
}

drivers/gpu/drm/tidss/tidss_irq.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ struct tidss_device;
6767
void tidss_irq_enable_vblank(struct drm_crtc *crtc);
6868
void tidss_irq_disable_vblank(struct drm_crtc *crtc);
6969

70-
void tidss_irq_preinstall(struct drm_device *ddev);
71-
int tidss_irq_postinstall(struct drm_device *ddev);
70+
int tidss_irq_install(struct drm_device *ddev, unsigned int irq);
7271
void tidss_irq_uninstall(struct drm_device *ddev);
73-
irqreturn_t tidss_irq_handler(int irq, void *arg);
7472

7573
void tidss_irq_resume(struct tidss_device *tidss);
7674

0 commit comments

Comments
 (0)