Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130754
b: refs/heads/master
c: 6e0e12f
h: refs/heads/master
v: v3
  • Loading branch information
Andy Walls authored and Mauro Carvalho Chehab committed Jan 29, 2009
1 parent 2e17bbf commit 95a11fc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8866f9cf8d85f3614855a49b9d9056f265d0cd33
refs/heads/master: 6e0e12f15a503b7096303d495247fbeaa2b12582
72 changes: 38 additions & 34 deletions trunk/drivers/media/video/cx88/cx88-dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,34 +614,41 @@ static struct stv0288_config tevii_tuner_earda_config = {
.set_ts_params = cx24116_set_ts_param,
};

static int dvb_register(struct cx8802_dev *dev)
static int cx8802_alloc_frontends(struct cx8802_dev *dev)
{
struct cx88_core *core = dev->core;
struct videobuf_dvb_frontend *fe0, *fe1 = NULL;
int mfe_shared = 0; /* bus not shared by default */
struct videobuf_dvb_frontend *fe = NULL;
int i;

if (0 != core->i2c_rc) {
printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
goto frontend_detach;
}

if (!core->board.num_frontends)
return -EINVAL;

mutex_init(&dev->frontends.lock);
INIT_LIST_HEAD(&dev->frontends.felist);

if (!core->board.num_frontends)
return -ENODEV;

printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__,
core->board.num_frontends);
for (i = 1; i <= core->board.num_frontends; i++) {
fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, i);
if (!fe0) {
fe = videobuf_dvb_alloc_frontend(&dev->frontends, i);
if (!fe) {
printk(KERN_ERR "%s() failed to alloc\n", __func__);
videobuf_dvb_dealloc_frontends(&dev->frontends);
goto frontend_detach;
return -ENOMEM;
}
}
return 0;
}

static int dvb_register(struct cx8802_dev *dev)
{
struct cx88_core *core = dev->core;
struct videobuf_dvb_frontend *fe0, *fe1 = NULL;
int mfe_shared = 0; /* bus not shared by default */

if (0 != core->i2c_rc) {
printk(KERN_ERR "%s/2: no i2c-bus available, cannot attach dvb drivers\n", core->name);
goto frontend_detach;
}

/* Get the first frontend */
fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
Expand Down Expand Up @@ -1243,6 +1250,8 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
struct cx88_core *core = drv->core;
struct cx8802_dev *dev = drv->core->dvbdev;
int err;
struct videobuf_dvb_frontend *fe;
int i;

dprintk( 1, "%s\n", __func__);
dprintk( 1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n",
Expand All @@ -1258,39 +1267,34 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
/* If vp3054 isn't enabled, a stub will just return 0 */
err = vp3054_i2c_probe(dev);
if (0 != err)
goto fail_probe;
goto fail_core;

/* dvb stuff */
printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name);
dev->ts_gen_cntrl = 0x0c;

err = cx8802_alloc_frontends(dev);
if (err)
goto fail_core;

err = -ENODEV;
if (core->board.num_frontends) {
struct videobuf_dvb_frontend *fe;
int i;

for (i = 1; i <= core->board.num_frontends; i++) {
fe = videobuf_dvb_get_frontend(&core->dvbdev->frontends, i);
if (fe == NULL) {
printk(KERN_ERR "%s() failed to get frontend(%d)\n",
for (i = 1; i <= core->board.num_frontends; i++) {
fe = videobuf_dvb_get_frontend(&core->dvbdev->frontends, i);
if (fe == NULL) {
printk(KERN_ERR "%s() failed to get frontend(%d)\n",
__func__, i);
goto fail_probe;
}
videobuf_queue_sg_init(&fe->dvb.dvbq, &dvb_qops,
goto fail_probe;
}
videobuf_queue_sg_init(&fe->dvb.dvbq, &dvb_qops,
&dev->pci->dev, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_TOP,
sizeof(struct cx88_buffer),
dev);
/* init struct videobuf_dvb */
fe->dvb.name = dev->core->name;
}
} else {
/* no frontends allocated */
printk(KERN_ERR "%s/2 .num_frontends should be non-zero\n",
core->name);
goto fail_core;
/* init struct videobuf_dvb */
fe->dvb.name = dev->core->name;
}

err = dvb_register(dev);
if (err)
/* frontends/adapter de-allocated in dvb_register */
Expand Down

0 comments on commit 95a11fc

Please sign in to comment.