summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/gpu/drm/omapdrm/omap_irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/gpu/drm/omapdrm/omap_irq.c')
-rw-r--r--kernel/drivers/gpu/drm/omapdrm/omap_irq.c122
1 files changed, 31 insertions, 91 deletions
diff --git a/kernel/drivers/gpu/drm/omapdrm/omap_irq.c b/kernel/drivers/gpu/drm/omapdrm/omap_irq.c
index 3eb097efc..60e1e8016 100644
--- a/kernel/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/kernel/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -134,7 +134,7 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
/**
* enable_vblank - enable vblank interrupt events
* @dev: DRM device
- * @crtc: which irq to enable
+ * @pipe: which irq to enable
*
* Enable vblank interrupts for @crtc. If the device doesn't have
* a hardware vblank counter, this routine should be a no-op, since
@@ -144,20 +144,18 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
* Zero on success, appropriate errno if the given @crtc's vblank
* interrupt cannot be enabled.
*/
-int omap_irq_enable_vblank(struct drm_device *dev, int crtc_id)
+int omap_irq_enable_vblank(struct drm_device *dev, unsigned int pipe)
{
struct omap_drm_private *priv = dev->dev_private;
- struct drm_crtc *crtc = priv->crtcs[crtc_id];
+ struct drm_crtc *crtc = priv->crtcs[pipe];
unsigned long flags;
- DBG("dev=%p, crtc=%d", dev, crtc_id);
+ DBG("dev=%p, crtc=%u", dev, pipe);
- dispc_runtime_get();
spin_lock_irqsave(&list_lock, flags);
priv->vblank_mask |= pipe2vbl(crtc);
omap_irq_update(dev);
spin_unlock_irqrestore(&list_lock, flags);
- dispc_runtime_put();
return 0;
}
@@ -165,29 +163,27 @@ int omap_irq_enable_vblank(struct drm_device *dev, int crtc_id)
/**
* disable_vblank - disable vblank interrupt events
* @dev: DRM device
- * @crtc: which irq to enable
+ * @pipe: which irq to enable
*
* Disable vblank interrupts for @crtc. If the device doesn't have
* a hardware vblank counter, this routine should be a no-op, since
* interrupts will have to stay on to keep the count accurate.
*/
-void omap_irq_disable_vblank(struct drm_device *dev, int crtc_id)
+void omap_irq_disable_vblank(struct drm_device *dev, unsigned int pipe)
{
struct omap_drm_private *priv = dev->dev_private;
- struct drm_crtc *crtc = priv->crtcs[crtc_id];
+ struct drm_crtc *crtc = priv->crtcs[pipe];
unsigned long flags;
- DBG("dev=%p, crtc=%d", dev, crtc_id);
+ DBG("dev=%p, crtc=%u", dev, pipe);
- dispc_runtime_get();
spin_lock_irqsave(&list_lock, flags);
priv->vblank_mask &= ~pipe2vbl(crtc);
omap_irq_update(dev);
spin_unlock_irqrestore(&list_lock, flags);
- dispc_runtime_put();
}
-irqreturn_t omap_irq_handler(int irq, void *arg)
+static irqreturn_t omap_irq_handler(int irq, void *arg)
{
struct drm_device *dev = (struct drm_device *) arg;
struct omap_drm_private *priv = dev->dev_private;
@@ -222,23 +218,29 @@ irqreturn_t omap_irq_handler(int irq, void *arg)
return IRQ_HANDLED;
}
-void omap_irq_preinstall(struct drm_device *dev)
-{
- DBG("dev=%p", dev);
- dispc_runtime_get();
- dispc_clear_irqstatus(0xffffffff);
- dispc_runtime_put();
-}
+/*
+ * We need a special version, instead of just using drm_irq_install(),
+ * because we need to register the irq via omapdss. Once omapdss and
+ * omapdrm are merged together we can assign the dispc hwmod data to
+ * ourselves and drop these and just use drm_irq_{install,uninstall}()
+ */
-int omap_irq_postinstall(struct drm_device *dev)
+int omap_drm_irq_install(struct drm_device *dev)
{
struct omap_drm_private *priv = dev->dev_private;
struct omap_drm_irq *error_handler = &priv->error_handler;
-
- DBG("dev=%p", dev);
+ int ret;
INIT_LIST_HEAD(&priv->irq_list);
+ dispc_runtime_get();
+ dispc_clear_irqstatus(0xffffffff);
+ dispc_runtime_put();
+
+ ret = dispc_request_irq(omap_irq_handler, dev);
+ if (ret < 0)
+ return ret;
+
error_handler->irq = omap_irq_error_handler;
error_handler->irqmask = DISPC_IRQ_OCP_ERR;
@@ -249,76 +251,22 @@ int omap_irq_postinstall(struct drm_device *dev)
omap_irq_register(dev, error_handler);
- return 0;
-}
-
-void omap_irq_uninstall(struct drm_device *dev)
-{
- DBG("dev=%p", dev);
- // TODO prolly need to call drm_irq_uninstall() somewhere too
-}
-
-/*
- * We need a special version, instead of just using drm_irq_install(),
- * because we need to register the irq via omapdss. Once omapdss and
- * omapdrm are merged together we can assign the dispc hwmod data to
- * ourselves and drop these and just use drm_irq_{install,uninstall}()
- */
-
-int omap_drm_irq_install(struct drm_device *dev)
-{
- int ret;
-
- mutex_lock(&dev->struct_mutex);
-
- if (dev->irq_enabled) {
- mutex_unlock(&dev->struct_mutex);
- return -EBUSY;
- }
dev->irq_enabled = true;
- mutex_unlock(&dev->struct_mutex);
-
- /* Before installing handler */
- if (dev->driver->irq_preinstall)
- dev->driver->irq_preinstall(dev);
- ret = dispc_request_irq(dev->driver->irq_handler, dev);
-
- if (ret < 0) {
- mutex_lock(&dev->struct_mutex);
- dev->irq_enabled = false;
- mutex_unlock(&dev->struct_mutex);
- return ret;
- }
-
- /* After installing handler */
- if (dev->driver->irq_postinstall)
- ret = dev->driver->irq_postinstall(dev);
-
- if (ret < 0) {
- mutex_lock(&dev->struct_mutex);
- dev->irq_enabled = false;
- mutex_unlock(&dev->struct_mutex);
- dispc_free_irq(dev);
- }
-
- return ret;
+ return 0;
}
-int omap_drm_irq_uninstall(struct drm_device *dev)
+void omap_drm_irq_uninstall(struct drm_device *dev)
{
unsigned long irqflags;
- bool irq_enabled;
int i;
- mutex_lock(&dev->struct_mutex);
- irq_enabled = dev->irq_enabled;
+ if (!dev->irq_enabled)
+ return;
+
dev->irq_enabled = false;
- mutex_unlock(&dev->struct_mutex);
- /*
- * Wake up any waiters so they don't hang.
- */
+ /* Wake up any waiters so they don't hang. */
if (dev->num_crtcs) {
spin_lock_irqsave(&dev->vbl_lock, irqflags);
for (i = 0; i < dev->num_crtcs; i++) {
@@ -330,13 +278,5 @@ int omap_drm_irq_uninstall(struct drm_device *dev)
spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
}
- if (!irq_enabled)
- return -EINVAL;
-
- if (dev->driver->irq_uninstall)
- dev->driver->irq_uninstall(dev);
-
dispc_free_irq(dev);
-
- return 0;
}