From e2d8c90b1617a6f3eb8f1fce2f7cee49f9244ef9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 22 Apr 2008 14:45:30 -0300 Subject: [PATCH] --- yaml --- r: 92415 b: refs/heads/master c: 23fb348d00da9c1558b4a9b234b9ac941091b0f1 h: refs/heads/master i: 92413: 7119409de711b19a5a32b522218de5c02f51cd18 92411: 03400d7da9d6f72f7081bf7a9638f137c423220c 92407: 1b54202fd38b45412a72f07d14a1ee972f51f705 92399: 04644610f19012e9e7663d65850ccfc88eac0208 92383: ef10deecd9b9132ed239b4a140b8ef560c5c3c34 92351: 97aee39585b4e9fb7407195eb69a4b224bd27f08 92287: 86611ad5b390e9e9affe165b2e495ee2aa98c0b1 92159: 1c9e807f78ea6b5cf9ccff09944301797fea37b9 v: v3 --- [refs] | 2 +- trunk/drivers/media/video/cx88/cx88-dvb.c | 58 ++++++++++++----------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/[refs] b/[refs] index 3d5328af4587..e3256e17c537 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 64016330b60e44db1383122a11611073fe98f261 +refs/heads/master: 23fb348d00da9c1558b4a9b234b9ac941091b0f1 diff --git a/trunk/drivers/media/video/cx88/cx88-dvb.c b/trunk/drivers/media/video/cx88/cx88-dvb.c index ef83dab72410..59180cab0a85 100644 --- a/trunk/drivers/media/video/cx88/cx88-dvb.c +++ b/trunk/drivers/media/video/cx88/cx88-dvb.c @@ -452,11 +452,33 @@ static struct zl10353_config cx88_geniatech_x8000_mt = { .no_tuner = 1, }; +static int attach_xc3028(u8 addr, struct cx8802_dev *dev) +{ + struct dvb_frontend *fe; + struct xc2028_config cfg = { + .i2c_adap = &dev->core->i2c_adap, + .i2c_addr = addr, + .video_dev = dev->core, + }; + + fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); + if (!fe) { + printk(KERN_ERR "%s/2: xc3028 attach failed\n", + dev->core->name); + dvb_frontend_detach(dev->dvb.frontend); + dvb_unregister_frontend(dev->dvb.frontend); + dev->dvb.frontend = NULL; + return -EINVAL; + } + + printk(KERN_INFO "%s/2: xc3028 attached\n", + dev->core->name); + + return 0; +} static int dvb_register(struct cx8802_dev *dev) { - int attach_xc3028 = 0; - /* init struct videobuf_dvb */ dev->dvb.name = dev->core->name; dev->ts_gen_cntrl = 0x0c; @@ -595,8 +617,8 @@ static int dvb_register(struct cx8802_dev *dev) */ if (dev->dvb.frontend) dev->dvb.frontend->ops.i2c_gate_ctrl = NULL; - - attach_xc3028 = 1; + if (attach_xc3028(0x61, dev) < 0) + return -EINVAL; break; case CX88_BOARD_PCHDTV_HD3000: dev->dvb.frontend = dvb_attach(or51132_attach, &pchdtv_hd3000, @@ -770,7 +792,8 @@ static int dvb_register(struct cx8802_dev *dev) dev->dvb.frontend = dvb_attach(zl10353_attach, &cx88_geniatech_x8000_mt, &dev->core->i2c_adap); - attach_xc3028 = 1; + if (attach_xc3028(0x61, dev) < 0) + return -EINVAL; break; case CX88_BOARD_GENIATECH_X8000_MT: dev->ts_gen_cntrl = 0x00; @@ -778,7 +801,8 @@ static int dvb_register(struct cx8802_dev *dev) dev->dvb.frontend = dvb_attach(zl10353_attach, &cx88_geniatech_x8000_mt, &dev->core->i2c_adap); - attach_xc3028 = 1; + if (attach_xc3028(0x61, dev) < 0) + return -EINVAL; break; default: printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", @@ -789,27 +813,7 @@ static int dvb_register(struct cx8802_dev *dev) printk(KERN_ERR "%s/2: frontend initialization failed\n", dev->core->name); - return -1; - } - - if (attach_xc3028) { - struct dvb_frontend *fe; - struct xc2028_config cfg = { - .i2c_adap = &dev->core->i2c_adap, - .i2c_addr = 0x61, - .video_dev = dev->core, - }; - fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); - if (!fe) { - printk(KERN_ERR "%s/2: xc3028 attach failed\n", - dev->core->name); - dvb_frontend_detach(dev->dvb.frontend); - dvb_unregister_frontend(dev->dvb.frontend); - dev->dvb.frontend = NULL; - return -1; - } - printk(KERN_INFO "%s/2: xc3028 attached\n", - dev->core->name); + return -EINVAL; } /* Ensure all frontends negotiate bus access */