42 #define VIA_REG_INTERRUPT 0x200
45 #define VIA_IRQ_GLOBAL (1 << 31)
46 #define VIA_IRQ_VBLANK_ENABLE (1 << 19)
47 #define VIA_IRQ_VBLANK_PENDING (1 << 3)
48 #define VIA_IRQ_HQV0_ENABLE (1 << 11)
49 #define VIA_IRQ_HQV1_ENABLE (1 << 25)
50 #define VIA_IRQ_HQV0_PENDING (1 << 9)
51 #define VIA_IRQ_HQV1_PENDING (1 << 10)
52 #define VIA_IRQ_DMA0_DD_ENABLE (1 << 20)
53 #define VIA_IRQ_DMA0_TD_ENABLE (1 << 21)
54 #define VIA_IRQ_DMA1_DD_ENABLE (1 << 22)
55 #define VIA_IRQ_DMA1_TD_ENABLE (1 << 23)
56 #define VIA_IRQ_DMA0_DD_PENDING (1 << 4)
57 #define VIA_IRQ_DMA0_TD_PENDING (1 << 5)
58 #define VIA_IRQ_DMA1_DD_PENDING (1 << 6)
59 #define VIA_IRQ_DMA1_TD_PENDING (1 << 7)
78 static int via_num_pro_group_a =
ARRAY_SIZE(via_pro_group_a_irqs);
79 static int via_irqmap_pro_group_a[] = {0, 1, -1, 2, -1, 3};
87 static int via_num_unichrome =
ARRAY_SIZE(via_unichrome_irqs);
88 static int via_irqmap_unichrome[] = {-1, -1, -1, 0, -1, 1};
91 static unsigned time_diff(
struct timeval *now,
struct timeval *then)
124 time_diff(&cur_vblank,
131 DRM_DEBUG(
"US per vblank is: %u\n",
139 if (
status & cur_irq->pending_mask) {
179 DRM_ERROR(
"%s: bad crtc %d\n", __func__, crtc);
204 DRM_ERROR(
"%s: bad crtc %d\n", __func__, crtc);
208 via_driver_irq_wait(
struct drm_device *
dev,
unsigned int irq,
int force_sequence,
212 unsigned int cur_irq_sequence;
221 DRM_ERROR(
"called with no initialization\n");
226 DRM_ERROR(
"Trying to wait on unknown irq %d\n", irq);
230 real_irq = dev_priv->
irq_map[irq];
233 DRM_ERROR(
"Video IRQ %d not available on this hardware.\n",
239 cur_irq = dev_priv->
via_irqs + real_irq;
241 if (masks[real_irq][2] && !force_sequence) {
243 ((
VIA_READ(masks[irq][2]) & masks[irq][3]) ==
245 cur_irq_sequence =
atomic_read(&cur_irq->irq_received);
248 (((cur_irq_sequence =
250 *sequence) <= (1 << 23)));
252 *sequence = cur_irq_sequence;
268 DRM_DEBUG(
"dev_priv: %p\n", dev_priv);
277 dev_priv->
irq_masks = via_pro_group_a_irqs;
278 dev_priv->
num_irqs = via_num_pro_group_a;
279 dev_priv->
irq_map = via_irqmap_pro_group_a;
281 dev_priv->
irq_masks = via_unichrome_irqs;
282 dev_priv->
num_irqs = via_num_unichrome;
283 dev_priv->
irq_map = via_irqmap_unichrome;
288 cur_irq->enable_mask = dev_priv->
irq_masks[
i][0];
289 cur_irq->pending_mask = dev_priv->
irq_masks[
i][1];
295 DRM_DEBUG(
"Initializing IRQ %d\n",
i);
306 viadrv_acknowledge_irqs(dev_priv);
315 DRM_DEBUG(
"via_driver_irq_postinstall\n");
359 DRM_ERROR(
"Trying to wait on unknown irq %d\n",
364 cur_irq += irqwait->
request.irq;
378 DRM_ERROR(
"Signals on Via IRQs not implemented yet.\n");
384 ret = via_driver_irq_wait(dev, irqwait->
request.irq, force_sequence,