Skip to content

Commit 14c615d

Browse files
author
Thomas Zimmermann
committed
drm/radeon: 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: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 5fc40f4 commit 14c615d

File tree

3 files changed

+37
-15
lines changed

3 files changed

+37
-15
lines changed

drivers/gpu/drm/radeon/radeon_drv.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
607607
.postclose = radeon_driver_postclose_kms,
608608
.lastclose = radeon_driver_lastclose_kms,
609609
.unload = radeon_driver_unload_kms,
610-
.irq_preinstall = radeon_driver_irq_preinstall_kms,
611-
.irq_postinstall = radeon_driver_irq_postinstall_kms,
612-
.irq_uninstall = radeon_driver_irq_uninstall_kms,
613-
.irq_handler = radeon_driver_irq_handler_kms,
614610
.ioctls = radeon_ioctls_kms,
615611
.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
616612
.dumb_create = radeon_mode_dumb_create,

drivers/gpu/drm/radeon/radeon_irq_kms.c

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#include <drm/drm_crtc_helper.h>
3333
#include <drm/drm_device.h>
34-
#include <drm/drm_irq.h>
34+
#include <drm/drm_drv.h>
3535
#include <drm/drm_probe_helper.h>
3636
#include <drm/drm_vblank.h>
3737
#include <drm/radeon_drm.h>
@@ -51,7 +51,7 @@
5151
* radeon_irq_process is a macro that points to the per-asic
5252
* irq handler callback.
5353
*/
54-
irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
54+
static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
5555
{
5656
struct drm_device *dev = (struct drm_device *) arg;
5757
struct radeon_device *rdev = dev->dev_private;
@@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
118118
* Gets the hw ready to enable irqs (all asics).
119119
* This function disables all interrupt sources on the GPU.
120120
*/
121-
void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
121+
static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
122122
{
123123
struct radeon_device *rdev = dev->dev_private;
124124
unsigned long irqflags;
@@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
150150
* Handles stuff to be done after enabling irqs (all asics).
151151
* Returns 0 on success.
152152
*/
153-
int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
153+
static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
154154
{
155155
struct radeon_device *rdev = dev->dev_private;
156156

@@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
169169
*
170170
* This function disables all interrupt sources on the GPU (all asics).
171171
*/
172-
void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
172+
static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
173173
{
174174
struct radeon_device *rdev = dev->dev_private;
175175
unsigned long irqflags;
@@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
194194
spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
195195
}
196196

197+
static int radeon_irq_install(struct radeon_device *rdev, int irq)
198+
{
199+
struct drm_device *dev = rdev->ddev;
200+
int ret;
201+
202+
if (irq == IRQ_NOTCONNECTED)
203+
return -ENOTCONN;
204+
205+
radeon_driver_irq_preinstall_kms(dev);
206+
207+
/* PCI devices require shared interrupts. */
208+
ret = request_irq(irq, radeon_driver_irq_handler_kms,
209+
IRQF_SHARED, dev->driver->name, dev);
210+
if (ret)
211+
return ret;
212+
213+
radeon_driver_irq_postinstall_kms(dev);
214+
215+
return 0;
216+
}
217+
218+
static void radeon_irq_uninstall(struct radeon_device *rdev)
219+
{
220+
struct drm_device *dev = rdev->ddev;
221+
struct pci_dev *pdev = to_pci_dev(dev->dev);
222+
223+
radeon_driver_irq_uninstall_kms(dev);
224+
free_irq(pdev->irq, dev);
225+
}
226+
197227
/**
198228
* radeon_msi_ok - asic specific msi checks
199229
*
@@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
314344
INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
315345

316346
rdev->irq.installed = true;
317-
r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
347+
r = radeon_irq_install(rdev, rdev->pdev->irq);
318348
if (r) {
319349
rdev->irq.installed = false;
320350
flush_delayed_work(&rdev->hotplug_work);
@@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
335365
void radeon_irq_kms_fini(struct radeon_device *rdev)
336366
{
337367
if (rdev->irq.installed) {
338-
drm_irq_uninstall(rdev->ddev);
368+
radeon_irq_uninstall(rdev);
339369
rdev->irq.installed = false;
340370
if (rdev->msi_enabled)
341371
pci_disable_msi(rdev->pdev);

drivers/gpu/drm/radeon/radeon_kms.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,5 @@
3131
u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
3232
int radeon_enable_vblank_kms(struct drm_crtc *crtc);
3333
void radeon_disable_vblank_kms(struct drm_crtc *crtc);
34-
irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
35-
void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
36-
int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
37-
void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
3834

3935
#endif /* __RADEON_KMS_H__ */

0 commit comments

Comments
 (0)