mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 20:48:49 +08:00
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 <tzimmermann@suse.de> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210803090704.32152-10-tzimmermann@suse.de
This commit is contained in:
parent
5fc40f41c1
commit
14c615d828
@ -607,10 +607,6 @@ static const struct drm_driver kms_driver = {
|
|||||||
.postclose = radeon_driver_postclose_kms,
|
.postclose = radeon_driver_postclose_kms,
|
||||||
.lastclose = radeon_driver_lastclose_kms,
|
.lastclose = radeon_driver_lastclose_kms,
|
||||||
.unload = radeon_driver_unload_kms,
|
.unload = radeon_driver_unload_kms,
|
||||||
.irq_preinstall = radeon_driver_irq_preinstall_kms,
|
|
||||||
.irq_postinstall = radeon_driver_irq_postinstall_kms,
|
|
||||||
.irq_uninstall = radeon_driver_irq_uninstall_kms,
|
|
||||||
.irq_handler = radeon_driver_irq_handler_kms,
|
|
||||||
.ioctls = radeon_ioctls_kms,
|
.ioctls = radeon_ioctls_kms,
|
||||||
.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
|
.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
|
||||||
.dumb_create = radeon_mode_dumb_create,
|
.dumb_create = radeon_mode_dumb_create,
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <drm/drm_crtc_helper.h>
|
#include <drm/drm_crtc_helper.h>
|
||||||
#include <drm/drm_device.h>
|
#include <drm/drm_device.h>
|
||||||
#include <drm/drm_irq.h>
|
#include <drm/drm_drv.h>
|
||||||
#include <drm/drm_probe_helper.h>
|
#include <drm/drm_probe_helper.h>
|
||||||
#include <drm/drm_vblank.h>
|
#include <drm/drm_vblank.h>
|
||||||
#include <drm/radeon_drm.h>
|
#include <drm/radeon_drm.h>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
* radeon_irq_process is a macro that points to the per-asic
|
* radeon_irq_process is a macro that points to the per-asic
|
||||||
* irq handler callback.
|
* irq handler callback.
|
||||||
*/
|
*/
|
||||||
irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
|
static irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = (struct drm_device *) arg;
|
struct drm_device *dev = (struct drm_device *) arg;
|
||||||
struct radeon_device *rdev = dev->dev_private;
|
struct radeon_device *rdev = dev->dev_private;
|
||||||
@ -118,7 +118,7 @@ static void radeon_dp_work_func(struct work_struct *work)
|
|||||||
* Gets the hw ready to enable irqs (all asics).
|
* Gets the hw ready to enable irqs (all asics).
|
||||||
* This function disables all interrupt sources on the GPU.
|
* This function disables all interrupt sources on the GPU.
|
||||||
*/
|
*/
|
||||||
void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
|
static void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct radeon_device *rdev = dev->dev_private;
|
struct radeon_device *rdev = dev->dev_private;
|
||||||
unsigned long irqflags;
|
unsigned long irqflags;
|
||||||
@ -150,7 +150,7 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
|
|||||||
* Handles stuff to be done after enabling irqs (all asics).
|
* Handles stuff to be done after enabling irqs (all asics).
|
||||||
* Returns 0 on success.
|
* Returns 0 on success.
|
||||||
*/
|
*/
|
||||||
int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
|
static int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct radeon_device *rdev = dev->dev_private;
|
struct radeon_device *rdev = dev->dev_private;
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ int radeon_driver_irq_postinstall_kms(struct drm_device *dev)
|
|||||||
*
|
*
|
||||||
* This function disables all interrupt sources on the GPU (all asics).
|
* This function disables all interrupt sources on the GPU (all asics).
|
||||||
*/
|
*/
|
||||||
void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
|
static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct radeon_device *rdev = dev->dev_private;
|
struct radeon_device *rdev = dev->dev_private;
|
||||||
unsigned long irqflags;
|
unsigned long irqflags;
|
||||||
@ -194,6 +194,36 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
|
|||||||
spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
|
spin_unlock_irqrestore(&rdev->irq.lock, irqflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int radeon_irq_install(struct radeon_device *rdev, int irq)
|
||||||
|
{
|
||||||
|
struct drm_device *dev = rdev->ddev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (irq == IRQ_NOTCONNECTED)
|
||||||
|
return -ENOTCONN;
|
||||||
|
|
||||||
|
radeon_driver_irq_preinstall_kms(dev);
|
||||||
|
|
||||||
|
/* PCI devices require shared interrupts. */
|
||||||
|
ret = request_irq(irq, radeon_driver_irq_handler_kms,
|
||||||
|
IRQF_SHARED, dev->driver->name, dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
radeon_driver_irq_postinstall_kms(dev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void radeon_irq_uninstall(struct radeon_device *rdev)
|
||||||
|
{
|
||||||
|
struct drm_device *dev = rdev->ddev;
|
||||||
|
struct pci_dev *pdev = to_pci_dev(dev->dev);
|
||||||
|
|
||||||
|
radeon_driver_irq_uninstall_kms(dev);
|
||||||
|
free_irq(pdev->irq, dev);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* radeon_msi_ok - asic specific msi checks
|
* radeon_msi_ok - asic specific msi checks
|
||||||
*
|
*
|
||||||
@ -314,7 +344,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
|
|||||||
INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
|
INIT_WORK(&rdev->audio_work, r600_audio_update_hdmi);
|
||||||
|
|
||||||
rdev->irq.installed = true;
|
rdev->irq.installed = true;
|
||||||
r = drm_irq_install(rdev->ddev, rdev->pdev->irq);
|
r = radeon_irq_install(rdev, rdev->pdev->irq);
|
||||||
if (r) {
|
if (r) {
|
||||||
rdev->irq.installed = false;
|
rdev->irq.installed = false;
|
||||||
flush_delayed_work(&rdev->hotplug_work);
|
flush_delayed_work(&rdev->hotplug_work);
|
||||||
@ -335,7 +365,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
|
|||||||
void radeon_irq_kms_fini(struct radeon_device *rdev)
|
void radeon_irq_kms_fini(struct radeon_device *rdev)
|
||||||
{
|
{
|
||||||
if (rdev->irq.installed) {
|
if (rdev->irq.installed) {
|
||||||
drm_irq_uninstall(rdev->ddev);
|
radeon_irq_uninstall(rdev);
|
||||||
rdev->irq.installed = false;
|
rdev->irq.installed = false;
|
||||||
if (rdev->msi_enabled)
|
if (rdev->msi_enabled)
|
||||||
pci_disable_msi(rdev->pdev);
|
pci_disable_msi(rdev->pdev);
|
||||||
|
@ -31,9 +31,5 @@
|
|||||||
u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
|
u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);
|
||||||
int radeon_enable_vblank_kms(struct drm_crtc *crtc);
|
int radeon_enable_vblank_kms(struct drm_crtc *crtc);
|
||||||
void radeon_disable_vblank_kms(struct drm_crtc *crtc);
|
void radeon_disable_vblank_kms(struct drm_crtc *crtc);
|
||||||
irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
|
|
||||||
void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
|
|
||||||
int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
|
|
||||||
void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
|
|
||||||
|
|
||||||
#endif /* __RADEON_KMS_H__ */
|
#endif /* __RADEON_KMS_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user