Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[pandora-kernel.git] / drivers / media / dvb / ngene / ngene-core.c
index 6927c72..f129a93 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "ngene.h"
 
-static int one_adapter = 1;
+static int one_adapter;
 module_param(one_adapter, int, 0444);
 MODULE_PARM_DESC(one_adapter, "Use only one adapter.");
 
@@ -461,7 +461,7 @@ static u8 TSFeatureDecoderSetup[8 * 5] = {
        0x42, 0x00, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00,
        0x40, 0x06, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* DRXH */
        0x71, 0x07, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* DRXHser */
-       0x72, 0x06, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* S2ser */
+       0x72, 0x00, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* S2ser */
        0x40, 0x07, 0x00, 0x02, 0x02, 0xbc, 0x00, 0x00, /* LGDT3303 */
 };
 
@@ -507,7 +507,7 @@ void FillTSBuffer(void *Buffer, int Length, u32 Flags)
 {
        u32 *ptr = Buffer;
 
-       memset(Buffer, 0xff, Length);
+       memset(Buffer, TS_FILLER, Length);
        while (Length > 0) {
                if (Flags & DF_SWAP32)
                        *ptr = 0x471FFF10;
@@ -1443,6 +1443,9 @@ static void release_channel(struct ngene_channel *chan)
                chan->ci_dev = NULL;
        }
 
+       if (chan->fe2)
+               dvb_unregister_frontend(chan->fe2);
+
        if (chan->fe) {
                dvb_unregister_frontend(chan->fe);
                dvb_frontend_detach(chan->fe);
@@ -1534,6 +1537,14 @@ static int init_channel(struct ngene_channel *chan)
                        goto err;
                chan->has_demux = true;
        }
+       if (chan->fe2) {
+               if (dvb_register_frontend(adapter, chan->fe2) < 0)
+                       goto err;
+               chan->fe2->tuner_priv = chan->fe->tuner_priv;
+               memcpy(&chan->fe2->ops.tuner_ops,
+                      &chan->fe->ops.tuner_ops,
+                      sizeof(struct dvb_tuner_ops));
+       }
 
        if (chan->has_demux) {
                ret = my_dvb_dmx_ts_card_init(dvbdemux, "SW demux",
@@ -1571,11 +1582,18 @@ static int init_channels(struct ngene *dev)
        return 0;
 }
 
+static struct cxd2099_cfg cxd_cfg = {
+       .bitrate = 62000,
+       .adr = 0x40,
+       .polarity = 0,
+       .clock_mode = 0,
+};
+
 static void cxd_attach(struct ngene *dev)
 {
        struct ngene_ci *ci = &dev->ci;
 
-       ci->en = cxd2099_attach(0x40, dev, &dev->channel[0].i2c_adapter);
+       ci->en = cxd2099_attach(&cxd_cfg, dev, &dev->channel[0].i2c_adapter);
        ci->dev = dev;
        return;
 }