[media] az6007: Change it to use the MFE solution adopted at dvb-usb
authorMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 16 Jan 2012 21:57:51 +0000 (18:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 21 Jan 2012 15:46:08 +0000 (13:46 -0200)
This driver were written to use a previous solution for MFE at dvb-usb.
Due to the internal API changes, change the binding to work with the
new way.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/az6007.c

index b667854..92ded30 100644 (file)
@@ -66,7 +66,7 @@ static struct drxk_config terratec_h7_drxk = {
        .adr = 0x29,
        .single_master = 1,
        .no_i2c_bridge = 0,
-       .max_size = 64,
+       .chunk_size = 64,
        .microcode_name = "dvb-usb-terratec-h7-drxk.fw",
        .parallel_ts = 1,
 };
@@ -290,26 +290,21 @@ static int az6007_frontend_attach(struct dvb_usb_adapter *adap)
 {
        struct az6007_device_state *st = adap->priv;
 
-       /* FIXME: dvb-usb will call this function twice! */
-       if (adap->fe[0])
-               return 0;
-
        BUG_ON(!st);
 
        az6007_frontend_poweron(adap);
 
        info("attaching demod drxk");
-       adap->fe[0] = dvb_attach(drxk_attach, &terratec_h7_drxk,
-                                &adap->dev->i2c_adap, &adap->fe[1]);
-       if (!adap->fe[0])
+       adap->fe_adap[0].fe = dvb_attach(drxk_attach, &terratec_h7_drxk,
+                                        &adap->dev->i2c_adap);
+       if (!adap->fe_adap[0].fe)
                return -EINVAL;
 
-       adap->fe[0]->sec_priv = adap;
+       adap->fe_adap[0].fe->sec_priv = adap;
        /* FIXME: do we need a pll semaphore? */
        sema_init(&st->pll_mutex, 1);
-       st->gate_ctrl = adap->fe[0]->ops.i2c_gate_ctrl;
-       adap->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl;
-       adap->dont_attach_fe[1] = true;
+       st->gate_ctrl = adap->fe_adap[0].fe->ops.i2c_gate_ctrl;
+       adap->fe_adap[0].fe->ops.i2c_gate_ctrl = drxk_gate_ctrl;
 
        return 0;
 }
@@ -325,19 +320,15 @@ static int az6007_tuner_attach(struct dvb_usb_adapter *adap)
 
        info("attaching tuner mt2063");
        /* Attach mt2063 to DVB-C frontend */
-       if (adap->fe[0]->ops.i2c_gate_ctrl)
-               adap->fe[0]->ops.i2c_gate_ctrl(adap->fe[0], 1);
-       if (!dvb_attach(mt2063_attach, adap->fe[0], &az6007_mt2063_config,
+       if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl)
+               adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, 1);
+       if (!dvb_attach(mt2063_attach, adap->fe_adap[0].fe, 
+                       &az6007_mt2063_config,
                        &adap->dev->i2c_adap))
                return -EINVAL;
 
-       if (adap->fe[0]->ops.i2c_gate_ctrl)
-               adap->fe[0]->ops.i2c_gate_ctrl(adap->fe[0], 0);
-
-       /* Hack - needed due to drxk */
-       adap->fe[1]->tuner_priv = adap->fe[0]->tuner_priv;
-       memcpy(&adap->fe[1]->ops.tuner_ops,
-              &adap->fe[0]->ops.tuner_ops, sizeof(adap->fe[0]->ops.tuner_ops));
+       if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl)
+               adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, 0);
 
        return 0;
 }
@@ -530,7 +521,8 @@ static struct dvb_usb_device_properties az6007_properties = {
        .num_adapters = 1,
        .adapter = {
                {
-                       .num_frontends    = 2,
+               .num_frontends = 1,
+               .fe = {{
                        .streaming_ctrl   = az6007_streaming_ctrl,
                        .tuner_attach     = az6007_tuner_attach,
                        .frontend_attach  = az6007_frontend_attach,
@@ -547,8 +539,8 @@ static struct dvb_usb_device_properties az6007_properties = {
                                }
                        },
                        .size_of_priv     = sizeof(struct az6007_device_state),
-               }
-       },
+               }}
+       } },
        .power_ctrl       = az6007_power_ctrl,
        .read_mac_address = az6007_read_mac_addr,