aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c12
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c5
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c28
-rw-r--r--drivers/media/video/cx88/cx88-video.c10
-rw-r--r--drivers/media/video/cx88/cx88.h1
5 files changed, 39 insertions, 17 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 078be6319556..d3ae5b4dfca7 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1078,7 +1078,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
1078 } 1078 }
1079 } 1079 }
1080 1080
1081 if (blackbird_initialize_codec(dev) < 0) { 1081 if (!atomic_read(&dev->core->mpeg_users) && blackbird_initialize_codec(dev) < 0) {
1082 if (drv) 1082 if (drv)
1083 drv->request_release(drv); 1083 drv->request_release(drv);
1084 unlock_kernel(); 1084 unlock_kernel();
@@ -1109,6 +1109,8 @@ static int mpeg_open(struct inode *inode, struct file *file)
1109 fh->mpegq.field); 1109 fh->mpegq.field);
1110 unlock_kernel(); 1110 unlock_kernel();
1111 1111
1112 atomic_inc(&dev->core->mpeg_users);
1113
1112 return 0; 1114 return 0;
1113} 1115}
1114 1116
@@ -1118,7 +1120,7 @@ static int mpeg_release(struct inode *inode, struct file *file)
1118 struct cx8802_dev *dev = fh->dev; 1120 struct cx8802_dev *dev = fh->dev;
1119 struct cx8802_driver *drv = NULL; 1121 struct cx8802_driver *drv = NULL;
1120 1122
1121 if (dev->mpeg_active) 1123 if (dev->mpeg_active && atomic_read(&dev->core->mpeg_users) == 1)
1122 blackbird_stop_codec(dev); 1124 blackbird_stop_codec(dev);
1123 1125
1124 cx8802_cancel_buffers(fh->dev); 1126 cx8802_cancel_buffers(fh->dev);
@@ -1138,6 +1140,8 @@ static int mpeg_release(struct inode *inode, struct file *file)
1138 if (drv) 1140 if (drv)
1139 drv->request_release(drv); 1141 drv->request_release(drv);
1140 1142
1143 atomic_dec(&dev->core->mpeg_users);
1144
1141 return 0; 1145 return 0;
1142} 1146}
1143 1147
@@ -1158,6 +1162,10 @@ static unsigned int
1158mpeg_poll(struct file *file, struct poll_table_struct *wait) 1162mpeg_poll(struct file *file, struct poll_table_struct *wait)
1159{ 1163{
1160 struct cx8802_fh *fh = file->private_data; 1164 struct cx8802_fh *fh = file->private_data;
1165 struct cx8802_dev *dev = fh->dev;
1166
1167 if (!dev->mpeg_active)
1168 blackbird_start_codec(file, fh);
1161 1169
1162 return videobuf_poll_stream(file, &fh->mpegq, wait); 1170 return videobuf_poll_stream(file, &fh->mpegq, wait);
1163} 1171}
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index cf6c30d4e545..309ca5e68063 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -598,6 +598,11 @@ static int dvb_register(struct cx8802_dev *dev)
598 struct videobuf_dvb_frontend *fe0, *fe1 = NULL; 598 struct videobuf_dvb_frontend *fe0, *fe1 = NULL;
599 int mfe_shared = 0; /* bus not shared by default */ 599 int mfe_shared = 0; /* bus not shared by default */
600 600
601 if (0 != core->i2c_rc) {
602 printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
603 goto frontend_detach;
604 }
605
601 /* Get the first frontend */ 606 /* Get the first frontend */
602 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1); 607 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
603 if (!fe0) 608 if (!fe0)
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index a1c435b4b1cd..3ebdcd1d83f8 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -769,10 +769,6 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
769 struct cx8802_dev *dev; 769 struct cx8802_dev *dev;
770 struct cx88_core *core; 770 struct cx88_core *core;
771 int err; 771 int err;
772#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
773 struct videobuf_dvb_frontend *demod;
774 int i;
775#endif
776 772
777 /* general setup */ 773 /* general setup */
778 core = cx88_core_get(pci_dev); 774 core = cx88_core_get(pci_dev);
@@ -803,15 +799,21 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
803 mutex_init(&dev->frontends.lock); 799 mutex_init(&dev->frontends.lock);
804 INIT_LIST_HEAD(&dev->frontends.felist); 800 INIT_LIST_HEAD(&dev->frontends.felist);
805 801
806 if (core->board.num_frontends) 802 if (core->board.num_frontends) {
807 printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, core->board.num_frontends); 803 struct videobuf_dvb_frontend *fe;
808 804 int i;
809 for (i = 1; i <= core->board.num_frontends; i++) { 805
810 demod = videobuf_dvb_alloc_frontend(&dev->frontends, i); 806 printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
811 if(demod == NULL) { 807 core->board.num_frontends);
812 printk(KERN_ERR "%s() failed to alloc\n", __func__); 808 for (i = 1; i <= core->board.num_frontends; i++) {
813 err = -ENOMEM; 809 fe = videobuf_dvb_alloc_frontend(&dev->frontends, i);
814 goto fail_free; 810 if(fe == NULL) {
811 printk(KERN_ERR "%s() failed to alloc\n",
812 __func__);
813 videobuf_dvb_dealloc_frontends(&dev->frontends);
814 err = -ENOMEM;
815 goto fail_free;
816 }
815 } 817 }
816 } 818 }
817#endif 819#endif
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 61265fd04d56..b96ce991d968 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1216,8 +1216,12 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
1216 struct cx8800_fh *fh = priv; 1216 struct cx8800_fh *fh = priv;
1217 struct cx8800_dev *dev = fh->dev; 1217 struct cx8800_dev *dev = fh->dev;
1218 1218
1219 if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) 1219 /* We should remember that this driver also supports teletext, */
1220 /* so we have to test if the v4l2_buf_type is VBI capture data. */
1221 if (unlikely((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
1222 (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE)))
1220 return -EINVAL; 1223 return -EINVAL;
1224
1221 if (unlikely(i != fh->type)) 1225 if (unlikely(i != fh->type))
1222 return -EINVAL; 1226 return -EINVAL;
1223 1227
@@ -1232,8 +1236,10 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
1232 struct cx8800_dev *dev = fh->dev; 1236 struct cx8800_dev *dev = fh->dev;
1233 int err, res; 1237 int err, res;
1234 1238
1235 if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1239 if ((fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
1240 (fh->type != V4L2_BUF_TYPE_VBI_CAPTURE))
1236 return -EINVAL; 1241 return -EINVAL;
1242
1237 if (i != fh->type) 1243 if (i != fh->type)
1238 return -EINVAL; 1244 return -EINVAL;
1239 1245
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 76207c2856b7..f4240965be32 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -352,6 +352,7 @@ struct cx88_core {
352 /* various v4l controls */ 352 /* various v4l controls */
353 u32 freq; 353 u32 freq;
354 atomic_t users; 354 atomic_t users;
355 atomic_t mpeg_users;
355 356
356 /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ 357 /* cx88-video needs to access cx8802 for hybrid tuner pll access. */
357 struct cx8802_dev *dvbdev; 358 struct cx8802_dev *dvbdev;