1 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
4 #include <linux/module.h>
15 DEB_D(
"already allocated! want: 0x%02x, cur:0x%02x\n",
23 DEB_D(
"locked! vv->resources:0x%02x, we want:0x%02x\n",
55 DEB_EE(
"dev:%p, buf:%p\n", dev, buf);
74 DEB_EE(
"dev:%p, dmaq:%p, buf:%p\n", dev, q, buf);
80 DEB_D(
"immediately activating buffer %p\n", buf);
85 DEB_D(
"adding buffer %p to queue. (active buffer present)\n",
96 DEB_EE(
"dev:%p, dmaq:%p, state:%d\n", dev, q, state);
103 DEB_D(
"aiii. no current buffer\n");
121 DEB_INT(
"dev:%p, dmaq:%p, vbi:%d\n", dev, q, vbi);
124 if (!list_empty(&q->
queue)) {
128 if (!list_empty(&q->
queue))
131 DEB_INT(
"next buffer: buf:%p, prev:%p, next:%p\n",
135 DEB_INT(
"no next buffer. stopping.\n");
172 DEB_EE(
"dev:%p, dmaq:%p\n", dev, q);
189 spin_unlock_irqrestore(&dev->
slock,flags);
195 static int fops_open(
struct file *
file)
202 DEB_EE(
"file:%p, dev:%s\n", file, video_device_node_name(vdev));
207 DEB_D(
"using: %p\n", dev);
211 DEB_S(
"no extension registered for this device\n");
219 DEB_S(
"cannot allocate memory for per open data\n");
230 DEB_S(
"initializing vbi...\n");
236 DEB_S(
"initializing video...\n");
244 if( 0 == try_module_get(dev->
ext->module)) {
252 if (fh && result != 0) {
260 static int fops_release(
struct file *file)
266 DEB_EE(
"file:%p\n", file);
282 module_put(dev->
ext->module);
291 static int fops_mmap(
struct file *file,
struct vm_area_struct * vma)
300 DEB_EE(
"V4L2_BUF_TYPE_VIDEO_CAPTURE: file:%p, vma:%p\n",
306 DEB_EE(
"V4L2_BUF_TYPE_VBI_CAPTURE: file:%p, vma:%p\n",
333 DEB_EE(
"file:%p, poll:%p\n", file, wait);
338 if( 0 == fh->
vbi_q.streaming )
342 DEB_D(
"using video queue\n");
346 if (!list_empty(&q->
stream))
350 DEB_D(
"buf == NULL!\n");
354 poll_wait(file, &buf->
done, wait);
356 DEB_D(
"poll succeeded!\n");
360 DEB_D(
"nothing to poll for, buf->state:%d\n", buf->
state);
370 res = __fops_poll(file, wait);
375 static ssize_t fops_read(
struct file *file,
char __user *
data,
size_t count, loff_t *ppos)
407 static ssize_t fops_write(
struct file *file,
const char __user *data,
size_t count, loff_t *ppos)
417 if (fh->
dev->ext_vv_data->vbi_fops.write) {
420 ret = fh->
dev->ext_vv_data->vbi_fops.write(file, data, count, ppos);
435 .release = fops_release,
447 DEB_INT(
"dev:%p, isr:0x%08x\n", dev, (
u32)status);
450 DEB_INT(
"irq: RPS0 (0x%08x)\n", isr);
457 DEB_INT(
"irq: RPS1 vbi workaround (0x%08x)\n", isr);
462 DEB_INT(
"irq: RPS1 (0x%08x)\n", isr);
503 ERR(
"out of memory. aborting.\n");
526 ERR(
"out of memory. aborting.\n");
537 fmt = &vv->
ov_fb.fmt;
601 DEB_EE(
"dev:%p, name:'%s', type:%d\n", dev, name, type);
608 vfd->
fops = &video_fops;
621 video_set_drvdata(vfd, dev);
623 err = video_register_device(vfd, type, -1);
625 ERR(
"cannot register v4l2 device. skipping.\n");
630 pr_info(
"%s: registered device %s [v4l2]\n",
631 dev->
name, video_device_node_name(vfd));
649 static int __init saa7146_vv_init_module(
void)
655 static void __exit saa7146_vv_cleanup_module(
void)