| .. | .. |
|---|
| 51 | 51 | * OTHER DEALINGS IN THE SOFTWARE. |
|---|
| 52 | 52 | */ |
|---|
| 53 | 53 | |
|---|
| 54 | | -#include <drm/drm_irq.h> |
|---|
| 55 | | -#include <drm/drmP.h> |
|---|
| 56 | 54 | |
|---|
| 57 | | -#include <linux/interrupt.h> /* For task queue support */ |
|---|
| 58 | | - |
|---|
| 59 | | -#include <linux/vgaarb.h> |
|---|
| 60 | 55 | #include <linux/export.h> |
|---|
| 56 | +#include <linux/interrupt.h> /* For task queue support */ |
|---|
| 57 | +#include <linux/pci.h> |
|---|
| 58 | +#include <linux/vgaarb.h> |
|---|
| 59 | + |
|---|
| 60 | +#include <drm/drm.h> |
|---|
| 61 | +#include <drm/drm_device.h> |
|---|
| 62 | +#include <drm/drm_drv.h> |
|---|
| 63 | +#include <drm/drm_irq.h> |
|---|
| 64 | +#include <drm/drm_print.h> |
|---|
| 65 | +#include <drm/drm_vblank.h> |
|---|
| 61 | 66 | |
|---|
| 62 | 67 | #include "drm_internal.h" |
|---|
| 63 | 68 | |
|---|
| .. | .. |
|---|
| 103 | 108 | int ret; |
|---|
| 104 | 109 | unsigned long sh_flags = 0; |
|---|
| 105 | 110 | |
|---|
| 106 | | - if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) |
|---|
| 107 | | - return -EINVAL; |
|---|
| 108 | | - |
|---|
| 109 | 111 | if (irq == 0) |
|---|
| 110 | | - return -EINVAL; |
|---|
| 111 | | - |
|---|
| 112 | | - /* Driver must have been initialized */ |
|---|
| 113 | | - if (!dev->dev_private) |
|---|
| 114 | 112 | return -EINVAL; |
|---|
| 115 | 113 | |
|---|
| 116 | 114 | if (dev->irq_enabled) |
|---|
| .. | .. |
|---|
| 123 | 121 | if (dev->driver->irq_preinstall) |
|---|
| 124 | 122 | dev->driver->irq_preinstall(dev); |
|---|
| 125 | 123 | |
|---|
| 126 | | - /* Install handler */ |
|---|
| 127 | | - if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) |
|---|
| 124 | + /* PCI devices require shared interrupts. */ |
|---|
| 125 | + if (dev->pdev) |
|---|
| 128 | 126 | sh_flags = IRQF_SHARED; |
|---|
| 129 | 127 | |
|---|
| 130 | 128 | ret = request_irq(irq, dev->driver->irq_handler, |
|---|
| .. | .. |
|---|
| 174 | 172 | bool irq_enabled; |
|---|
| 175 | 173 | int i; |
|---|
| 176 | 174 | |
|---|
| 177 | | - if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) |
|---|
| 178 | | - return -EINVAL; |
|---|
| 179 | | - |
|---|
| 180 | 175 | irq_enabled = dev->irq_enabled; |
|---|
| 181 | 176 | dev->irq_enabled = false; |
|---|
| 182 | 177 | |
|---|
| .. | .. |
|---|
| 186 | 181 | * vblank/irq handling. KMS drivers must ensure that vblanks are all |
|---|
| 187 | 182 | * disabled when uninstalling the irq handler. |
|---|
| 188 | 183 | */ |
|---|
| 189 | | - if (dev->num_crtcs) { |
|---|
| 184 | + if (drm_dev_has_vblank(dev)) { |
|---|
| 190 | 185 | spin_lock_irqsave(&dev->vbl_lock, irqflags); |
|---|
| 191 | 186 | for (i = 0; i < dev->num_crtcs; i++) { |
|---|
| 192 | 187 | struct drm_vblank_crtc *vblank = &dev->vblank[i]; |
|---|
| .. | .. |
|---|
| 219 | 214 | } |
|---|
| 220 | 215 | EXPORT_SYMBOL(drm_irq_uninstall); |
|---|
| 221 | 216 | |
|---|
| 217 | +#if IS_ENABLED(CONFIG_DRM_LEGACY) |
|---|
| 222 | 218 | int drm_legacy_irq_control(struct drm_device *dev, void *data, |
|---|
| 223 | 219 | struct drm_file *file_priv) |
|---|
| 224 | 220 | { |
|---|
| .. | .. |
|---|
| 259 | 255 | return -EINVAL; |
|---|
| 260 | 256 | } |
|---|
| 261 | 257 | } |
|---|
| 258 | +#endif |
|---|