This source file includes following definitions.
- r128_get_vblank_counter
- r128_driver_irq_handler
- r128_enable_vblank
- r128_disable_vblank
- r128_driver_irq_preinstall
- r128_driver_irq_postinstall
- r128_driver_irq_uninstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 #include <drm/drm_device.h>
34 #include <drm/drm_print.h>
35 #include <drm/drm_vblank.h>
36 #include <drm/r128_drm.h>
37
38 #include "r128_drv.h"
39
40 u32 r128_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
41 {
42 const drm_r128_private_t *dev_priv = dev->dev_private;
43
44 if (pipe != 0)
45 return 0;
46
47 return atomic_read(&dev_priv->vbl_received);
48 }
49
50 irqreturn_t r128_driver_irq_handler(int irq, void *arg)
51 {
52 struct drm_device *dev = (struct drm_device *) arg;
53 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
54 int status;
55
56 status = R128_READ(R128_GEN_INT_STATUS);
57
58
59 if (status & R128_CRTC_VBLANK_INT) {
60 R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK);
61 atomic_inc(&dev_priv->vbl_received);
62 drm_handle_vblank(dev, 0);
63 return IRQ_HANDLED;
64 }
65 return IRQ_NONE;
66 }
67
68 int r128_enable_vblank(struct drm_device *dev, unsigned int pipe)
69 {
70 drm_r128_private_t *dev_priv = dev->dev_private;
71
72 if (pipe != 0) {
73 DRM_ERROR("%s: bad crtc %u\n", __func__, pipe);
74 return -EINVAL;
75 }
76
77 R128_WRITE(R128_GEN_INT_CNTL, R128_CRTC_VBLANK_INT_EN);
78 return 0;
79 }
80
81 void r128_disable_vblank(struct drm_device *dev, unsigned int pipe)
82 {
83 if (pipe != 0)
84 DRM_ERROR("%s: bad crtc %u\n", __func__, pipe);
85
86
87
88
89
90
91
92
93 }
94
95 void r128_driver_irq_preinstall(struct drm_device *dev)
96 {
97 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
98
99
100 R128_WRITE(R128_GEN_INT_CNTL, 0);
101
102 R128_WRITE(R128_GEN_INT_STATUS, R128_CRTC_VBLANK_INT_AK);
103 }
104
105 int r128_driver_irq_postinstall(struct drm_device *dev)
106 {
107 return 0;
108 }
109
110 void r128_driver_irq_uninstall(struct drm_device *dev)
111 {
112 drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
113 if (!dev_priv)
114 return;
115
116
117 R128_WRITE(R128_GEN_INT_CNTL, 0);
118 }