blob: c6bb978a110673821a3aa6db6e3cefd32bcc20ce [file] [log] [blame]
Dave Airlie22f579c2005-06-28 22:48:56 +10001/* via_irq.c
2 *
3 * Copyright 2004 BEAM Ltd.
4 * Copyright 2002 Tungsten Graphics, Inc.
5 * Copyright 2005 Thomas Hellstrom.
6 * All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BEAM LTD, TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
23 * DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
27 *
28 * Authors:
29 * Terry Barnaby <terry1@beam.ltd.uk>
30 * Keith Whitwell <keith@tungstengraphics.com>
31 * Thomas Hellstrom <unichrome@shipmail.org>
32 *
33 * This code provides standard DRM access to the Via Unichrome / Pro Vertical blank
34 * interrupt, as well as an infrastructure to handle other interrupts of the chip.
35 * The refresh rate is also calculated for video playback sync purposes.
36 */
37
38#include "drmP.h"
39#include "drm.h"
40#include "via_drm.h"
41#include "via_drv.h"
42
43#define VIA_REG_INTERRUPT 0x200
44
45/* VIA_REG_INTERRUPT */
46#define VIA_IRQ_GLOBAL (1 << 31)
47#define VIA_IRQ_VBLANK_ENABLE (1 << 19)
48#define VIA_IRQ_VBLANK_PENDING (1 << 3)
49#define VIA_IRQ_HQV0_ENABLE (1 << 11)
50#define VIA_IRQ_HQV1_ENABLE (1 << 25)
51#define VIA_IRQ_HQV0_PENDING (1 << 9)
52#define VIA_IRQ_HQV1_PENDING (1 << 10)
Dave Airlie92514242005-11-12 21:52:46 +110053#define VIA_IRQ_DMA0_DD_ENABLE (1 << 20)
54#define VIA_IRQ_DMA0_TD_ENABLE (1 << 21)
55#define VIA_IRQ_DMA1_DD_ENABLE (1 << 22)
56#define VIA_IRQ_DMA1_TD_ENABLE (1 << 23)
57#define VIA_IRQ_DMA0_DD_PENDING (1 << 4)
58#define VIA_IRQ_DMA0_TD_PENDING (1 << 5)
59#define VIA_IRQ_DMA1_DD_PENDING (1 << 6)
60#define VIA_IRQ_DMA1_TD_PENDING (1 << 7)
61
Dave Airlie22f579c2005-06-28 22:48:56 +100062
63/*
64 * Device-specific IRQs go here. This type might need to be extended with
65 * the register if there are multiple IRQ control registers.
Dave Airlieb5e89ed2005-09-25 14:28:13 +100066 * Currently we activate the HQV interrupts of Unichrome Pro group A.
Dave Airlie22f579c2005-06-28 22:48:56 +100067 */
68
69static maskarray_t via_pro_group_a_irqs[] = {
Dave Airlieb5e89ed2005-09-25 14:28:13 +100070 {VIA_IRQ_HQV0_ENABLE, VIA_IRQ_HQV0_PENDING, 0x000003D0, 0x00008010,
71 0x00000000},
72 {VIA_IRQ_HQV1_ENABLE, VIA_IRQ_HQV1_PENDING, 0x000013D0, 0x00008010,
Dave Airlie92514242005-11-12 21:52:46 +110073 0x00000000},
74 {VIA_IRQ_DMA0_TD_ENABLE, VIA_IRQ_DMA0_TD_PENDING, VIA_PCI_DMA_CSR0,
75 VIA_DMA_CSR_TA | VIA_DMA_CSR_TD, 0x00000008},
76 {VIA_IRQ_DMA1_TD_ENABLE, VIA_IRQ_DMA1_TD_PENDING, VIA_PCI_DMA_CSR1,
77 VIA_DMA_CSR_TA | VIA_DMA_CSR_TD, 0x00000008},
Dave Airlieb5e89ed2005-09-25 14:28:13 +100078};
79static int via_num_pro_group_a =
80 sizeof(via_pro_group_a_irqs) / sizeof(maskarray_t);
Dave Airlie92514242005-11-12 21:52:46 +110081static int via_irqmap_pro_group_a[] = {0, 1, -1, 2, -1, 3};
Dave Airlie22f579c2005-06-28 22:48:56 +100082
Dave Airlie92514242005-11-12 21:52:46 +110083static maskarray_t via_unichrome_irqs[] = {
84 {VIA_IRQ_DMA0_TD_ENABLE, VIA_IRQ_DMA0_TD_PENDING, VIA_PCI_DMA_CSR0,
85 VIA_DMA_CSR_TA | VIA_DMA_CSR_TD, 0x00000008},
86 {VIA_IRQ_DMA1_TD_ENABLE, VIA_IRQ_DMA1_TD_PENDING, VIA_PCI_DMA_CSR1,
87 VIA_DMA_CSR_TA | VIA_DMA_CSR_TD, 0x00000008}
88};
Dave Airlieb5e89ed2005-09-25 14:28:13 +100089static int via_num_unichrome = sizeof(via_unichrome_irqs) / sizeof(maskarray_t);
Dave Airlie92514242005-11-12 21:52:46 +110090static int via_irqmap_unichrome[] = {-1, -1, -1, 0, -1, 1};
Dave Airlie22f579c2005-06-28 22:48:56 +100091
Dave Airlieb5e89ed2005-09-25 14:28:13 +100092static unsigned time_diff(struct timeval *now, struct timeval *then)
Dave Airlie22f579c2005-06-28 22:48:56 +100093{
Dave Airlieb5e89ed2005-09-25 14:28:13 +100094 return (now->tv_usec >= then->tv_usec) ?
95 now->tv_usec - then->tv_usec :
96 1000000 - (then->tv_usec - now->tv_usec);
Dave Airlie22f579c2005-06-28 22:48:56 +100097}
98
99irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
100{
Dave Airlie84b1fd12007-07-11 15:53:27 +1000101 struct drm_device *dev = (struct drm_device *) arg;
Dave Airlie22f579c2005-06-28 22:48:56 +1000102 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
103 u32 status;
104 int handled = 0;
105 struct timeval cur_vblank;
106 drm_via_irq_t *cur_irq = dev_priv->via_irqs;
107 int i;
108
109 status = VIA_READ(VIA_REG_INTERRUPT);
110 if (status & VIA_IRQ_VBLANK_PENDING) {
111 atomic_inc(&dev->vbl_received);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000112 if (!(atomic_read(&dev->vbl_received) & 0x0F)) {
Dave Airlie22f579c2005-06-28 22:48:56 +1000113 do_gettimeofday(&cur_vblank);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000114 if (dev_priv->last_vblank_valid) {
115 dev_priv->usec_per_vblank =
116 time_diff(&cur_vblank,
117 &dev_priv->last_vblank) >> 4;
Dave Airlie22f579c2005-06-28 22:48:56 +1000118 }
119 dev_priv->last_vblank = cur_vblank;
120 dev_priv->last_vblank_valid = 1;
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000121 }
122 if (!(atomic_read(&dev->vbl_received) & 0xFF)) {
Dave Airlie22f579c2005-06-28 22:48:56 +1000123 DRM_DEBUG("US per vblank is: %u\n",
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000124 dev_priv->usec_per_vblank);
Dave Airlie22f579c2005-06-28 22:48:56 +1000125 }
126 DRM_WAKEUP(&dev->vbl_queue);
127 drm_vbl_send_signals(dev);
128 handled = 1;
129 }
Dave Airlie22f579c2005-06-28 22:48:56 +1000130
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000131 for (i = 0; i < dev_priv->num_irqs; ++i) {
Dave Airlie22f579c2005-06-28 22:48:56 +1000132 if (status & cur_irq->pending_mask) {
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000133 atomic_inc(&cur_irq->irq_received);
134 DRM_WAKEUP(&cur_irq->irq_queue);
Dave Airlie22f579c2005-06-28 22:48:56 +1000135 handled = 1;
Dave Airlie92514242005-11-12 21:52:46 +1100136 if (dev_priv->irq_map[drm_via_irq_dma0_td] == i) {
137 via_dmablit_handler(dev, 0, 1);
138 } else if (dev_priv->irq_map[drm_via_irq_dma1_td] == i) {
139 via_dmablit_handler(dev, 1, 1);
140 }
Dave Airlie22f579c2005-06-28 22:48:56 +1000141 }
142 cur_irq++;
143 }
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000144
Dave Airlie22f579c2005-06-28 22:48:56 +1000145 /* Acknowlege interrupts */
146 VIA_WRITE(VIA_REG_INTERRUPT, status);
147
Dave Airlie22f579c2005-06-28 22:48:56 +1000148 if (handled)
149 return IRQ_HANDLED;
150 else
151 return IRQ_NONE;
152}
153
154static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv)
155{
156 u32 status;
157
158 if (dev_priv) {
159 /* Acknowlege interrupts */
160 status = VIA_READ(VIA_REG_INTERRUPT);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000161 VIA_WRITE(VIA_REG_INTERRUPT, status |
Dave Airlie22f579c2005-06-28 22:48:56 +1000162 dev_priv->irq_pending_mask);
163 }
164}
165
Dave Airlie84b1fd12007-07-11 15:53:27 +1000166int via_driver_vblank_wait(struct drm_device * dev, unsigned int *sequence)
Dave Airlie22f579c2005-06-28 22:48:56 +1000167{
168 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
169 unsigned int cur_vblank;
170 int ret = 0;
171
Márton Németh3e684ea2008-01-24 15:58:57 +1000172 DRM_DEBUG("\n");
Dave Airlie22f579c2005-06-28 22:48:56 +1000173 if (!dev_priv) {
Márton Németh3e684ea2008-01-24 15:58:57 +1000174 DRM_ERROR("called with no initialization\n");
Dave Airlie22f579c2005-06-28 22:48:56 +1000175 return -EINVAL;
176 }
177
178 viadrv_acknowledge_irqs(dev_priv);
179
180 /* Assume that the user has missed the current sequence number
181 * by about a day rather than she wants to wait for years
182 * using vertical blanks...
183 */
184
185 DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
186 (((cur_vblank = atomic_read(&dev->vbl_received)) -
187 *sequence) <= (1 << 23)));
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000188
Dave Airlie22f579c2005-06-28 22:48:56 +1000189 *sequence = cur_vblank;
190 return ret;
191}
192
Dave Airliece60fe02006-02-02 19:21:38 +1100193static int
Dave Airlie84b1fd12007-07-11 15:53:27 +1000194via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequence,
Dave Airlie22f579c2005-06-28 22:48:56 +1000195 unsigned int *sequence)
196{
197 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
198 unsigned int cur_irq_sequence;
Jayachandran Cd2532582006-04-10 23:18:28 -0700199 drm_via_irq_t *cur_irq;
Dave Airlie22f579c2005-06-28 22:48:56 +1000200 int ret = 0;
Dave Airlie86678df2006-04-05 18:10:11 +1000201 maskarray_t *masks;
Dave Airlie92514242005-11-12 21:52:46 +1100202 int real_irq;
Dave Airlie22f579c2005-06-28 22:48:56 +1000203
Márton Németh3e684ea2008-01-24 15:58:57 +1000204 DRM_DEBUG("\n");
Dave Airlie22f579c2005-06-28 22:48:56 +1000205
206 if (!dev_priv) {
Márton Németh3e684ea2008-01-24 15:58:57 +1000207 DRM_ERROR("called with no initialization\n");
Eric Anholt20caafa2007-08-25 19:22:43 +1000208 return -EINVAL;
Dave Airlie22f579c2005-06-28 22:48:56 +1000209 }
210
Dave Airlie92514242005-11-12 21:52:46 +1100211 if (irq >= drm_via_irq_num) {
Márton Németh3e684ea2008-01-24 15:58:57 +1000212 DRM_ERROR("Trying to wait on unknown irq %d\n", irq);
Eric Anholt20caafa2007-08-25 19:22:43 +1000213 return -EINVAL;
Dave Airlie22f579c2005-06-28 22:48:56 +1000214 }
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000215
Dave Airlie92514242005-11-12 21:52:46 +1100216 real_irq = dev_priv->irq_map[irq];
Dave Airlie22f579c2005-06-28 22:48:56 +1000217
Dave Airlie92514242005-11-12 21:52:46 +1100218 if (real_irq < 0) {
Márton Németh3e684ea2008-01-24 15:58:57 +1000219 DRM_ERROR("Video IRQ %d not available on this hardware.\n",
220 irq);
Eric Anholt20caafa2007-08-25 19:22:43 +1000221 return -EINVAL;
Dave Airlie92514242005-11-12 21:52:46 +1100222 }
Dave Airlie86678df2006-04-05 18:10:11 +1000223
224 masks = dev_priv->irq_masks;
Jayachandran Cd2532582006-04-10 23:18:28 -0700225 cur_irq = dev_priv->via_irqs + real_irq;
Dave Airlie92514242005-11-12 21:52:46 +1100226
227 if (masks[real_irq][2] && !force_sequence) {
Dave Airlie22f579c2005-06-28 22:48:56 +1000228 DRM_WAIT_ON(ret, cur_irq->irq_queue, 3 * DRM_HZ,
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000229 ((VIA_READ(masks[irq][2]) & masks[irq][3]) ==
230 masks[irq][4]));
Dave Airlie22f579c2005-06-28 22:48:56 +1000231 cur_irq_sequence = atomic_read(&cur_irq->irq_received);
232 } else {
233 DRM_WAIT_ON(ret, cur_irq->irq_queue, 3 * DRM_HZ,
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000234 (((cur_irq_sequence =
235 atomic_read(&cur_irq->irq_received)) -
236 *sequence) <= (1 << 23)));
Dave Airlie22f579c2005-06-28 22:48:56 +1000237 }
238 *sequence = cur_irq_sequence;
239 return ret;
240}
241
Dave Airlie22f579c2005-06-28 22:48:56 +1000242/*
243 * drm_dma.h hooks
244 */
245
Dave Airlie84b1fd12007-07-11 15:53:27 +1000246void via_driver_irq_preinstall(struct drm_device * dev)
Dave Airlie22f579c2005-06-28 22:48:56 +1000247{
248 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
249 u32 status;
Jayachandran Cd2532582006-04-10 23:18:28 -0700250 drm_via_irq_t *cur_irq;
Dave Airlie22f579c2005-06-28 22:48:56 +1000251 int i;
252
Márton Németh3e684ea2008-01-24 15:58:57 +1000253 DRM_DEBUG("dev_priv: %p\n", dev_priv);
Dave Airlie22f579c2005-06-28 22:48:56 +1000254 if (dev_priv) {
Jayachandran Cd2532582006-04-10 23:18:28 -0700255 cur_irq = dev_priv->via_irqs;
Dave Airlie22f579c2005-06-28 22:48:56 +1000256
257 dev_priv->irq_enable_mask = VIA_IRQ_VBLANK_ENABLE;
258 dev_priv->irq_pending_mask = VIA_IRQ_VBLANK_PENDING;
259
Thomas Hellstrom689692e2007-01-08 21:19:57 +1100260 if (dev_priv->chipset == VIA_PRO_GROUP_A ||
261 dev_priv->chipset == VIA_DX9_0) {
262 dev_priv->irq_masks = via_pro_group_a_irqs;
263 dev_priv->num_irqs = via_num_pro_group_a;
264 dev_priv->irq_map = via_irqmap_pro_group_a;
265 } else {
266 dev_priv->irq_masks = via_unichrome_irqs;
267 dev_priv->num_irqs = via_num_unichrome;
268 dev_priv->irq_map = via_irqmap_unichrome;
269 }
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000270
271 for (i = 0; i < dev_priv->num_irqs; ++i) {
Dave Airlie22f579c2005-06-28 22:48:56 +1000272 atomic_set(&cur_irq->irq_received, 0);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000273 cur_irq->enable_mask = dev_priv->irq_masks[i][0];
Dave Airlie22f579c2005-06-28 22:48:56 +1000274 cur_irq->pending_mask = dev_priv->irq_masks[i][1];
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000275 DRM_INIT_WAITQUEUE(&cur_irq->irq_queue);
Dave Airlie22f579c2005-06-28 22:48:56 +1000276 dev_priv->irq_enable_mask |= cur_irq->enable_mask;
277 dev_priv->irq_pending_mask |= cur_irq->pending_mask;
278 cur_irq++;
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000279
Dave Airlie22f579c2005-06-28 22:48:56 +1000280 DRM_DEBUG("Initializing IRQ %d\n", i);
281 }
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000282
283 dev_priv->last_vblank_valid = 0;
Dave Airlie22f579c2005-06-28 22:48:56 +1000284
Dave Airlie92514242005-11-12 21:52:46 +1100285 /* Clear VSync interrupt regs */
Dave Airlie22f579c2005-06-28 22:48:56 +1000286 status = VIA_READ(VIA_REG_INTERRUPT);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000287 VIA_WRITE(VIA_REG_INTERRUPT, status &
Dave Airlie22f579c2005-06-28 22:48:56 +1000288 ~(dev_priv->irq_enable_mask));
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000289
Dave Airlie22f579c2005-06-28 22:48:56 +1000290 /* Clear bits if they're already high */
291 viadrv_acknowledge_irqs(dev_priv);
292 }
293}
294
Dave Airlie84b1fd12007-07-11 15:53:27 +1000295void via_driver_irq_postinstall(struct drm_device * dev)
Dave Airlie22f579c2005-06-28 22:48:56 +1000296{
297 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
298 u32 status;
299
Márton Németh3e684ea2008-01-24 15:58:57 +1000300 DRM_DEBUG("\n");
Dave Airlie22f579c2005-06-28 22:48:56 +1000301 if (dev_priv) {
302 status = VIA_READ(VIA_REG_INTERRUPT);
303 VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL
304 | dev_priv->irq_enable_mask);
305
306 /* Some magic, oh for some data sheets ! */
307
308 VIA_WRITE8(0x83d4, 0x11);
309 VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000310
Dave Airlie22f579c2005-06-28 22:48:56 +1000311 }
312}
313
Dave Airlie84b1fd12007-07-11 15:53:27 +1000314void via_driver_irq_uninstall(struct drm_device * dev)
Dave Airlie22f579c2005-06-28 22:48:56 +1000315{
316 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
317 u32 status;
318
Márton Németh3e684ea2008-01-24 15:58:57 +1000319 DRM_DEBUG("\n");
Dave Airlie22f579c2005-06-28 22:48:56 +1000320 if (dev_priv) {
321
322 /* Some more magic, oh for some data sheets ! */
323
324 VIA_WRITE8(0x83d4, 0x11);
325 VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30);
326
327 status = VIA_READ(VIA_REG_INTERRUPT);
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000328 VIA_WRITE(VIA_REG_INTERRUPT, status &
Dave Airlie22f579c2005-06-28 22:48:56 +1000329 ~(VIA_IRQ_VBLANK_ENABLE | dev_priv->irq_enable_mask));
330 }
331}
332
Eric Anholtc153f452007-09-03 12:06:45 +1000333int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv)
Dave Airlie22f579c2005-06-28 22:48:56 +1000334{
Eric Anholtc153f452007-09-03 12:06:45 +1000335 drm_via_irqwait_t *irqwait = data;
Dave Airlie22f579c2005-06-28 22:48:56 +1000336 struct timeval now;
337 int ret = 0;
338 drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
339 drm_via_irq_t *cur_irq = dev_priv->via_irqs;
340 int force_sequence;
341
342 if (!dev->irq)
Eric Anholt20caafa2007-08-25 19:22:43 +1000343 return -EINVAL;
Dave Airlie22f579c2005-06-28 22:48:56 +1000344
Eric Anholtc153f452007-09-03 12:06:45 +1000345 if (irqwait->request.irq >= dev_priv->num_irqs) {
Márton Németh3e684ea2008-01-24 15:58:57 +1000346 DRM_ERROR("Trying to wait on unknown irq %d\n",
Eric Anholtc153f452007-09-03 12:06:45 +1000347 irqwait->request.irq);
Eric Anholt20caafa2007-08-25 19:22:43 +1000348 return -EINVAL;
Dave Airlie22f579c2005-06-28 22:48:56 +1000349 }
350
Eric Anholtc153f452007-09-03 12:06:45 +1000351 cur_irq += irqwait->request.irq;
Dave Airlie22f579c2005-06-28 22:48:56 +1000352
Eric Anholtc153f452007-09-03 12:06:45 +1000353 switch (irqwait->request.type & ~VIA_IRQ_FLAGS_MASK) {
Dave Airlie22f579c2005-06-28 22:48:56 +1000354 case VIA_IRQ_RELATIVE:
Eric Anholtc153f452007-09-03 12:06:45 +1000355 irqwait->request.sequence += atomic_read(&cur_irq->irq_received);
356 irqwait->request.type &= ~_DRM_VBLANK_RELATIVE;
Dave Airlie22f579c2005-06-28 22:48:56 +1000357 case VIA_IRQ_ABSOLUTE:
358 break;
359 default:
Eric Anholt20caafa2007-08-25 19:22:43 +1000360 return -EINVAL;
Dave Airlie22f579c2005-06-28 22:48:56 +1000361 }
362
Eric Anholtc153f452007-09-03 12:06:45 +1000363 if (irqwait->request.type & VIA_IRQ_SIGNAL) {
Márton Németh3e684ea2008-01-24 15:58:57 +1000364 DRM_ERROR("Signals on Via IRQs not implemented yet.\n");
Eric Anholt20caafa2007-08-25 19:22:43 +1000365 return -EINVAL;
Dave Airlie22f579c2005-06-28 22:48:56 +1000366 }
367
Eric Anholtc153f452007-09-03 12:06:45 +1000368 force_sequence = (irqwait->request.type & VIA_IRQ_FORCE_SEQUENCE);
Dave Airlie22f579c2005-06-28 22:48:56 +1000369
Eric Anholtc153f452007-09-03 12:06:45 +1000370 ret = via_driver_irq_wait(dev, irqwait->request.irq, force_sequence,
371 &irqwait->request.sequence);
Dave Airlie22f579c2005-06-28 22:48:56 +1000372 do_gettimeofday(&now);
Eric Anholtc153f452007-09-03 12:06:45 +1000373 irqwait->reply.tval_sec = now.tv_sec;
374 irqwait->reply.tval_usec = now.tv_usec;
Dave Airlie22f579c2005-06-28 22:48:56 +1000375
376 return ret;
377}