Commit f026e431 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/msm: 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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
Acked-by: default avatarRob Clark <robdclark@chromium.org>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210803090704.32152-8-tzimmermann@suse.de
parent 58889cdc
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <drm/drm_drv.h> #include <drm/drm_drv.h>
#include <drm/drm_file.h> #include <drm/drm_file.h>
#include <drm/drm_ioctl.h> #include <drm/drm_ioctl.h>
#include <drm/drm_irq.h>
#include <drm/drm_prime.h> #include <drm/drm_prime.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
#include <drm/drm_vblank.h> #include <drm/drm_vblank.h>
...@@ -201,6 +200,71 @@ void msm_rmw(void __iomem *addr, u32 mask, u32 or) ...@@ -201,6 +200,71 @@ void msm_rmw(void __iomem *addr, u32 mask, u32 or)
msm_writel(val | or, addr); msm_writel(val | or, addr);
} }
static irqreturn_t msm_irq(int irq, void *arg)
{
struct drm_device *dev = arg;
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
BUG_ON(!kms);
return kms->funcs->irq(kms);
}
static void msm_irq_preinstall(struct drm_device *dev)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
BUG_ON(!kms);
kms->funcs->irq_preinstall(kms);
}
static int msm_irq_postinstall(struct drm_device *dev)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
BUG_ON(!kms);
if (kms->funcs->irq_postinstall)
return kms->funcs->irq_postinstall(kms);
return 0;
}
static int msm_irq_install(struct drm_device *dev, unsigned int irq)
{
int ret;
if (irq == IRQ_NOTCONNECTED)
return -ENOTCONN;
msm_irq_preinstall(dev);
ret = request_irq(irq, msm_irq, 0, dev->driver->name, dev);
if (ret)
return ret;
ret = msm_irq_postinstall(dev);
if (ret) {
free_irq(irq, dev);
return ret;
}
return 0;
}
static void msm_irq_uninstall(struct drm_device *dev)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
kms->funcs->irq_uninstall(kms);
free_irq(kms->irq, dev);
}
struct msm_vblank_work { struct msm_vblank_work {
struct work_struct work; struct work_struct work;
int crtc_id; int crtc_id;
...@@ -265,7 +329,7 @@ static int msm_drm_uninit(struct device *dev) ...@@ -265,7 +329,7 @@ static int msm_drm_uninit(struct device *dev)
} }
/* We must cancel and cleanup any pending vblank enable/disable /* We must cancel and cleanup any pending vblank enable/disable
* work before drm_irq_uninstall() to avoid work re-enabling an * work before msm_irq_uninstall() to avoid work re-enabling an
* irq after uninstall has disabled it. * irq after uninstall has disabled it.
*/ */
...@@ -294,7 +358,7 @@ static int msm_drm_uninit(struct device *dev) ...@@ -294,7 +358,7 @@ static int msm_drm_uninit(struct device *dev)
drm_mode_config_cleanup(ddev); drm_mode_config_cleanup(ddev);
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
drm_irq_uninstall(ddev); msm_irq_uninstall(ddev);
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
if (kms && kms->funcs) if (kms && kms->funcs)
...@@ -553,7 +617,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ...@@ -553,7 +617,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
if (kms) { if (kms) {
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
ret = drm_irq_install(ddev, kms->irq); ret = msm_irq_install(ddev, kms->irq);
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
if (ret < 0) { if (ret < 0) {
DRM_DEV_ERROR(dev, "failed to install IRQ handler\n"); DRM_DEV_ERROR(dev, "failed to install IRQ handler\n");
...@@ -662,43 +726,6 @@ static void msm_postclose(struct drm_device *dev, struct drm_file *file) ...@@ -662,43 +726,6 @@ static void msm_postclose(struct drm_device *dev, struct drm_file *file)
context_close(ctx); context_close(ctx);
} }
static irqreturn_t msm_irq(int irq, void *arg)
{
struct drm_device *dev = arg;
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
BUG_ON(!kms);
return kms->funcs->irq(kms);
}
static void msm_irq_preinstall(struct drm_device *dev)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
BUG_ON(!kms);
kms->funcs->irq_preinstall(kms);
}
static int msm_irq_postinstall(struct drm_device *dev)
{
struct msm_drm_private *priv = dev->dev_private;
struct msm_kms *kms = priv->kms;
BUG_ON(!kms);
if (kms->funcs->irq_postinstall)
return kms->funcs->irq_postinstall(kms);
return 0;
}
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);
}
int msm_crtc_enable_vblank(struct drm_crtc *crtc) int msm_crtc_enable_vblank(struct drm_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
...@@ -1051,10 +1078,6 @@ static const struct drm_driver msm_driver = { ...@@ -1051,10 +1078,6 @@ static const struct drm_driver msm_driver = {
.open = msm_open, .open = msm_open,
.postclose = msm_postclose, .postclose = msm_postclose,
.lastclose = drm_fb_helper_lastclose, .lastclose = drm_fb_helper_lastclose,
.irq_handler = msm_irq,
.irq_preinstall = msm_irq_preinstall,
.irq_postinstall = msm_irq_postinstall,
.irq_uninstall = msm_irq_uninstall,
.dumb_create = msm_gem_dumb_create, .dumb_create = msm_gem_dumb_create,
.dumb_map_offset = msm_gem_dumb_map_offset, .dumb_map_offset = msm_gem_dumb_map_offset,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
......
...@@ -150,7 +150,7 @@ struct msm_kms { ...@@ -150,7 +150,7 @@ struct msm_kms {
const struct msm_kms_funcs *funcs; const struct msm_kms_funcs *funcs;
struct drm_device *dev; struct drm_device *dev;
/* irq number to be passed on to drm_irq_install */ /* irq number to be passed on to msm_irq_install */
int irq; int irq;
/* mapper-id used to request GEM buffer mapped for scanout: */ /* mapper-id used to request GEM buffer mapped for scanout: */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment