diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-03 12:50:28 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-04-03 12:50:28 +0000 |
commit | 0b4845c9ad6c86ddceb718dd99e4281837a53e33 (patch) | |
tree | 668d3affefb14e1639eb85630194229e894f1b07 /sys/dev/pci/drm | |
parent | a42bafa7a7c496b51d0003dec48fcd7f0a78c6ac (diff) |
Convert machdrm to not have to user drm_irq_handler. Since the only
interrupt we provide is vblank, it's just switching the handler. knf
while here.
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r-- | sys/dev/pci/drm/mach64_irq.c | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/sys/dev/pci/drm/mach64_irq.c b/sys/dev/pci/drm/mach64_irq.c index b8d279d75d5..ec4afe84076 100644 --- a/sys/dev/pci/drm/mach64_irq.c +++ b/sys/dev/pci/drm/mach64_irq.c @@ -40,65 +40,69 @@ #include "mach64_drm.h" #include "mach64_drv.h" -irqreturn_t mach64_driver_irq_handler(DRM_IRQ_ARGS) +irqreturn_t +mach64_driver_irq_handler(DRM_IRQ_ARGS) { - struct drm_device *dev = arg; - drm_mach64_private_t *dev_priv = dev->dev_private; - int status; + struct drm_device *dev = arg; + drm_mach64_private_t *dev_priv = dev->dev_private; + int status; status = MACH64_READ(MACH64_CRTC_INT_CNTL); /* VBLANK interrupt */ if (status & MACH64_CRTC_VBLANK_INT) { - /* Mask off all interrupt ack bits before setting the ack bit, since - * there may be other handlers outside the DRM. + /* + * Mask off all interrupt ack bits before setting the ack bit, + * since there may be other handlers outside the DRM. * - * NOTE: On mach64, you need to keep the enable bits set when doing - * the ack, despite what the docs say about not acking and enabling - * in a single write. + * NOTE: On mach64, you need to keep the enable bits set when + * doing the ack, despite what the docs say about not acking + * and enabling in a single write. */ MACH64_WRITE(MACH64_CRTC_INT_CNTL, - (status & ~MACH64_CRTC_INT_ACKS) - | MACH64_CRTC_VBLANK_INT); + (status & ~MACH64_CRTC_INT_ACKS) | MACH64_CRTC_VBLANK_INT); atomic_inc(&dev_priv->vbl_received); drm_handle_vblank(dev, 0); - return IRQ_HANDLED; + return (IRQ_HANDLED); } - return IRQ_NONE; + return (IRQ_NONE); } -u32 mach64_get_vblank_counter(struct drm_device * dev, int crtc) +u_int32_t +mach64_get_vblank_counter(struct drm_device * dev, int crtc) { - const drm_mach64_private_t *const dev_priv = dev->dev_private; + const drm_mach64_private_t *const dev_priv = dev->dev_private; if (crtc != 0) return 0; - return atomic_read(&dev_priv->vbl_received); + return (atomic_read(&dev_priv->vbl_received)); } -int mach64_enable_vblank(struct drm_device * dev, int crtc) +int +mach64_enable_vblank(struct drm_device * dev, int crtc) { - drm_mach64_private_t *dev_priv = dev->dev_private; + drm_mach64_private_t *dev_priv = dev->dev_private; if (crtc != 0) { DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", crtc); - return EINVAL; + return (EINVAL); } DRM_DEBUG("before enable vblank CRTC_INT_CTNL: 0x%08x\n", MACH64_READ(MACH64_CRTC_INT_CNTL)); /* Turn on VBLANK interrupt */ - MACH64_WRITE(MACH64_CRTC_INT_CNTL, MACH64_READ(MACH64_CRTC_INT_CNTL) - | MACH64_CRTC_VBLANK_INT_EN); + MACH64_WRITE(MACH64_CRTC_INT_CNTL, MACH64_READ(MACH64_CRTC_INT_CNTL) | + MACH64_CRTC_VBLANK_INT_EN); - return 0; + return (0); } -void mach64_disable_vblank(struct drm_device * dev, int crtc) +void +mach64_disable_vblank(struct drm_device * dev, int crtc) { if (crtc != 0) { DRM_ERROR("tried to disable vblank on non-existent crtc %d\n", @@ -112,10 +116,13 @@ void mach64_disable_vblank(struct drm_device * dev, int crtc) */ } -static void mach64_disable_vblank_local(struct drm_device * dev, int crtc) +static void +mach64_disable_vblank_local(struct drm_device * dev, int crtc) { - drm_mach64_private_t *dev_priv = dev->dev_private; - u32 status = MACH64_READ(MACH64_CRTC_INT_CNTL); + drm_mach64_private_t *dev_priv = dev->dev_private; + u_int32_t status; + + status = MACH64_READ(MACH64_CRTC_INT_CNTL); if (crtc != 0) { DRM_ERROR("tried to disable vblank on non-existent crtc %d\n", @@ -127,13 +134,13 @@ static void mach64_disable_vblank_local(struct drm_device * dev, int crtc) /* Disable and clear VBLANK interrupt */ MACH64_WRITE(MACH64_CRTC_INT_CNTL, (status & ~MACH64_CRTC_VBLANK_INT_EN) - | MACH64_CRTC_VBLANK_INT); + | MACH64_CRTC_VBLANK_INT); } int mach64_driver_irq_install(struct drm_device * dev) { - drm_mach64_private_t *dev_priv = dev->dev_private; + drm_mach64_private_t *dev_priv = dev->dev_private; DRM_DEBUG("before install CRTC_INT_CTNL: 0x%08x\n", @@ -142,15 +149,16 @@ mach64_driver_irq_install(struct drm_device * dev) mach64_disable_vblank_local(dev, 0); dev_priv->irqh = pci_intr_establish(dev_priv->pc, dev_priv->ih, IPL_BIO, - drm_irq_handler_wrap, dev, dev_priv->dev.dv_xname); + mach64_driver_irq_handler, dev, dev_priv->dev.dv_xname); if (dev_priv->irqh == NULL) return (ENOENT); return (0); } -void mach64_driver_irq_uninstall(struct drm_device * dev) +void +mach64_driver_irq_uninstall(struct drm_device * dev) { - drm_mach64_private_t *dev_priv = dev->dev_private; + drm_mach64_private_t *dev_priv = dev->dev_private; mach64_disable_vblank_local(dev, 0); |