Commit 32a1db42480dc972e8e92be68d9e604f6aff5381
Committed by
Mauro Carvalho Chehab
1 parent
ff01652cf8
V4L/DVB (5591): Saa7146: proper prototype for saa7146_video_do_ioctl()
This patch adds a proper prototype for saa7146_video_do_ioctl() in include/media/saa7146_vv.h. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Showing 2 changed files with 2 additions and 1 deletions Inline Diff
drivers/media/common/saa7146_fops.c
1 | #include <media/saa7146_vv.h> | 1 | #include <media/saa7146_vv.h> |
2 | 2 | ||
3 | #define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1) | 3 | #define BOARD_CAN_DO_VBI(dev) (dev->revision != 0 && dev->vv_data->vbi_minor != -1) |
4 | 4 | ||
5 | /****************************************************************************/ | 5 | /****************************************************************************/ |
6 | /* resource management functions, shamelessly stolen from saa7134 driver */ | 6 | /* resource management functions, shamelessly stolen from saa7134 driver */ |
7 | 7 | ||
8 | int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit) | 8 | int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit) |
9 | { | 9 | { |
10 | struct saa7146_dev *dev = fh->dev; | 10 | struct saa7146_dev *dev = fh->dev; |
11 | struct saa7146_vv *vv = dev->vv_data; | 11 | struct saa7146_vv *vv = dev->vv_data; |
12 | 12 | ||
13 | if (fh->resources & bit) { | 13 | if (fh->resources & bit) { |
14 | DEB_D(("already allocated! want: 0x%02x, cur:0x%02x\n",bit,vv->resources)); | 14 | DEB_D(("already allocated! want: 0x%02x, cur:0x%02x\n",bit,vv->resources)); |
15 | /* have it already allocated */ | 15 | /* have it already allocated */ |
16 | return 1; | 16 | return 1; |
17 | } | 17 | } |
18 | 18 | ||
19 | /* is it free? */ | 19 | /* is it free? */ |
20 | mutex_lock(&dev->lock); | 20 | mutex_lock(&dev->lock); |
21 | if (vv->resources & bit) { | 21 | if (vv->resources & bit) { |
22 | DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit)); | 22 | DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit)); |
23 | /* no, someone else uses it */ | 23 | /* no, someone else uses it */ |
24 | mutex_unlock(&dev->lock); | 24 | mutex_unlock(&dev->lock); |
25 | return 0; | 25 | return 0; |
26 | } | 26 | } |
27 | /* it's free, grab it */ | 27 | /* it's free, grab it */ |
28 | fh->resources |= bit; | 28 | fh->resources |= bit; |
29 | vv->resources |= bit; | 29 | vv->resources |= bit; |
30 | DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources)); | 30 | DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources)); |
31 | mutex_unlock(&dev->lock); | 31 | mutex_unlock(&dev->lock); |
32 | return 1; | 32 | return 1; |
33 | } | 33 | } |
34 | 34 | ||
35 | void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) | 35 | void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) |
36 | { | 36 | { |
37 | struct saa7146_dev *dev = fh->dev; | 37 | struct saa7146_dev *dev = fh->dev; |
38 | struct saa7146_vv *vv = dev->vv_data; | 38 | struct saa7146_vv *vv = dev->vv_data; |
39 | 39 | ||
40 | BUG_ON((fh->resources & bits) != bits); | 40 | BUG_ON((fh->resources & bits) != bits); |
41 | 41 | ||
42 | mutex_lock(&dev->lock); | 42 | mutex_lock(&dev->lock); |
43 | fh->resources &= ~bits; | 43 | fh->resources &= ~bits; |
44 | vv->resources &= ~bits; | 44 | vv->resources &= ~bits; |
45 | DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); | 45 | DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); |
46 | mutex_unlock(&dev->lock); | 46 | mutex_unlock(&dev->lock); |
47 | } | 47 | } |
48 | 48 | ||
49 | 49 | ||
50 | /********************************************************************************/ | 50 | /********************************************************************************/ |
51 | /* common dma functions */ | 51 | /* common dma functions */ |
52 | 52 | ||
53 | void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q, | 53 | void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q, |
54 | struct saa7146_buf *buf) | 54 | struct saa7146_buf *buf) |
55 | { | 55 | { |
56 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); | 56 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); |
57 | 57 | ||
58 | BUG_ON(in_interrupt()); | 58 | BUG_ON(in_interrupt()); |
59 | 59 | ||
60 | videobuf_waiton(&buf->vb,0,0); | 60 | videobuf_waiton(&buf->vb,0,0); |
61 | videobuf_dma_unmap(q, &buf->vb.dma); | 61 | videobuf_dma_unmap(q, &buf->vb.dma); |
62 | videobuf_dma_free(&buf->vb.dma); | 62 | videobuf_dma_free(&buf->vb.dma); |
63 | buf->vb.state = STATE_NEEDS_INIT; | 63 | buf->vb.state = STATE_NEEDS_INIT; |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | /********************************************************************************/ | 67 | /********************************************************************************/ |
68 | /* common buffer functions */ | 68 | /* common buffer functions */ |
69 | 69 | ||
70 | int saa7146_buffer_queue(struct saa7146_dev *dev, | 70 | int saa7146_buffer_queue(struct saa7146_dev *dev, |
71 | struct saa7146_dmaqueue *q, | 71 | struct saa7146_dmaqueue *q, |
72 | struct saa7146_buf *buf) | 72 | struct saa7146_buf *buf) |
73 | { | 73 | { |
74 | assert_spin_locked(&dev->slock); | 74 | assert_spin_locked(&dev->slock); |
75 | DEB_EE(("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf)); | 75 | DEB_EE(("dev:%p, dmaq:%p, buf:%p\n", dev, q, buf)); |
76 | 76 | ||
77 | BUG_ON(!q); | 77 | BUG_ON(!q); |
78 | 78 | ||
79 | if (NULL == q->curr) { | 79 | if (NULL == q->curr) { |
80 | q->curr = buf; | 80 | q->curr = buf; |
81 | DEB_D(("immediately activating buffer %p\n", buf)); | 81 | DEB_D(("immediately activating buffer %p\n", buf)); |
82 | buf->activate(dev,buf,NULL); | 82 | buf->activate(dev,buf,NULL); |
83 | } else { | 83 | } else { |
84 | list_add_tail(&buf->vb.queue,&q->queue); | 84 | list_add_tail(&buf->vb.queue,&q->queue); |
85 | buf->vb.state = STATE_QUEUED; | 85 | buf->vb.state = STATE_QUEUED; |
86 | DEB_D(("adding buffer %p to queue. (active buffer present)\n", buf)); | 86 | DEB_D(("adding buffer %p to queue. (active buffer present)\n", buf)); |
87 | } | 87 | } |
88 | return 0; | 88 | return 0; |
89 | } | 89 | } |
90 | 90 | ||
91 | void saa7146_buffer_finish(struct saa7146_dev *dev, | 91 | void saa7146_buffer_finish(struct saa7146_dev *dev, |
92 | struct saa7146_dmaqueue *q, | 92 | struct saa7146_dmaqueue *q, |
93 | int state) | 93 | int state) |
94 | { | 94 | { |
95 | assert_spin_locked(&dev->slock); | 95 | assert_spin_locked(&dev->slock); |
96 | DEB_EE(("dev:%p, dmaq:%p, state:%d\n", dev, q, state)); | 96 | DEB_EE(("dev:%p, dmaq:%p, state:%d\n", dev, q, state)); |
97 | DEB_EE(("q->curr:%p\n",q->curr)); | 97 | DEB_EE(("q->curr:%p\n",q->curr)); |
98 | 98 | ||
99 | BUG_ON(!q->curr); | 99 | BUG_ON(!q->curr); |
100 | 100 | ||
101 | /* finish current buffer */ | 101 | /* finish current buffer */ |
102 | if (NULL == q->curr) { | 102 | if (NULL == q->curr) { |
103 | DEB_D(("aiii. no current buffer\n")); | 103 | DEB_D(("aiii. no current buffer\n")); |
104 | return; | 104 | return; |
105 | } | 105 | } |
106 | 106 | ||
107 | q->curr->vb.state = state; | 107 | q->curr->vb.state = state; |
108 | do_gettimeofday(&q->curr->vb.ts); | 108 | do_gettimeofday(&q->curr->vb.ts); |
109 | wake_up(&q->curr->vb.done); | 109 | wake_up(&q->curr->vb.done); |
110 | 110 | ||
111 | q->curr = NULL; | 111 | q->curr = NULL; |
112 | } | 112 | } |
113 | 113 | ||
114 | void saa7146_buffer_next(struct saa7146_dev *dev, | 114 | void saa7146_buffer_next(struct saa7146_dev *dev, |
115 | struct saa7146_dmaqueue *q, int vbi) | 115 | struct saa7146_dmaqueue *q, int vbi) |
116 | { | 116 | { |
117 | struct saa7146_buf *buf,*next = NULL; | 117 | struct saa7146_buf *buf,*next = NULL; |
118 | 118 | ||
119 | BUG_ON(!q); | 119 | BUG_ON(!q); |
120 | 120 | ||
121 | DEB_INT(("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi)); | 121 | DEB_INT(("dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi)); |
122 | 122 | ||
123 | assert_spin_locked(&dev->slock); | 123 | assert_spin_locked(&dev->slock); |
124 | if (!list_empty(&q->queue)) { | 124 | if (!list_empty(&q->queue)) { |
125 | /* activate next one from queue */ | 125 | /* activate next one from queue */ |
126 | buf = list_entry(q->queue.next,struct saa7146_buf,vb.queue); | 126 | buf = list_entry(q->queue.next,struct saa7146_buf,vb.queue); |
127 | list_del(&buf->vb.queue); | 127 | list_del(&buf->vb.queue); |
128 | if (!list_empty(&q->queue)) | 128 | if (!list_empty(&q->queue)) |
129 | next = list_entry(q->queue.next,struct saa7146_buf, vb.queue); | 129 | next = list_entry(q->queue.next,struct saa7146_buf, vb.queue); |
130 | q->curr = buf; | 130 | q->curr = buf; |
131 | DEB_INT(("next buffer: buf:%p, prev:%p, next:%p\n", buf, q->queue.prev,q->queue.next)); | 131 | DEB_INT(("next buffer: buf:%p, prev:%p, next:%p\n", buf, q->queue.prev,q->queue.next)); |
132 | buf->activate(dev,buf,next); | 132 | buf->activate(dev,buf,next); |
133 | } else { | 133 | } else { |
134 | DEB_INT(("no next buffer. stopping.\n")); | 134 | DEB_INT(("no next buffer. stopping.\n")); |
135 | if( 0 != vbi ) { | 135 | if( 0 != vbi ) { |
136 | /* turn off video-dma3 */ | 136 | /* turn off video-dma3 */ |
137 | saa7146_write(dev,MC1, MASK_20); | 137 | saa7146_write(dev,MC1, MASK_20); |
138 | } else { | 138 | } else { |
139 | /* nothing to do -- just prevent next video-dma1 transfer | 139 | /* nothing to do -- just prevent next video-dma1 transfer |
140 | by lowering the protection address */ | 140 | by lowering the protection address */ |
141 | 141 | ||
142 | // fixme: fix this for vflip != 0 | 142 | // fixme: fix this for vflip != 0 |
143 | 143 | ||
144 | saa7146_write(dev, PROT_ADDR1, 0); | 144 | saa7146_write(dev, PROT_ADDR1, 0); |
145 | saa7146_write(dev, MC2, (MASK_02|MASK_18)); | 145 | saa7146_write(dev, MC2, (MASK_02|MASK_18)); |
146 | 146 | ||
147 | /* write the address of the rps-program */ | 147 | /* write the address of the rps-program */ |
148 | saa7146_write(dev, RPS_ADDR0, dev->d_rps0.dma_handle); | 148 | saa7146_write(dev, RPS_ADDR0, dev->d_rps0.dma_handle); |
149 | /* turn on rps */ | 149 | /* turn on rps */ |
150 | saa7146_write(dev, MC1, (MASK_12 | MASK_28)); | 150 | saa7146_write(dev, MC1, (MASK_12 | MASK_28)); |
151 | 151 | ||
152 | /* | 152 | /* |
153 | printk("vdma%d.base_even: 0x%08x\n", 1,saa7146_read(dev,BASE_EVEN1)); | 153 | printk("vdma%d.base_even: 0x%08x\n", 1,saa7146_read(dev,BASE_EVEN1)); |
154 | printk("vdma%d.base_odd: 0x%08x\n", 1,saa7146_read(dev,BASE_ODD1)); | 154 | printk("vdma%d.base_odd: 0x%08x\n", 1,saa7146_read(dev,BASE_ODD1)); |
155 | printk("vdma%d.prot_addr: 0x%08x\n", 1,saa7146_read(dev,PROT_ADDR1)); | 155 | printk("vdma%d.prot_addr: 0x%08x\n", 1,saa7146_read(dev,PROT_ADDR1)); |
156 | printk("vdma%d.base_page: 0x%08x\n", 1,saa7146_read(dev,BASE_PAGE1)); | 156 | printk("vdma%d.base_page: 0x%08x\n", 1,saa7146_read(dev,BASE_PAGE1)); |
157 | printk("vdma%d.pitch: 0x%08x\n", 1,saa7146_read(dev,PITCH1)); | 157 | printk("vdma%d.pitch: 0x%08x\n", 1,saa7146_read(dev,PITCH1)); |
158 | printk("vdma%d.num_line_byte: 0x%08x\n", 1,saa7146_read(dev,NUM_LINE_BYTE1)); | 158 | printk("vdma%d.num_line_byte: 0x%08x\n", 1,saa7146_read(dev,NUM_LINE_BYTE1)); |
159 | */ | 159 | */ |
160 | } | 160 | } |
161 | del_timer(&q->timeout); | 161 | del_timer(&q->timeout); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | void saa7146_buffer_timeout(unsigned long data) | 165 | void saa7146_buffer_timeout(unsigned long data) |
166 | { | 166 | { |
167 | struct saa7146_dmaqueue *q = (struct saa7146_dmaqueue*)data; | 167 | struct saa7146_dmaqueue *q = (struct saa7146_dmaqueue*)data; |
168 | struct saa7146_dev *dev = q->dev; | 168 | struct saa7146_dev *dev = q->dev; |
169 | unsigned long flags; | 169 | unsigned long flags; |
170 | 170 | ||
171 | DEB_EE(("dev:%p, dmaq:%p\n", dev, q)); | 171 | DEB_EE(("dev:%p, dmaq:%p\n", dev, q)); |
172 | 172 | ||
173 | spin_lock_irqsave(&dev->slock,flags); | 173 | spin_lock_irqsave(&dev->slock,flags); |
174 | if (q->curr) { | 174 | if (q->curr) { |
175 | DEB_D(("timeout on %p\n", q->curr)); | 175 | DEB_D(("timeout on %p\n", q->curr)); |
176 | saa7146_buffer_finish(dev,q,STATE_ERROR); | 176 | saa7146_buffer_finish(dev,q,STATE_ERROR); |
177 | } | 177 | } |
178 | 178 | ||
179 | /* we don't restart the transfer here like other drivers do. when | 179 | /* we don't restart the transfer here like other drivers do. when |
180 | a streaming capture is disabled, the timeout function will be | 180 | a streaming capture is disabled, the timeout function will be |
181 | called for the current buffer. if we activate the next buffer now, | 181 | called for the current buffer. if we activate the next buffer now, |
182 | we mess up our capture logic. if a timeout occurs on another buffer, | 182 | we mess up our capture logic. if a timeout occurs on another buffer, |
183 | then something is seriously broken before, so no need to buffer the | 183 | then something is seriously broken before, so no need to buffer the |
184 | next capture IMHO... */ | 184 | next capture IMHO... */ |
185 | /* | 185 | /* |
186 | saa7146_buffer_next(dev,q); | 186 | saa7146_buffer_next(dev,q); |
187 | */ | 187 | */ |
188 | spin_unlock_irqrestore(&dev->slock,flags); | 188 | spin_unlock_irqrestore(&dev->slock,flags); |
189 | } | 189 | } |
190 | 190 | ||
191 | /********************************************************************************/ | 191 | /********************************************************************************/ |
192 | /* file operations */ | 192 | /* file operations */ |
193 | 193 | ||
194 | static int fops_open(struct inode *inode, struct file *file) | 194 | static int fops_open(struct inode *inode, struct file *file) |
195 | { | 195 | { |
196 | unsigned int minor = iminor(inode); | 196 | unsigned int minor = iminor(inode); |
197 | struct saa7146_dev *h = NULL, *dev = NULL; | 197 | struct saa7146_dev *h = NULL, *dev = NULL; |
198 | struct list_head *list; | 198 | struct list_head *list; |
199 | struct saa7146_fh *fh = NULL; | 199 | struct saa7146_fh *fh = NULL; |
200 | int result = 0; | 200 | int result = 0; |
201 | 201 | ||
202 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 202 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
203 | 203 | ||
204 | DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor)); | 204 | DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor)); |
205 | 205 | ||
206 | if (mutex_lock_interruptible(&saa7146_devices_lock)) | 206 | if (mutex_lock_interruptible(&saa7146_devices_lock)) |
207 | return -ERESTARTSYS; | 207 | return -ERESTARTSYS; |
208 | 208 | ||
209 | list_for_each(list,&saa7146_devices) { | 209 | list_for_each(list,&saa7146_devices) { |
210 | h = list_entry(list, struct saa7146_dev, item); | 210 | h = list_entry(list, struct saa7146_dev, item); |
211 | if( NULL == h->vv_data ) { | 211 | if( NULL == h->vv_data ) { |
212 | DEB_D(("device %p has not registered video devices.\n",h)); | 212 | DEB_D(("device %p has not registered video devices.\n",h)); |
213 | continue; | 213 | continue; |
214 | } | 214 | } |
215 | DEB_D(("trying: %p @ major %d,%d\n",h,h->vv_data->video_minor,h->vv_data->vbi_minor)); | 215 | DEB_D(("trying: %p @ major %d,%d\n",h,h->vv_data->video_minor,h->vv_data->vbi_minor)); |
216 | 216 | ||
217 | if (h->vv_data->video_minor == minor) { | 217 | if (h->vv_data->video_minor == minor) { |
218 | dev = h; | 218 | dev = h; |
219 | } | 219 | } |
220 | if (h->vv_data->vbi_minor == minor) { | 220 | if (h->vv_data->vbi_minor == minor) { |
221 | type = V4L2_BUF_TYPE_VBI_CAPTURE; | 221 | type = V4L2_BUF_TYPE_VBI_CAPTURE; |
222 | dev = h; | 222 | dev = h; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | if (NULL == dev) { | 225 | if (NULL == dev) { |
226 | DEB_S(("no such video device.\n")); | 226 | DEB_S(("no such video device.\n")); |
227 | result = -ENODEV; | 227 | result = -ENODEV; |
228 | goto out; | 228 | goto out; |
229 | } | 229 | } |
230 | 230 | ||
231 | DEB_D(("using: %p\n",dev)); | 231 | DEB_D(("using: %p\n",dev)); |
232 | 232 | ||
233 | /* check if an extension is registered */ | 233 | /* check if an extension is registered */ |
234 | if( NULL == dev->ext ) { | 234 | if( NULL == dev->ext ) { |
235 | DEB_S(("no extension registered for this device.\n")); | 235 | DEB_S(("no extension registered for this device.\n")); |
236 | result = -ENODEV; | 236 | result = -ENODEV; |
237 | goto out; | 237 | goto out; |
238 | } | 238 | } |
239 | 239 | ||
240 | /* allocate per open data */ | 240 | /* allocate per open data */ |
241 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); | 241 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
242 | if (NULL == fh) { | 242 | if (NULL == fh) { |
243 | DEB_S(("cannot allocate memory for per open data.\n")); | 243 | DEB_S(("cannot allocate memory for per open data.\n")); |
244 | result = -ENOMEM; | 244 | result = -ENOMEM; |
245 | goto out; | 245 | goto out; |
246 | } | 246 | } |
247 | 247 | ||
248 | file->private_data = fh; | 248 | file->private_data = fh; |
249 | fh->dev = dev; | 249 | fh->dev = dev; |
250 | fh->type = type; | 250 | fh->type = type; |
251 | 251 | ||
252 | if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 252 | if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
253 | DEB_S(("initializing vbi...\n")); | 253 | DEB_S(("initializing vbi...\n")); |
254 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 254 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |
255 | result = saa7146_vbi_uops.open(dev,file); | 255 | result = saa7146_vbi_uops.open(dev,file); |
256 | if (dev->ext_vv_data->vbi_fops.open) | 256 | if (dev->ext_vv_data->vbi_fops.open) |
257 | dev->ext_vv_data->vbi_fops.open(inode, file); | 257 | dev->ext_vv_data->vbi_fops.open(inode, file); |
258 | } else { | 258 | } else { |
259 | DEB_S(("initializing video...\n")); | 259 | DEB_S(("initializing video...\n")); |
260 | result = saa7146_video_uops.open(dev,file); | 260 | result = saa7146_video_uops.open(dev,file); |
261 | } | 261 | } |
262 | 262 | ||
263 | if (0 != result) { | 263 | if (0 != result) { |
264 | goto out; | 264 | goto out; |
265 | } | 265 | } |
266 | 266 | ||
267 | if( 0 == try_module_get(dev->ext->module)) { | 267 | if( 0 == try_module_get(dev->ext->module)) { |
268 | result = -EINVAL; | 268 | result = -EINVAL; |
269 | goto out; | 269 | goto out; |
270 | } | 270 | } |
271 | 271 | ||
272 | result = 0; | 272 | result = 0; |
273 | out: | 273 | out: |
274 | if( fh != 0 && result != 0 ) { | 274 | if( fh != 0 && result != 0 ) { |
275 | kfree(fh); | 275 | kfree(fh); |
276 | file->private_data = NULL; | 276 | file->private_data = NULL; |
277 | } | 277 | } |
278 | mutex_unlock(&saa7146_devices_lock); | 278 | mutex_unlock(&saa7146_devices_lock); |
279 | return result; | 279 | return result; |
280 | } | 280 | } |
281 | 281 | ||
282 | static int fops_release(struct inode *inode, struct file *file) | 282 | static int fops_release(struct inode *inode, struct file *file) |
283 | { | 283 | { |
284 | struct saa7146_fh *fh = file->private_data; | 284 | struct saa7146_fh *fh = file->private_data; |
285 | struct saa7146_dev *dev = fh->dev; | 285 | struct saa7146_dev *dev = fh->dev; |
286 | 286 | ||
287 | DEB_EE(("inode:%p, file:%p\n",inode,file)); | 287 | DEB_EE(("inode:%p, file:%p\n",inode,file)); |
288 | 288 | ||
289 | if (mutex_lock_interruptible(&saa7146_devices_lock)) | 289 | if (mutex_lock_interruptible(&saa7146_devices_lock)) |
290 | return -ERESTARTSYS; | 290 | return -ERESTARTSYS; |
291 | 291 | ||
292 | if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 292 | if( fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
293 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 293 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |
294 | saa7146_vbi_uops.release(dev,file); | 294 | saa7146_vbi_uops.release(dev,file); |
295 | if (dev->ext_vv_data->vbi_fops.release) | 295 | if (dev->ext_vv_data->vbi_fops.release) |
296 | dev->ext_vv_data->vbi_fops.release(inode, file); | 296 | dev->ext_vv_data->vbi_fops.release(inode, file); |
297 | } else { | 297 | } else { |
298 | saa7146_video_uops.release(dev,file); | 298 | saa7146_video_uops.release(dev,file); |
299 | } | 299 | } |
300 | 300 | ||
301 | module_put(dev->ext->module); | 301 | module_put(dev->ext->module); |
302 | file->private_data = NULL; | 302 | file->private_data = NULL; |
303 | kfree(fh); | 303 | kfree(fh); |
304 | 304 | ||
305 | mutex_unlock(&saa7146_devices_lock); | 305 | mutex_unlock(&saa7146_devices_lock); |
306 | 306 | ||
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | 309 | ||
310 | int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg); | ||
311 | static int fops_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 310 | static int fops_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
312 | { | 311 | { |
313 | /* | 312 | /* |
314 | DEB_EE(("inode:%p, file:%p, cmd:%d, arg:%li\n",inode, file, cmd, arg)); | 313 | DEB_EE(("inode:%p, file:%p, cmd:%d, arg:%li\n",inode, file, cmd, arg)); |
315 | */ | 314 | */ |
316 | return video_usercopy(inode, file, cmd, arg, saa7146_video_do_ioctl); | 315 | return video_usercopy(inode, file, cmd, arg, saa7146_video_do_ioctl); |
317 | } | 316 | } |
318 | 317 | ||
319 | static int fops_mmap(struct file *file, struct vm_area_struct * vma) | 318 | static int fops_mmap(struct file *file, struct vm_area_struct * vma) |
320 | { | 319 | { |
321 | struct saa7146_fh *fh = file->private_data; | 320 | struct saa7146_fh *fh = file->private_data; |
322 | struct videobuf_queue *q; | 321 | struct videobuf_queue *q; |
323 | 322 | ||
324 | switch (fh->type) { | 323 | switch (fh->type) { |
325 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { | 324 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { |
326 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n",file, vma)); | 325 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n",file, vma)); |
327 | q = &fh->video_q; | 326 | q = &fh->video_q; |
328 | break; | 327 | break; |
329 | } | 328 | } |
330 | case V4L2_BUF_TYPE_VBI_CAPTURE: { | 329 | case V4L2_BUF_TYPE_VBI_CAPTURE: { |
331 | DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n",file, vma)); | 330 | DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n",file, vma)); |
332 | q = &fh->vbi_q; | 331 | q = &fh->vbi_q; |
333 | break; | 332 | break; |
334 | } | 333 | } |
335 | default: | 334 | default: |
336 | BUG(); | 335 | BUG(); |
337 | return 0; | 336 | return 0; |
338 | } | 337 | } |
339 | 338 | ||
340 | return videobuf_mmap_mapper(q,vma); | 339 | return videobuf_mmap_mapper(q,vma); |
341 | } | 340 | } |
342 | 341 | ||
343 | static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) | 342 | static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait) |
344 | { | 343 | { |
345 | struct saa7146_fh *fh = file->private_data; | 344 | struct saa7146_fh *fh = file->private_data; |
346 | struct videobuf_buffer *buf = NULL; | 345 | struct videobuf_buffer *buf = NULL; |
347 | struct videobuf_queue *q; | 346 | struct videobuf_queue *q; |
348 | 347 | ||
349 | DEB_EE(("file:%p, poll:%p\n",file, wait)); | 348 | DEB_EE(("file:%p, poll:%p\n",file, wait)); |
350 | 349 | ||
351 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { | 350 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { |
352 | if( 0 == fh->vbi_q.streaming ) | 351 | if( 0 == fh->vbi_q.streaming ) |
353 | return videobuf_poll_stream(file, &fh->vbi_q, wait); | 352 | return videobuf_poll_stream(file, &fh->vbi_q, wait); |
354 | q = &fh->vbi_q; | 353 | q = &fh->vbi_q; |
355 | } else { | 354 | } else { |
356 | DEB_D(("using video queue.\n")); | 355 | DEB_D(("using video queue.\n")); |
357 | q = &fh->video_q; | 356 | q = &fh->video_q; |
358 | } | 357 | } |
359 | 358 | ||
360 | if (!list_empty(&q->stream)) | 359 | if (!list_empty(&q->stream)) |
361 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); | 360 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); |
362 | 361 | ||
363 | if (!buf) { | 362 | if (!buf) { |
364 | DEB_D(("buf == NULL!\n")); | 363 | DEB_D(("buf == NULL!\n")); |
365 | return POLLERR; | 364 | return POLLERR; |
366 | } | 365 | } |
367 | 366 | ||
368 | poll_wait(file, &buf->done, wait); | 367 | poll_wait(file, &buf->done, wait); |
369 | if (buf->state == STATE_DONE || buf->state == STATE_ERROR) { | 368 | if (buf->state == STATE_DONE || buf->state == STATE_ERROR) { |
370 | DEB_D(("poll succeeded!\n")); | 369 | DEB_D(("poll succeeded!\n")); |
371 | return POLLIN|POLLRDNORM; | 370 | return POLLIN|POLLRDNORM; |
372 | } | 371 | } |
373 | 372 | ||
374 | DEB_D(("nothing to poll for, buf->state:%d\n",buf->state)); | 373 | DEB_D(("nothing to poll for, buf->state:%d\n",buf->state)); |
375 | return 0; | 374 | return 0; |
376 | } | 375 | } |
377 | 376 | ||
378 | static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos) | 377 | static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos) |
379 | { | 378 | { |
380 | struct saa7146_fh *fh = file->private_data; | 379 | struct saa7146_fh *fh = file->private_data; |
381 | 380 | ||
382 | switch (fh->type) { | 381 | switch (fh->type) { |
383 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { | 382 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: { |
384 | // DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun", file, data, (unsigned long)count)); | 383 | // DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, data:%p, count:%lun", file, data, (unsigned long)count)); |
385 | return saa7146_video_uops.read(file,data,count,ppos); | 384 | return saa7146_video_uops.read(file,data,count,ppos); |
386 | } | 385 | } |
387 | case V4L2_BUF_TYPE_VBI_CAPTURE: { | 386 | case V4L2_BUF_TYPE_VBI_CAPTURE: { |
388 | // DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", file, data, (unsigned long)count)); | 387 | // DEB_EE(("V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, data:%p, count:%lu\n", file, data, (unsigned long)count)); |
389 | if (fh->dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 388 | if (fh->dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |
390 | return saa7146_vbi_uops.read(file,data,count,ppos); | 389 | return saa7146_vbi_uops.read(file,data,count,ppos); |
391 | else | 390 | else |
392 | return -EINVAL; | 391 | return -EINVAL; |
393 | } | 392 | } |
394 | break; | 393 | break; |
395 | default: | 394 | default: |
396 | BUG(); | 395 | BUG(); |
397 | return 0; | 396 | return 0; |
398 | } | 397 | } |
399 | } | 398 | } |
400 | 399 | ||
401 | static ssize_t fops_write(struct file *file, const char __user *data, size_t count, loff_t *ppos) | 400 | static ssize_t fops_write(struct file *file, const char __user *data, size_t count, loff_t *ppos) |
402 | { | 401 | { |
403 | struct saa7146_fh *fh = file->private_data; | 402 | struct saa7146_fh *fh = file->private_data; |
404 | 403 | ||
405 | switch (fh->type) { | 404 | switch (fh->type) { |
406 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | 405 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
407 | return -EINVAL; | 406 | return -EINVAL; |
408 | case V4L2_BUF_TYPE_VBI_CAPTURE: | 407 | case V4L2_BUF_TYPE_VBI_CAPTURE: |
409 | if (fh->dev->ext_vv_data->vbi_fops.write) | 408 | if (fh->dev->ext_vv_data->vbi_fops.write) |
410 | return fh->dev->ext_vv_data->vbi_fops.write(file, data, count, ppos); | 409 | return fh->dev->ext_vv_data->vbi_fops.write(file, data, count, ppos); |
411 | else | 410 | else |
412 | return -EINVAL; | 411 | return -EINVAL; |
413 | default: | 412 | default: |
414 | BUG(); | 413 | BUG(); |
415 | return -EINVAL; | 414 | return -EINVAL; |
416 | } | 415 | } |
417 | } | 416 | } |
418 | 417 | ||
419 | static const struct file_operations video_fops = | 418 | static const struct file_operations video_fops = |
420 | { | 419 | { |
421 | .owner = THIS_MODULE, | 420 | .owner = THIS_MODULE, |
422 | .open = fops_open, | 421 | .open = fops_open, |
423 | .release = fops_release, | 422 | .release = fops_release, |
424 | .read = fops_read, | 423 | .read = fops_read, |
425 | .write = fops_write, | 424 | .write = fops_write, |
426 | .poll = fops_poll, | 425 | .poll = fops_poll, |
427 | .mmap = fops_mmap, | 426 | .mmap = fops_mmap, |
428 | .ioctl = fops_ioctl, | 427 | .ioctl = fops_ioctl, |
429 | .llseek = no_llseek, | 428 | .llseek = no_llseek, |
430 | }; | 429 | }; |
431 | 430 | ||
432 | static void vv_callback(struct saa7146_dev *dev, unsigned long status) | 431 | static void vv_callback(struct saa7146_dev *dev, unsigned long status) |
433 | { | 432 | { |
434 | u32 isr = status; | 433 | u32 isr = status; |
435 | 434 | ||
436 | DEB_INT(("dev:%p, isr:0x%08x\n",dev,(u32)status)); | 435 | DEB_INT(("dev:%p, isr:0x%08x\n",dev,(u32)status)); |
437 | 436 | ||
438 | if (0 != (isr & (MASK_27))) { | 437 | if (0 != (isr & (MASK_27))) { |
439 | DEB_INT(("irq: RPS0 (0x%08x).\n",isr)); | 438 | DEB_INT(("irq: RPS0 (0x%08x).\n",isr)); |
440 | saa7146_video_uops.irq_done(dev,isr); | 439 | saa7146_video_uops.irq_done(dev,isr); |
441 | } | 440 | } |
442 | 441 | ||
443 | if (0 != (isr & (MASK_28))) { | 442 | if (0 != (isr & (MASK_28))) { |
444 | u32 mc2 = saa7146_read(dev, MC2); | 443 | u32 mc2 = saa7146_read(dev, MC2); |
445 | if( 0 != (mc2 & MASK_15)) { | 444 | if( 0 != (mc2 & MASK_15)) { |
446 | DEB_INT(("irq: RPS1 vbi workaround (0x%08x).\n",isr)); | 445 | DEB_INT(("irq: RPS1 vbi workaround (0x%08x).\n",isr)); |
447 | wake_up(&dev->vv_data->vbi_wq); | 446 | wake_up(&dev->vv_data->vbi_wq); |
448 | saa7146_write(dev,MC2, MASK_31); | 447 | saa7146_write(dev,MC2, MASK_31); |
449 | return; | 448 | return; |
450 | } | 449 | } |
451 | DEB_INT(("irq: RPS1 (0x%08x).\n",isr)); | 450 | DEB_INT(("irq: RPS1 (0x%08x).\n",isr)); |
452 | saa7146_vbi_uops.irq_done(dev,isr); | 451 | saa7146_vbi_uops.irq_done(dev,isr); |
453 | } | 452 | } |
454 | } | 453 | } |
455 | 454 | ||
456 | static struct video_device device_template = | 455 | static struct video_device device_template = |
457 | { | 456 | { |
458 | .fops = &video_fops, | 457 | .fops = &video_fops, |
459 | .minor = -1, | 458 | .minor = -1, |
460 | }; | 459 | }; |
461 | 460 | ||
462 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) | 461 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) |
463 | { | 462 | { |
464 | struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL); | 463 | struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL); |
465 | if( NULL == vv ) { | 464 | if( NULL == vv ) { |
466 | ERR(("out of memory. aborting.\n")); | 465 | ERR(("out of memory. aborting.\n")); |
467 | return -1; | 466 | return -1; |
468 | } | 467 | } |
469 | 468 | ||
470 | DEB_EE(("dev:%p\n",dev)); | 469 | DEB_EE(("dev:%p\n",dev)); |
471 | 470 | ||
472 | /* set default values for video parts of the saa7146 */ | 471 | /* set default values for video parts of the saa7146 */ |
473 | saa7146_write(dev, BCS_CTRL, 0x80400040); | 472 | saa7146_write(dev, BCS_CTRL, 0x80400040); |
474 | 473 | ||
475 | /* enable video-port pins */ | 474 | /* enable video-port pins */ |
476 | saa7146_write(dev, MC1, (MASK_10 | MASK_26)); | 475 | saa7146_write(dev, MC1, (MASK_10 | MASK_26)); |
477 | 476 | ||
478 | /* save per-device extension data (one extension can | 477 | /* save per-device extension data (one extension can |
479 | handle different devices that might need different | 478 | handle different devices that might need different |
480 | configuration data) */ | 479 | configuration data) */ |
481 | dev->ext_vv_data = ext_vv; | 480 | dev->ext_vv_data = ext_vv; |
482 | 481 | ||
483 | vv->video_minor = -1; | 482 | vv->video_minor = -1; |
484 | vv->vbi_minor = -1; | 483 | vv->vbi_minor = -1; |
485 | 484 | ||
486 | vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); | 485 | vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle); |
487 | if( NULL == vv->d_clipping.cpu_addr ) { | 486 | if( NULL == vv->d_clipping.cpu_addr ) { |
488 | ERR(("out of memory. aborting.\n")); | 487 | ERR(("out of memory. aborting.\n")); |
489 | kfree(vv); | 488 | kfree(vv); |
490 | return -1; | 489 | return -1; |
491 | } | 490 | } |
492 | memset(vv->d_clipping.cpu_addr, 0x0, SAA7146_CLIPPING_MEM); | 491 | memset(vv->d_clipping.cpu_addr, 0x0, SAA7146_CLIPPING_MEM); |
493 | 492 | ||
494 | saa7146_video_uops.init(dev,vv); | 493 | saa7146_video_uops.init(dev,vv); |
495 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) | 494 | if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) |
496 | saa7146_vbi_uops.init(dev,vv); | 495 | saa7146_vbi_uops.init(dev,vv); |
497 | 496 | ||
498 | dev->vv_data = vv; | 497 | dev->vv_data = vv; |
499 | dev->vv_callback = &vv_callback; | 498 | dev->vv_callback = &vv_callback; |
500 | 499 | ||
501 | return 0; | 500 | return 0; |
502 | } | 501 | } |
503 | EXPORT_SYMBOL_GPL(saa7146_vv_init); | 502 | EXPORT_SYMBOL_GPL(saa7146_vv_init); |
504 | 503 | ||
505 | int saa7146_vv_release(struct saa7146_dev* dev) | 504 | int saa7146_vv_release(struct saa7146_dev* dev) |
506 | { | 505 | { |
507 | struct saa7146_vv *vv = dev->vv_data; | 506 | struct saa7146_vv *vv = dev->vv_data; |
508 | 507 | ||
509 | DEB_EE(("dev:%p\n",dev)); | 508 | DEB_EE(("dev:%p\n",dev)); |
510 | 509 | ||
511 | pci_free_consistent(dev->pci, SAA7146_CLIPPING_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle); | 510 | pci_free_consistent(dev->pci, SAA7146_CLIPPING_MEM, vv->d_clipping.cpu_addr, vv->d_clipping.dma_handle); |
512 | kfree(vv); | 511 | kfree(vv); |
513 | dev->vv_data = NULL; | 512 | dev->vv_data = NULL; |
514 | dev->vv_callback = NULL; | 513 | dev->vv_callback = NULL; |
515 | 514 | ||
516 | return 0; | 515 | return 0; |
517 | } | 516 | } |
518 | EXPORT_SYMBOL_GPL(saa7146_vv_release); | 517 | EXPORT_SYMBOL_GPL(saa7146_vv_release); |
519 | 518 | ||
520 | int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, | 519 | int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, |
521 | char *name, int type) | 520 | char *name, int type) |
522 | { | 521 | { |
523 | struct saa7146_vv *vv = dev->vv_data; | 522 | struct saa7146_vv *vv = dev->vv_data; |
524 | struct video_device *vfd; | 523 | struct video_device *vfd; |
525 | 524 | ||
526 | DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); | 525 | DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); |
527 | 526 | ||
528 | // released by vfd->release | 527 | // released by vfd->release |
529 | vfd = video_device_alloc(); | 528 | vfd = video_device_alloc(); |
530 | if (vfd == NULL) | 529 | if (vfd == NULL) |
531 | return -ENOMEM; | 530 | return -ENOMEM; |
532 | 531 | ||
533 | memcpy(vfd, &device_template, sizeof(struct video_device)); | 532 | memcpy(vfd, &device_template, sizeof(struct video_device)); |
534 | strlcpy(vfd->name, name, sizeof(vfd->name)); | 533 | strlcpy(vfd->name, name, sizeof(vfd->name)); |
535 | vfd->release = video_device_release; | 534 | vfd->release = video_device_release; |
536 | vfd->priv = dev; | 535 | vfd->priv = dev; |
537 | 536 | ||
538 | // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr"); | 537 | // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr"); |
539 | if (video_register_device(vfd, type, -1) < 0) { | 538 | if (video_register_device(vfd, type, -1) < 0) { |
540 | ERR(("cannot register v4l2 device. skipping.\n")); | 539 | ERR(("cannot register v4l2 device. skipping.\n")); |
541 | return -1; | 540 | return -1; |
542 | } | 541 | } |
543 | 542 | ||
544 | if( VFL_TYPE_GRABBER == type ) { | 543 | if( VFL_TYPE_GRABBER == type ) { |
545 | vv->video_minor = vfd->minor; | 544 | vv->video_minor = vfd->minor; |
546 | INFO(("%s: registered device video%d [v4l2]\n", | 545 | INFO(("%s: registered device video%d [v4l2]\n", |
547 | dev->name, vfd->minor & 0x1f)); | 546 | dev->name, vfd->minor & 0x1f)); |
548 | } else { | 547 | } else { |
549 | vv->vbi_minor = vfd->minor; | 548 | vv->vbi_minor = vfd->minor; |
550 | INFO(("%s: registered device vbi%d [v4l2]\n", | 549 | INFO(("%s: registered device vbi%d [v4l2]\n", |
551 | dev->name, vfd->minor & 0x1f)); | 550 | dev->name, vfd->minor & 0x1f)); |
552 | } | 551 | } |
553 | 552 | ||
554 | *vid = vfd; | 553 | *vid = vfd; |
555 | return 0; | 554 | return 0; |
556 | } | 555 | } |
557 | EXPORT_SYMBOL_GPL(saa7146_register_device); | 556 | EXPORT_SYMBOL_GPL(saa7146_register_device); |
558 | 557 | ||
559 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) | 558 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) |
560 | { | 559 | { |
561 | struct saa7146_vv *vv = dev->vv_data; | 560 | struct saa7146_vv *vv = dev->vv_data; |
562 | 561 | ||
563 | DEB_EE(("dev:%p\n",dev)); | 562 | DEB_EE(("dev:%p\n",dev)); |
564 | 563 | ||
565 | if( VFL_TYPE_GRABBER == (*vid)->type ) { | 564 | if( VFL_TYPE_GRABBER == (*vid)->type ) { |
566 | vv->video_minor = -1; | 565 | vv->video_minor = -1; |
567 | } else { | 566 | } else { |
568 | vv->vbi_minor = -1; | 567 | vv->vbi_minor = -1; |
569 | } | 568 | } |
570 | 569 | ||
571 | video_unregister_device(*vid); | 570 | video_unregister_device(*vid); |
572 | *vid = NULL; | 571 | *vid = NULL; |
573 | 572 | ||
574 | return 0; | 573 | return 0; |
575 | } | 574 | } |
576 | EXPORT_SYMBOL_GPL(saa7146_unregister_device); | 575 | EXPORT_SYMBOL_GPL(saa7146_unregister_device); |
577 | 576 | ||
578 | static int __init saa7146_vv_init_module(void) | 577 | static int __init saa7146_vv_init_module(void) |
579 | { | 578 | { |
580 | return 0; | 579 | return 0; |
581 | } | 580 | } |
582 | 581 | ||
583 | 582 | ||
584 | static void __exit saa7146_vv_cleanup_module(void) | 583 | static void __exit saa7146_vv_cleanup_module(void) |
585 | { | 584 | { |
586 | } | 585 | } |
587 | 586 | ||
588 | module_init(saa7146_vv_init_module); | 587 | module_init(saa7146_vv_init_module); |
589 | module_exit(saa7146_vv_cleanup_module); | 588 | module_exit(saa7146_vv_cleanup_module); |
590 | 589 | ||
591 | MODULE_AUTHOR("Michael Hunold <michael@mihu.de>"); | 590 | MODULE_AUTHOR("Michael Hunold <michael@mihu.de>"); |
592 | MODULE_DESCRIPTION("video4linux driver for saa7146-based hardware"); | 591 | MODULE_DESCRIPTION("video4linux driver for saa7146-based hardware"); |
593 | MODULE_LICENSE("GPL"); | 592 | MODULE_LICENSE("GPL"); |
594 | 593 |
include/media/saa7146_vv.h
1 | #ifndef __SAA7146_VV__ | 1 | #ifndef __SAA7146_VV__ |
2 | #define __SAA7146_VV__ | 2 | #define __SAA7146_VV__ |
3 | 3 | ||
4 | #include <linux/videodev.h> | 4 | #include <linux/videodev.h> |
5 | #include <media/v4l2-common.h> | 5 | #include <media/v4l2-common.h> |
6 | #include <media/saa7146.h> | 6 | #include <media/saa7146.h> |
7 | #include <media/video-buf.h> | 7 | #include <media/video-buf.h> |
8 | 8 | ||
9 | #define MAX_SAA7146_CAPTURE_BUFFERS 32 /* arbitrary */ | 9 | #define MAX_SAA7146_CAPTURE_BUFFERS 32 /* arbitrary */ |
10 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ | 10 | #define BUFFER_TIMEOUT (HZ/2) /* 0.5 seconds */ |
11 | 11 | ||
12 | #define WRITE_RPS0(x) do { \ | 12 | #define WRITE_RPS0(x) do { \ |
13 | dev->d_rps0.cpu_addr[ count++ ] = cpu_to_le32(x); \ | 13 | dev->d_rps0.cpu_addr[ count++ ] = cpu_to_le32(x); \ |
14 | } while (0); | 14 | } while (0); |
15 | 15 | ||
16 | #define WRITE_RPS1(x) do { \ | 16 | #define WRITE_RPS1(x) do { \ |
17 | dev->d_rps1.cpu_addr[ count++ ] = cpu_to_le32(x); \ | 17 | dev->d_rps1.cpu_addr[ count++ ] = cpu_to_le32(x); \ |
18 | } while (0); | 18 | } while (0); |
19 | 19 | ||
20 | struct saa7146_video_dma { | 20 | struct saa7146_video_dma { |
21 | u32 base_odd; | 21 | u32 base_odd; |
22 | u32 base_even; | 22 | u32 base_even; |
23 | u32 prot_addr; | 23 | u32 prot_addr; |
24 | u32 pitch; | 24 | u32 pitch; |
25 | u32 base_page; | 25 | u32 base_page; |
26 | u32 num_line_byte; | 26 | u32 num_line_byte; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #define FORMAT_BYTE_SWAP 0x1 | 29 | #define FORMAT_BYTE_SWAP 0x1 |
30 | #define FORMAT_IS_PLANAR 0x2 | 30 | #define FORMAT_IS_PLANAR 0x2 |
31 | 31 | ||
32 | struct saa7146_format { | 32 | struct saa7146_format { |
33 | char *name; | 33 | char *name; |
34 | u32 pixelformat; | 34 | u32 pixelformat; |
35 | u32 trans; | 35 | u32 trans; |
36 | u8 depth; | 36 | u8 depth; |
37 | u8 flags; | 37 | u8 flags; |
38 | u8 swap; | 38 | u8 swap; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct saa7146_standard | 41 | struct saa7146_standard |
42 | { | 42 | { |
43 | char *name; | 43 | char *name; |
44 | v4l2_std_id id; | 44 | v4l2_std_id id; |
45 | 45 | ||
46 | int v_offset; /* number of lines of vertical offset before processing */ | 46 | int v_offset; /* number of lines of vertical offset before processing */ |
47 | int v_field; /* number of lines in a field for HPS to process */ | 47 | int v_field; /* number of lines in a field for HPS to process */ |
48 | 48 | ||
49 | int h_offset; /* horizontal offset of processing window */ | 49 | int h_offset; /* horizontal offset of processing window */ |
50 | int h_pixels; /* number of horizontal pixels to process */ | 50 | int h_pixels; /* number of horizontal pixels to process */ |
51 | 51 | ||
52 | int v_max_out; | 52 | int v_max_out; |
53 | int h_max_out; | 53 | int h_max_out; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | /* buffer for one video/vbi frame */ | 56 | /* buffer for one video/vbi frame */ |
57 | struct saa7146_buf { | 57 | struct saa7146_buf { |
58 | /* common v4l buffer stuff -- must be first */ | 58 | /* common v4l buffer stuff -- must be first */ |
59 | struct videobuf_buffer vb; | 59 | struct videobuf_buffer vb; |
60 | 60 | ||
61 | /* saa7146 specific */ | 61 | /* saa7146 specific */ |
62 | struct v4l2_pix_format *fmt; | 62 | struct v4l2_pix_format *fmt; |
63 | int (*activate)(struct saa7146_dev *dev, | 63 | int (*activate)(struct saa7146_dev *dev, |
64 | struct saa7146_buf *buf, | 64 | struct saa7146_buf *buf, |
65 | struct saa7146_buf *next); | 65 | struct saa7146_buf *next); |
66 | 66 | ||
67 | /* page tables */ | 67 | /* page tables */ |
68 | struct saa7146_pgtable pt[3]; | 68 | struct saa7146_pgtable pt[3]; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | struct saa7146_dmaqueue { | 71 | struct saa7146_dmaqueue { |
72 | struct saa7146_dev *dev; | 72 | struct saa7146_dev *dev; |
73 | struct saa7146_buf *curr; | 73 | struct saa7146_buf *curr; |
74 | struct list_head queue; | 74 | struct list_head queue; |
75 | struct timer_list timeout; | 75 | struct timer_list timeout; |
76 | }; | 76 | }; |
77 | 77 | ||
78 | struct saa7146_overlay { | 78 | struct saa7146_overlay { |
79 | struct saa7146_fh *fh; | 79 | struct saa7146_fh *fh; |
80 | struct v4l2_window win; | 80 | struct v4l2_window win; |
81 | struct v4l2_clip clips[16]; | 81 | struct v4l2_clip clips[16]; |
82 | int nclips; | 82 | int nclips; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | /* per open data */ | 85 | /* per open data */ |
86 | struct saa7146_fh { | 86 | struct saa7146_fh { |
87 | struct saa7146_dev *dev; | 87 | struct saa7146_dev *dev; |
88 | /* if this is a vbi or capture open */ | 88 | /* if this is a vbi or capture open */ |
89 | enum v4l2_buf_type type; | 89 | enum v4l2_buf_type type; |
90 | 90 | ||
91 | /* video overlay */ | 91 | /* video overlay */ |
92 | struct saa7146_overlay ov; | 92 | struct saa7146_overlay ov; |
93 | 93 | ||
94 | /* video capture */ | 94 | /* video capture */ |
95 | struct videobuf_queue video_q; | 95 | struct videobuf_queue video_q; |
96 | struct v4l2_pix_format video_fmt; | 96 | struct v4l2_pix_format video_fmt; |
97 | 97 | ||
98 | /* vbi capture */ | 98 | /* vbi capture */ |
99 | struct videobuf_queue vbi_q; | 99 | struct videobuf_queue vbi_q; |
100 | struct v4l2_vbi_format vbi_fmt; | 100 | struct v4l2_vbi_format vbi_fmt; |
101 | struct timer_list vbi_read_timeout; | 101 | struct timer_list vbi_read_timeout; |
102 | 102 | ||
103 | unsigned int resources; /* resource management for device open */ | 103 | unsigned int resources; /* resource management for device open */ |
104 | }; | 104 | }; |
105 | 105 | ||
106 | #define STATUS_OVERLAY 0x01 | 106 | #define STATUS_OVERLAY 0x01 |
107 | #define STATUS_CAPTURE 0x02 | 107 | #define STATUS_CAPTURE 0x02 |
108 | 108 | ||
109 | struct saa7146_vv | 109 | struct saa7146_vv |
110 | { | 110 | { |
111 | int vbi_minor; | 111 | int vbi_minor; |
112 | 112 | ||
113 | /* vbi capture */ | 113 | /* vbi capture */ |
114 | struct saa7146_dmaqueue vbi_q; | 114 | struct saa7146_dmaqueue vbi_q; |
115 | /* vbi workaround interrupt queue */ | 115 | /* vbi workaround interrupt queue */ |
116 | wait_queue_head_t vbi_wq; | 116 | wait_queue_head_t vbi_wq; |
117 | int vbi_fieldcount; | 117 | int vbi_fieldcount; |
118 | struct saa7146_fh *vbi_streaming; | 118 | struct saa7146_fh *vbi_streaming; |
119 | 119 | ||
120 | int video_minor; | 120 | int video_minor; |
121 | 121 | ||
122 | int video_status; | 122 | int video_status; |
123 | struct saa7146_fh *video_fh; | 123 | struct saa7146_fh *video_fh; |
124 | 124 | ||
125 | /* video overlay */ | 125 | /* video overlay */ |
126 | struct v4l2_framebuffer ov_fb; | 126 | struct v4l2_framebuffer ov_fb; |
127 | struct saa7146_format *ov_fmt; | 127 | struct saa7146_format *ov_fmt; |
128 | struct saa7146_overlay *ov_data; | 128 | struct saa7146_overlay *ov_data; |
129 | struct saa7146_fh *ov_suspend; | 129 | struct saa7146_fh *ov_suspend; |
130 | 130 | ||
131 | /* video capture */ | 131 | /* video capture */ |
132 | struct saa7146_dmaqueue video_q; | 132 | struct saa7146_dmaqueue video_q; |
133 | enum v4l2_field last_field; | 133 | enum v4l2_field last_field; |
134 | 134 | ||
135 | /* common: fixme? shouldn't this be in saa7146_fh? | 135 | /* common: fixme? shouldn't this be in saa7146_fh? |
136 | (this leads to a more complicated question: shall the driver | 136 | (this leads to a more complicated question: shall the driver |
137 | store the different settings (for example S_INPUT) for every open | 137 | store the different settings (for example S_INPUT) for every open |
138 | and restore it appropriately, or should all settings be common for | 138 | and restore it appropriately, or should all settings be common for |
139 | all opens? currently, we do the latter, like all other | 139 | all opens? currently, we do the latter, like all other |
140 | drivers do... */ | 140 | drivers do... */ |
141 | struct saa7146_standard *standard; | 141 | struct saa7146_standard *standard; |
142 | 142 | ||
143 | int vflip; | 143 | int vflip; |
144 | int hflip; | 144 | int hflip; |
145 | int current_hps_source; | 145 | int current_hps_source; |
146 | int current_hps_sync; | 146 | int current_hps_sync; |
147 | 147 | ||
148 | struct saa7146_dma d_clipping; /* pointer to clipping memory */ | 148 | struct saa7146_dma d_clipping; /* pointer to clipping memory */ |
149 | 149 | ||
150 | unsigned int resources; /* resource management for device */ | 150 | unsigned int resources; /* resource management for device */ |
151 | }; | 151 | }; |
152 | 152 | ||
153 | #define SAA7146_EXCLUSIVE 0x1 | 153 | #define SAA7146_EXCLUSIVE 0x1 |
154 | #define SAA7146_BEFORE 0x2 | 154 | #define SAA7146_BEFORE 0x2 |
155 | #define SAA7146_AFTER 0x4 | 155 | #define SAA7146_AFTER 0x4 |
156 | 156 | ||
157 | struct saa7146_extension_ioctls | 157 | struct saa7146_extension_ioctls |
158 | { | 158 | { |
159 | unsigned int cmd; | 159 | unsigned int cmd; |
160 | int flags; | 160 | int flags; |
161 | }; | 161 | }; |
162 | 162 | ||
163 | /* flags */ | 163 | /* flags */ |
164 | #define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */ | 164 | #define SAA7146_USE_PORT_B_FOR_VBI 0x2 /* use input port b for vbi hardware bug workaround */ |
165 | 165 | ||
166 | struct saa7146_ext_vv | 166 | struct saa7146_ext_vv |
167 | { | 167 | { |
168 | /* informations about the video capabilities of the device */ | 168 | /* informations about the video capabilities of the device */ |
169 | int inputs; | 169 | int inputs; |
170 | int audios; | 170 | int audios; |
171 | u32 capabilities; | 171 | u32 capabilities; |
172 | int flags; | 172 | int flags; |
173 | 173 | ||
174 | /* additionally supported transmission standards */ | 174 | /* additionally supported transmission standards */ |
175 | struct saa7146_standard *stds; | 175 | struct saa7146_standard *stds; |
176 | int num_stds; | 176 | int num_stds; |
177 | int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); | 177 | int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); |
178 | 178 | ||
179 | struct saa7146_extension_ioctls *ioctls; | 179 | struct saa7146_extension_ioctls *ioctls; |
180 | int (*ioctl)(struct saa7146_fh*, unsigned int cmd, void *arg); | 180 | int (*ioctl)(struct saa7146_fh*, unsigned int cmd, void *arg); |
181 | 181 | ||
182 | struct file_operations vbi_fops; | 182 | struct file_operations vbi_fops; |
183 | }; | 183 | }; |
184 | 184 | ||
185 | struct saa7146_use_ops { | 185 | struct saa7146_use_ops { |
186 | void (*init)(struct saa7146_dev *, struct saa7146_vv *); | 186 | void (*init)(struct saa7146_dev *, struct saa7146_vv *); |
187 | int(*open)(struct saa7146_dev *, struct file *); | 187 | int(*open)(struct saa7146_dev *, struct file *); |
188 | void (*release)(struct saa7146_dev *, struct file *); | 188 | void (*release)(struct saa7146_dev *, struct file *); |
189 | void (*irq_done)(struct saa7146_dev *, unsigned long status); | 189 | void (*irq_done)(struct saa7146_dev *, unsigned long status); |
190 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | 190 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); |
191 | }; | 191 | }; |
192 | 192 | ||
193 | /* from saa7146_fops.c */ | 193 | /* from saa7146_fops.c */ |
194 | int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, char *name, int type); | 194 | int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, char *name, int type); |
195 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev); | 195 | int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev); |
196 | void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state); | 196 | void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state); |
197 | void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); | 197 | void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); |
198 | int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); | 198 | int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); |
199 | void saa7146_buffer_timeout(unsigned long data); | 199 | void saa7146_buffer_timeout(unsigned long data); |
200 | void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q, | 200 | void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q, |
201 | struct saa7146_buf *buf); | 201 | struct saa7146_buf *buf); |
202 | 202 | ||
203 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); | 203 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); |
204 | int saa7146_vv_release(struct saa7146_dev* dev); | 204 | int saa7146_vv_release(struct saa7146_dev* dev); |
205 | 205 | ||
206 | /* from saa7146_hlp.c */ | 206 | /* from saa7146_hlp.c */ |
207 | int saa7146_enable_overlay(struct saa7146_fh *fh); | 207 | int saa7146_enable_overlay(struct saa7146_fh *fh); |
208 | void saa7146_disable_overlay(struct saa7146_fh *fh); | 208 | void saa7146_disable_overlay(struct saa7146_fh *fh); |
209 | 209 | ||
210 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next); | 210 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next); |
211 | void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_video_dma* vdma) ; | 211 | void saa7146_write_out_dma(struct saa7146_dev* dev, int which, struct saa7146_video_dma* vdma) ; |
212 | void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sync); | 212 | void saa7146_set_hps_source_and_sync(struct saa7146_dev *saa, int source, int sync); |
213 | void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data); | 213 | void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data); |
214 | 214 | ||
215 | /* from saa7146_video.c */ | 215 | /* from saa7146_video.c */ |
216 | extern struct saa7146_use_ops saa7146_video_uops; | 216 | extern struct saa7146_use_ops saa7146_video_uops; |
217 | int saa7146_start_preview(struct saa7146_fh *fh); | 217 | int saa7146_start_preview(struct saa7146_fh *fh); |
218 | int saa7146_stop_preview(struct saa7146_fh *fh); | 218 | int saa7146_stop_preview(struct saa7146_fh *fh); |
219 | int saa7146_video_do_ioctl(struct inode *inode, struct file *file, | ||
220 | unsigned int cmd, void *arg); | ||
219 | 221 | ||
220 | /* from saa7146_vbi.c */ | 222 | /* from saa7146_vbi.c */ |
221 | extern struct saa7146_use_ops saa7146_vbi_uops; | 223 | extern struct saa7146_use_ops saa7146_vbi_uops; |
222 | 224 | ||
223 | /* resource management functions */ | 225 | /* resource management functions */ |
224 | int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit); | 226 | int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit); |
225 | void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits); | 227 | void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits); |
226 | 228 | ||
227 | #define RESOURCE_DMA1_HPS 0x1 | 229 | #define RESOURCE_DMA1_HPS 0x1 |
228 | #define RESOURCE_DMA2_CLP 0x2 | 230 | #define RESOURCE_DMA2_CLP 0x2 |
229 | #define RESOURCE_DMA3_BRS 0x4 | 231 | #define RESOURCE_DMA3_BRS 0x4 |
230 | 232 | ||
231 | /* saa7146 source inputs */ | 233 | /* saa7146 source inputs */ |
232 | #define SAA7146_HPS_SOURCE_PORT_A 0x00 | 234 | #define SAA7146_HPS_SOURCE_PORT_A 0x00 |
233 | #define SAA7146_HPS_SOURCE_PORT_B 0x01 | 235 | #define SAA7146_HPS_SOURCE_PORT_B 0x01 |
234 | #define SAA7146_HPS_SOURCE_YPB_CPA 0x02 | 236 | #define SAA7146_HPS_SOURCE_YPB_CPA 0x02 |
235 | #define SAA7146_HPS_SOURCE_YPA_CPB 0x03 | 237 | #define SAA7146_HPS_SOURCE_YPA_CPB 0x03 |
236 | 238 | ||
237 | /* sync inputs */ | 239 | /* sync inputs */ |
238 | #define SAA7146_HPS_SYNC_PORT_A 0x00 | 240 | #define SAA7146_HPS_SYNC_PORT_A 0x00 |
239 | #define SAA7146_HPS_SYNC_PORT_B 0x01 | 241 | #define SAA7146_HPS_SYNC_PORT_B 0x01 |
240 | 242 | ||
241 | /* some memory sizes */ | 243 | /* some memory sizes */ |
242 | /* max. 16 clipping rectangles */ | 244 | /* max. 16 clipping rectangles */ |
243 | #define SAA7146_CLIPPING_MEM (16 * 4 * sizeof(u32)) | 245 | #define SAA7146_CLIPPING_MEM (16 * 4 * sizeof(u32)) |
244 | 246 | ||
245 | /* some defines for the various clipping-modes */ | 247 | /* some defines for the various clipping-modes */ |
246 | #define SAA7146_CLIPPING_RECT 0x4 | 248 | #define SAA7146_CLIPPING_RECT 0x4 |
247 | #define SAA7146_CLIPPING_RECT_INVERTED 0x5 | 249 | #define SAA7146_CLIPPING_RECT_INVERTED 0x5 |
248 | #define SAA7146_CLIPPING_MASK 0x6 | 250 | #define SAA7146_CLIPPING_MASK 0x6 |
249 | #define SAA7146_CLIPPING_MASK_INVERTED 0x7 | 251 | #define SAA7146_CLIPPING_MASK_INVERTED 0x7 |
250 | 252 | ||
251 | /* output formats: each entry holds four informations */ | 253 | /* output formats: each entry holds four informations */ |
252 | #define RGB08_COMPOSED 0x0217 /* composed is used in the sense of "not-planar" */ | 254 | #define RGB08_COMPOSED 0x0217 /* composed is used in the sense of "not-planar" */ |
253 | /* this means: planar?=0, yuv2rgb-conversation-mode=2, dither=yes(=1), format-mode = 7 */ | 255 | /* this means: planar?=0, yuv2rgb-conversation-mode=2, dither=yes(=1), format-mode = 7 */ |
254 | #define RGB15_COMPOSED 0x0213 | 256 | #define RGB15_COMPOSED 0x0213 |
255 | #define RGB16_COMPOSED 0x0210 | 257 | #define RGB16_COMPOSED 0x0210 |
256 | #define RGB24_COMPOSED 0x0201 | 258 | #define RGB24_COMPOSED 0x0201 |
257 | #define RGB32_COMPOSED 0x0202 | 259 | #define RGB32_COMPOSED 0x0202 |
258 | 260 | ||
259 | #define Y8 0x0006 | 261 | #define Y8 0x0006 |
260 | #define YUV411_COMPOSED 0x0003 | 262 | #define YUV411_COMPOSED 0x0003 |
261 | #define YUV422_COMPOSED 0x0000 | 263 | #define YUV422_COMPOSED 0x0000 |
262 | /* this means: planar?=1, yuv2rgb-conversion-mode=0, dither=no(=0), format-mode = b */ | 264 | /* this means: planar?=1, yuv2rgb-conversion-mode=0, dither=no(=0), format-mode = b */ |
263 | #define YUV411_DECOMPOSED 0x100b | 265 | #define YUV411_DECOMPOSED 0x100b |
264 | #define YUV422_DECOMPOSED 0x1009 | 266 | #define YUV422_DECOMPOSED 0x1009 |
265 | #define YUV420_DECOMPOSED 0x100a | 267 | #define YUV420_DECOMPOSED 0x100a |
266 | 268 | ||
267 | #define IS_PLANAR(x) (x & 0xf000) | 269 | #define IS_PLANAR(x) (x & 0xf000) |
268 | 270 | ||
269 | /* misc defines */ | 271 | /* misc defines */ |
270 | #define SAA7146_NO_SWAP (0x0) | 272 | #define SAA7146_NO_SWAP (0x0) |
271 | #define SAA7146_TWO_BYTE_SWAP (0x1) | 273 | #define SAA7146_TWO_BYTE_SWAP (0x1) |
272 | #define SAA7146_FOUR_BYTE_SWAP (0x2) | 274 | #define SAA7146_FOUR_BYTE_SWAP (0x2) |
273 | 275 | ||
274 | #endif | 276 | #endif |
275 | 277 |