]> err.no Git - linux-2.6/commitdiff
V4L/DVB (5542): Budget-av: Remove polarity switching of the clock for DVB-C
authorHartmut Birr <e9hack@googlemail.com>
Sat, 21 Apr 2007 22:17:49 +0000 (19:17 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 27 Apr 2007 18:45:46 +0000 (15:45 -0300)
Remove the polarity switching of the clock for the DVB-C cards in
budget-av.c. This hack is no longer necessary because the saa7146 can
do the job to remove the additional FEC bytes from the TS.

Signed-off-by: Hartmut Birr <e9hack@googlemail.com>
Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/tda10021.c
drivers/media/dvb/frontends/tda10021.h
drivers/media/dvb/ttpci/budget-av.c
drivers/media/dvb/ttpci/budget-core.c

index 9348e76fe2e04486cc267fbd58cb79aaeb4623c1..ef9159f8c3fa154b661cabe14c78472ea2ef3040 100644 (file)
@@ -64,7 +64,7 @@ static u8 tda10021_inittab[0x40]=
 {
        0x73, 0x6a, 0x23, 0x0a, 0x02, 0x37, 0x77, 0x1a,
        0x37, 0x6a, 0x17, 0x8a, 0x1e, 0x86, 0x43, 0x40,
-       0xb8, 0x3f, 0xa0, 0x00, 0xcd, 0x01, 0x00, 0xff,
+       0xb8, 0x3f, 0xa1, 0x00, 0xcd, 0x01, 0x00, 0xff,
        0x11, 0x00, 0x7c, 0x31, 0x30, 0x20, 0x00, 0x00,
        0x02, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00,
        0x07, 0x00, 0x33, 0x11, 0x0d, 0x95, 0x08, 0x58,
@@ -201,16 +201,6 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate
        return 0;
 }
 
-static int tda10021_write(struct dvb_frontend* fe, u8 *buf, int len)
-{
-       struct tda10021_state* state = fe->demodulator_priv;
-
-       if (len != 2)
-               return -EINVAL;
-
-       return _tda10021_writereg(state, buf[0], buf[1]);
-}
-
 static int tda10021_init (struct dvb_frontend *fe)
 {
        struct tda10021_state* state = fe->demodulator_priv;
@@ -461,7 +451,6 @@ static struct dvb_frontend_ops tda10021_ops = {
 
        .init = tda10021_init,
        .sleep = tda10021_sleep,
-       .write = tda10021_write,
        .i2c_gate_ctrl = tda10021_i2c_gate_ctrl,
 
        .set_frontend = tda10021_set_parameters,
index e3da780108f66b20b660b6ec07ca77d899befa59..b8efd498d4bf7166cc7cdb81bf0371540e8c6b35 100644 (file)
@@ -44,12 +44,4 @@ static inline struct dvb_frontend* tda10021_attach(const struct tda10021_config*
 }
 #endif // CONFIG_DVB_TDA10021
 
-static inline int tda10021_writereg(struct dvb_frontend *fe, u8 reg, u8 val) {
-       int r = 0;
-       u8 buf[] = {reg, val};
-       if (fe->ops.write)
-               r = fe->ops.write(fe, buf, 2);
-       return r;
-}
-
 #endif // TDA10021_H
index 3035b224c7a32efafa249a1c27ed46e8e605c818..54ca3a3288e7db4444ff2f474845cc68ea74a20c 100644 (file)
@@ -66,9 +66,6 @@ struct budget_av {
        int slot_status;
        struct dvb_ca_en50221 ca;
        u8 reinitialise_demod:1;
-       u8 tda10021_poclkp:1;
-       u8 tda10021_ts_enabled;
-       int (*tda10021_set_frontend)(struct dvb_frontend *fe, struct dvb_frontend_parameters *p);
 };
 
 static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot);
@@ -234,12 +231,6 @@ static int ciintf_slot_reset(struct dvb_ca_en50221 *ca, int slot)
        if (budget_av->reinitialise_demod)
                dvb_frontend_reinitialise(budget_av->budget.dvb_frontend);
 
-       /* set tda10021 back to original clock configuration on reset */
-       if (budget_av->tda10021_poclkp) {
-               tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0);
-               budget_av->tda10021_ts_enabled = 0;
-       }
-
        return 0;
 }
 
@@ -256,11 +247,6 @@ static int ciintf_slot_shutdown(struct dvb_ca_en50221 *ca, int slot)
        ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB);
        budget_av->slot_status = SLOTSTATUS_NONE;
 
-       /* set tda10021 back to original clock configuration when cam removed */
-       if (budget_av->tda10021_poclkp) {
-               tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0);
-               budget_av->tda10021_ts_enabled = 0;
-       }
        return 0;
 }
 
@@ -276,12 +262,6 @@ static int ciintf_slot_ts_enable(struct dvb_ca_en50221 *ca, int slot)
 
        ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTA);
 
-       /* tda10021 seems to need a different TS clock config when data is routed to the CAM */
-       if (budget_av->tda10021_poclkp) {
-               tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa1);
-               budget_av->tda10021_ts_enabled = 1;
-       }
-
        return 0;
 }
 
@@ -927,23 +907,6 @@ static u8 read_pwm(struct budget_av *budget_av)
 #define SUBID_DVBT_KNC1                0x0030
 #define SUBID_DVBT_CINERGY1200 0x1157
 
