This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] Add DVB support for SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG
Author:  Mauro Carvalho Chehab <[email protected]>
Date:    Sun Oct 3 07:01:26 2010 -0300

Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/video/saa7134/saa7134-cards.c |   23 ++++++++-------
 drivers/media/video/saa7134/saa7134-dvb.c   |   39 ++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 21 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=7679b95730fce8269b540e5a7eed19f817d9496c

diff --git a/drivers/media/video/saa7134/saa7134-cards.c 
b/drivers/media/video/saa7134/saa7134-cards.c
index 4bc0070..215c0cd 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -5179,12 +5179,23 @@ struct saa7134_board saa7134_boards[] = {
        [SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG] = {
                .name           = "Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid",
                .audio_clock    = 0x00187de7,
+#if 0
+       /*
+        * FIXME: Analog mode doesn't work, if digital is enabled. The proper
+        * fix is to use tda8290 driver, but Kworld seems to use an
+        * unsupported version of tda8295.
+        */
                .tuner_type     = TUNER_NXP_TDA18271,   /* 
TUNER_PHILIPS_TDA8290 */
-               .radio_type     = UNSET,
                .tuner_addr     = 0x60,
+#else
+               .tuner_type     = UNSET,
+               .tuner_addr     = ADDR_UNSET,
+#endif
+               .radio_type     = UNSET,
                .radio_addr     = ADDR_UNSET,
                .gpiomask       = 0x8e054000,
                .mpeg           = SAA7134_MPEG_DVB,
+               .ts_type        = SAA7134_MPEG_TS_PARALLEL,
                .inputs = { {
                        .name   = name_tv,
                        .vmux   = 1,
@@ -7623,16 +7634,6 @@ int saa7134_board_init2(struct saa7134_dev *dev)
                        {0x45, 0x97},
                        {0x45, 0xc1},
                };
-
-               saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x0000);
-               saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0000);
-               saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x0000);
-               saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000);
-               saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0000);
-               saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000);
-               saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000);
-               saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000);
-               saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0000);
                saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000);
                saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000);
 
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c 
b/drivers/media/video/saa7134/saa7134-dvb.c
index 1920e2a..3315a48 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -623,25 +623,34 @@ static struct tda827x_config tda827x_cfg_2_sw42 = {
 
 /* ------------------------------------------------------------------ */
 
-static int kworld_sbtvd_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
+static int __kworld_sbtvd_i2c_gate_ctrl(struct saa7134_dev *dev, int enable)
 {
-       struct tda18271_state *state = fe->demodulator_priv;
-       struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .len = 2};
-       unsigned char msg_enable[2] = { 0x45, 0xc1 };
-       unsigned char msg_disable[2] = { 0x45, 0x81 };
+       unsigned char initmsg[] = {0x45, 0x97};
+       unsigned char msg_enable[] = {0x45, 0xc1};
+       unsigned char msg_disable[] = {0x45, 0x81};
+       struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 
2};
 
+       if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
+               wprintk("could not access the I2C gate\n");
+               return -EIO;
+       }
        if (enable)
                msg.buf = msg_enable;
        else
                msg.buf = msg_disable;
-       if (i2c_transfer(state->i2c, &msg, 1) != 1) {
-               struct saa7134_dev *dev = fe->dvb->priv;
+       if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
                wprintk("could not access the I2C gate\n");
                return -EIO;
        }
        msleep(20);
        return 0;
 }
+static int kworld_sbtvd_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
+{
+       struct saa7134_dev *dev = fe->dvb->priv;
+
+       return __kworld_sbtvd_i2c_gate_ctrl(dev, enable);
+}
 
 /* ------------------------------------------------------------------ */
 
@@ -1651,17 +1660,27 @@ static int dvb_init(struct saa7134_dev *dev)
                }
                break;
        case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG:
-               fe0->ops.i2c_gate_ctrl =
+               __kworld_sbtvd_i2c_gate_ctrl(dev, 0);
+               saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x14000);
+               saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x14000);
+               msleep(20);
+               saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x54000);
+               saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x54000);
+               msleep(20);
                fe0->dvb.frontend = dvb_attach(mb86a20s_attach,
                                               &kworld_mb86a20s_config,
                                               &dev->i2c_adap);
-               fe0->ops.i2c_gate_ctrl(fe, 1);
+               __kworld_sbtvd_i2c_gate_ctrl(dev, 1);
                if (fe0->dvb.frontend != NULL) {
                        dvb_attach(tda18271_attach, fe0->dvb.frontend,
                                   0x60, &dev->i2c_adap,
                                   &kworld_tda18271_config);
+                       /*
+                        * Only after success, it can initialize the gate, 
otherwise
+                        * an OOPS will hit, due to kfree(fe0->dvb.frontend)
+                        */
+                       fe0->dvb.frontend->ops.i2c_gate_ctrl = 
kworld_sbtvd_i2c_gate_ctrl;
                }
-
                break;
        default:
                wprintk("Huh? unknown DVB card?\n");

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to