From e2a1b77afa6f2d14adc40a89889f2f32370ea620 Mon Sep 17 00:00:00 2001 From: Bruce Hoo Date: Tue, 9 Nov 2021 18:50:58 +0800 Subject: [PATCH] disp: msm: adapt IRQ interface change for multiple SIs Commit 45160ca ("disp: msm: use linux IRQ interfaces instead of DRM helpers") update the msm layer to use linux IRQ interfaces as DRM IRQ helpers are removed in 5.15 kernel. This change uses macros to control the calling of correct irq interfaces for kernel version 5.10 and version 5.15. Change-Id: I367021df783c0aa02f729920b673e6f1f7397e65 Signed-off-by: Bruce Hoo --- msm/msm_drv.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/msm/msm_drv.c b/msm/msm_drv.c index 52359f50..cd9e0449 100644 --- a/msm/msm_drv.c +++ b/msm/msm_drv.c @@ -47,6 +47,9 @@ #include #include #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) +#include +#endif #include "msm_drv.h" #include "msm_gem.h" @@ -377,6 +380,7 @@ static int msm_irq_postinstall(struct drm_device *dev) return 0; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) static int msm_irq_install(struct drm_device *dev, unsigned int irq) { int ret; @@ -407,6 +411,21 @@ static void msm_irq_uninstall(struct drm_device *dev) kms->funcs->irq_uninstall(kms); free_irq(kms->irq, dev); } +#else +static void msm_irq_uninstall(struct drm_device *dev) +{ + struct msm_drm_private *priv = dev->dev_private; + struct msm_kms *kms = priv->kms; + BUG_ON(!kms); + kms->funcs->irq_uninstall(kms); +} + +static const struct vm_operations_struct vm_ops = { + .fault = msm_gem_fault, + .open = drm_gem_vm_open, + .close = drm_gem_vm_close, +}; +#endif int msm_get_src_bpc(int chroma_format, int bpc) @@ -475,7 +494,11 @@ static int msm_drm_uninit(struct device *dev) msm_fbdev_free(ddev); #endif drm_atomic_helper_shutdown(ddev); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) msm_irq_uninstall(ddev); +#else + drm_irq_uninstall(ddev); +#endif if (kms && kms->funcs) kms->funcs->destroy(kms); @@ -924,7 +947,11 @@ static int msm_drm_component_init(struct device *dev) if (kms) { pm_runtime_get_sync(dev); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) ret = msm_irq_install(ddev, platform_get_irq(pdev, 0)); +#else + ret = drm_irq_install(ddev, platform_get_irq(pdev, 0)); +#endif pm_runtime_put_sync(dev); if (ret < 0) { dev_err(dev, "failed to install IRQ handler\n"); @@ -1716,14 +1743,6 @@ static const struct drm_ioctl_desc msm_ioctls[] = { DRM_UNLOCKED), }; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) -static const struct vm_operations_struct vm_ops = { - .fault = msm_gem_fault, - .open = drm_gem_vm_open, - .close = drm_gem_vm_close, -}; -#endif - static const struct file_operations fops = { .owner = THIS_MODULE, .open = drm_open, @@ -1745,6 +1764,10 @@ static struct drm_driver msm_driver = { .postclose = msm_postclose, .lastclose = msm_lastclose, #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) + .irq_handler = msm_irq, + .irq_preinstall = msm_irq_preinstall, + .irq_postinstall = msm_irq_postinstall, + .irq_uninstall = msm_irq_uninstall, .gem_free_object_unlocked = msm_gem_free_object, .gem_vm_ops = &vm_ops, .gem_prime_export = drm_gem_prime_export,