-
-static int tda10021_set_frontend(struct dvb_frontend *fe,
-                                struct dvb_frontend_parameters *p)
-{
-       struct budget_av* budget_av = fe->dvb->priv;
-       int result;
-
-       result = budget_av->tda10021_set_frontend(fe, p);
-       if (budget_av->tda10021_ts_enabled) {
-               tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa1);
-       } else {
-               tda10021_writereg(budget_av->budget.dvb_frontend, 0x12, 0xa0);
-       }
-
-       return result;
-}
-
 static void frontend_init(struct budget_av *budget_av)
 {
        struct saa7146_dev * saa = budget_av->budget.dev;
@@ -1025,9 +988,6 @@ static void frontend_init(struct budget_av *budget_av)
                                             &budget_av->budget.i2c_adap,
                                             read_pwm(budget_av));
                if (fe) {
-                       budget_av->tda10021_poclkp = 1;
-                       budget_av->tda10021_set_frontend = fe->ops.set_frontend;
-                       fe->ops.set_frontend = tda10021_set_frontend;
                        fe->ops.tuner_ops.set_params = philips_cu1216_tuner_set_params;
                }
                break;
index e15562f81664ea40c0fd36a34136ca08226b6ef1..cef9d8d8a1224903408356dd8f31b175e4657082 100644 (file)
 
 #define TS_WIDTH               (2 * TS_SIZE)
 #define TS_WIDTH_ACTIVY                TS_SIZE
+#define TS_WIDTH_DVBC          TS_SIZE
 #define TS_HEIGHT_MASK         0xf00
 #define TS_HEIGHT_MASK_ACTIVY  0xc00
+#define TS_HEIGHT_MASK_DVBC    0xe00
 #define TS_MIN_BUFSIZE_K       188
 #define TS_MAX_BUFSIZE_K       1410
 #define TS_MAX_BUFSIZE_K_ACTIVY        564
+#define TS_MAX_BUFSIZE_K_DVBC  1316
 #define BUFFER_WARNING_WAIT    (30*HZ)
 
 int budget_debug;
@@ -122,7 +125,13 @@ static int start_ts_capture(struct budget *budget)
        mdelay(10);
 
        saa7146_write(dev, BASE_ODD3, 0);
-       saa7146_write(dev, BASE_EVEN3, 0);
+       if (budget->buffer_size > budget->buffer_height * budget->buffer_width) {
+               // using odd/even buffers
+               saa7146_write(dev, BASE_EVEN3, budget->buffer_height * budget->buffer_width);
+       } else {
+               // using a single buffer
+               saa7146_write(dev, BASE_EVEN3, 0);
+       }
        saa7146_write(dev, PROT_ADDR3, budget->buffer_size);
        saa7146_write(dev, BASE_PAGE3, budget->pt.dma | ME1 | 0x90);
 
@@ -399,11 +408,22 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
        budget->card = bi;
        budget->dev = (struct saa7146_dev *) dev;
 
-       if (budget->card->type == BUDGET_FS_ACTIVY) {
+       switch(budget->card->type) {
+       case BUDGET_FS_ACTIVY:
                budget->buffer_width = TS_WIDTH_ACTIVY;
                max_bufsize = TS_MAX_BUFSIZE_K_ACTIVY;
                height_mask = TS_HEIGHT_MASK_ACTIVY;
-       } else {
+               break;
+
+       case BUDGET_KNC1C:
+       case BUDGET_KNC1CP:
+       case BUDGET_CIN1200C:
+               budget->buffer_width = TS_WIDTH_DVBC;
+               max_bufsize = TS_MAX_BUFSIZE_K_DVBC;
+               height_mask = TS_HEIGHT_MASK_DVBC;
+               break;
+
+       default:
                budget->buffer_width = TS_WIDTH;
                max_bufsize = TS_MAX_BUFSIZE_K;
                height_mask = TS_HEIGHT_MASK;
@@ -415,14 +435,22 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
                dma_buffer_size = max_bufsize;
 
        budget->buffer_height = dma_buffer_size * 1024 / budget->buffer_width;
-       budget->buffer_height &= height_mask;
-       budget->buffer_size = budget->buffer_height * budget->buffer_width;
+       if (budget->buffer_height > 0xfff) {
+               budget->buffer_height /= 2;
+               budget->buffer_height &= height_mask;
+               budget->buffer_size = 2 * budget->buffer_height * budget->buffer_width;
+       } else {
+               budget->buffer_height &= height_mask;
+               budget->buffer_size = budget->buffer_height * budget->buffer_width;
+       }
        budget->buffer_warning_threshold = budget->buffer_size * 80/100;
        budget->buffer_warnings = 0;
        budget->buffer_warning_time = jiffies;
 
-       dprintk(2, "%s: width = %d, height = %d\n",
-               budget->dev->name, budget->buffer_width, budget->buffer_height);
+       dprintk(2, "%s: buffer type = %s, width = %d, height = %d\n",
+               budget->dev->name,
+               budget->buffer_size > budget->buffer_width * budget->buffer_height ? "odd/even" : "single",
+               budget->buffer_width, budget->buffer_height);
        printk("%s: dma buffer size %u\n", budget->dev->name, budget->buffer_size);
 
        if ((ret = dvb_register_adapter(&budget->dvb_adapter, budget->card->name, owner, &budget->dev->pci->dev)) < 0) {