diff options
author | Dave Airlie <airlied@linux.ie> | 2004-10-09 11:12:24 +0000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2004-10-09 11:12:24 +0000 |
commit | fec94a82748b3603da7239e39d247a9654765659 (patch) | |
tree | 9d005d52c64ee34694f84ad85b636041e58b55bc /shared/via_irq.c | |
parent | e09229d6c85bcb8b899f09fd70f264b4e1d6d0bd (diff) |
Lindent the via stuff so I can include it in kernel
Diffstat (limited to 'shared/via_irq.c')
-rw-r--r-- | shared/via_irq.c | 182 |
1 files changed, 92 insertions, 90 deletions
diff --git a/shared/via_irq.c b/shared/via_irq.c index eafb1d7d..f9384f20 100644 --- a/shared/via_irq.c +++ b/shared/via_irq.c @@ -40,126 +40,128 @@ #include "via_drv.h" #define VIA_REG_INTERRUPT 0x200 - + /* VIA_REG_INTERRUPT */ #define VIA_IRQ_GLOBAL (1 << 31) #define VIA_IRQ_VBI_ENABLE (1 << 19) #define VIA_IRQ_VBI_PENDING (1 << 3) -irqreturn_t via_driver_irq_handler( DRM_IRQ_ARGS ) +irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS) { - drm_device_t* dev = (drm_device_t*)arg; - drm_via_private_t* dev_priv = (drm_via_private_t*)dev->dev_private; - u32 status; - int handled = 0; - - status = VIA_READ(VIA_REG_INTERRUPT); - DRM_DEBUG("viadrv_irq_handler Status: %x\n",status); - if(status & VIA_IRQ_VBI_PENDING){ - atomic_inc(&dev->vbl_received); - DRM_WAKEUP(&dev->vbl_queue); - DRM(vbl_send_signals)(dev); - handled = 1; - } - - /* Acknowlege interrupts ?? */ - VIA_WRITE(VIA_REG_INTERRUPT, status); + drm_device_t *dev = (drm_device_t *) arg; + drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; + u32 status; + int handled = 0; + + status = VIA_READ(VIA_REG_INTERRUPT); + DRM_DEBUG("viadrv_irq_handler Status: %x\n", status); + if (status & VIA_IRQ_VBI_PENDING) { + atomic_inc(&dev->vbl_received); + DRM_WAKEUP(&dev->vbl_queue); + DRM(vbl_send_signals) (dev); + handled = 1; + } + + /* Acknowlege interrupts ?? */ + VIA_WRITE(VIA_REG_INTERRUPT, status); if (handled) - return IRQ_HANDLED; + return IRQ_HANDLED; else return IRQ_NONE; } -static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t* dev_priv) +static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv) { - u32 status; - - if(dev_priv){ - /* Acknowlege interrupts ?? */ - status = VIA_READ(VIA_REG_INTERRUPT); - VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_VBI_PENDING); - } + u32 status; + + if (dev_priv) { + /* Acknowlege interrupts ?? */ + status = VIA_READ(VIA_REG_INTERRUPT); + VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_VBI_PENDING); + } } -int via_driver_vblank_wait(drm_device_t* dev, unsigned int* sequence) +int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence) { - drm_via_private_t* dev_priv = (drm_via_private_t*)dev->dev_private; - unsigned int cur_vblank; - int ret = 0; - - DRM_DEBUG("viadrv_vblank_wait\n"); - if(!dev_priv){ - DRM_ERROR("%s called with no initialization\n", __FUNCTION__ ); - return -EINVAL; - } - - viadrv_acknowledge_irqs(dev_priv); - - /* Assume that the user has missed the current sequence number - * by about a day rather than she wants to wait for years - * using vertical blanks... - */ - DRM_WAIT_ON(ret, dev->vbl_queue, 3*DRM_HZ, - (((cur_vblank = atomic_read(&dev->vbl_received)) - - *sequence ) <= (1<<23))); - - *sequence = cur_vblank; - return ret; + drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; + unsigned int cur_vblank; + int ret = 0; + + DRM_DEBUG("viadrv_vblank_wait\n"); + if (!dev_priv) { + DRM_ERROR("%s called with no initialization\n", __FUNCTION__); + return -EINVAL; + } + + viadrv_acknowledge_irqs(dev_priv); + + /* Assume that the user has missed the current sequence number + * by about a day rather than she wants to wait for years + * using vertical blanks... + */ + DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, + (((cur_vblank = atomic_read(&dev->vbl_received)) - + *sequence) <= (1 << 23))); + + *sequence = cur_vblank; + return ret; } /* * drm_dma.h hooks */ -void via_driver_irq_preinstall(drm_device_t* dev){ - drm_via_private_t* dev_priv = (drm_via_private_t *)dev->dev_private; - u32 status; - - DRM_DEBUG("driver_irq_preinstall: dev_priv: %p\n", dev_priv); - if(dev_priv){ - DRM_DEBUG("mmio: %p\n", dev_priv->mmio); - status = VIA_READ(VIA_REG_INTERRUPT); - DRM_DEBUG("intreg: %x\n", status & VIA_IRQ_VBI_ENABLE); - - // Clear VSync interrupt regs - VIA_WRITE(VIA_REG_INTERRUPT, status & ~VIA_IRQ_VBI_ENABLE); - - /* Clear bits if they're already high */ - viadrv_acknowledge_irqs(dev_priv); - } +void via_driver_irq_preinstall(drm_device_t * dev) +{ + drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; + u32 status; + + DRM_DEBUG("driver_irq_preinstall: dev_priv: %p\n", dev_priv); + if (dev_priv) { + DRM_DEBUG("mmio: %p\n", dev_priv->mmio); + status = VIA_READ(VIA_REG_INTERRUPT); + DRM_DEBUG("intreg: %x\n", status & VIA_IRQ_VBI_ENABLE); + + // Clear VSync interrupt regs + VIA_WRITE(VIA_REG_INTERRUPT, status & ~VIA_IRQ_VBI_ENABLE); + + /* Clear bits if they're already high */ + viadrv_acknowledge_irqs(dev_priv); + } } -void via_driver_irq_postinstall(drm_device_t* dev){ - drm_via_private_t* dev_priv = (drm_via_private_t *)dev->dev_private; - u32 status; +void via_driver_irq_postinstall(drm_device_t * dev) +{ + drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; + u32 status; - DRM_DEBUG("via_driver_irq_postinstall\n"); - if(dev_priv){ - status = VIA_READ(VIA_REG_INTERRUPT); - VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL - | VIA_IRQ_VBI_ENABLE); - /* Some magic, oh for some data sheets ! */ + DRM_DEBUG("via_driver_irq_postinstall\n"); + if (dev_priv) { + status = VIA_READ(VIA_REG_INTERRUPT); + VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL + | VIA_IRQ_VBI_ENABLE); + /* Some magic, oh for some data sheets ! */ - VIA_WRITE8(0x83d4, 0x11); - VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); + VIA_WRITE8(0x83d4, 0x11); + VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); - } + } } -void via_driver_irq_uninstall(drm_device_t* dev){ - drm_via_private_t* dev_priv = (drm_via_private_t *)dev->dev_private; - u32 status; +void via_driver_irq_uninstall(drm_device_t * dev) +{ + drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; + u32 status; - DRM_DEBUG("driver_irq_uninstall)\n"); - if(dev_priv){ + DRM_DEBUG("driver_irq_uninstall)\n"); + if (dev_priv) { - /* Some more magic, oh for some data sheets ! */ + /* Some more magic, oh for some data sheets ! */ - VIA_WRITE8(0x83d4, 0x11); - VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); + VIA_WRITE8(0x83d4, 0x11); + VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); - status = VIA_READ(VIA_REG_INTERRUPT); - VIA_WRITE(VIA_REG_INTERRUPT, status & ~VIA_IRQ_VBI_ENABLE); - } + status = VIA_READ(VIA_REG_INTERRUPT); + VIA_WRITE(VIA_REG_INTERRUPT, status & ~VIA_IRQ_VBI_ENABLE); + } } - |