V4L/DVB (3395): Fixed Pinnacle 300i DVB-T support
authorHartmut Hackmann <hartmut.hackmann@t\-online.de>
Fri, 3 Mar 2006 15:09:26 +0000 (12:09 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 3 Mar 2006 15:09:26 +0000 (12:09 -0300)
- fixed tda9886 port 2 setting
- turned remote control receiver off via saa7134 GPIO to avoid i2c hangs
- modified tda9886 client calls to direct i2c access to allow proper return
  to analog mode
- allow mode change to V4L2_TUNER_DIGITAL_TV in tuner VIDIOC_S_FREQUENCY
  client call

Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-dvb.c
drivers/media/video/tuner-core.c

index ccf7231..722ebff 100644 (file)
@@ -1003,7 +1003,7 @@ struct saa7134_board saa7134_boards[] = {
                .radio_type     = UNSET,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_ACTIVE,
+               .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_INACTIVE,
                .inputs         = {{
                        .name = name_tv,
                        .vmux = 3,
@@ -1692,7 +1692,7 @@ struct saa7134_board saa7134_boards[] = {
                .radio_type     = UNSET,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_ACTIVE,
+               .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_INACTIVE,
                .mpeg           = SAA7134_MPEG_DVB,
                .inputs         = {{
                        .name = name_tv,
@@ -3375,6 +3375,11 @@ int saa7134_board_init1(struct saa7134_dev *dev)
                /* power-up tuner chip */
                saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0x00040000, 0x00040000);
                saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000);
+       case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
+               /* this turns the remote control chip off to work around a bug in it */
+               saa_writeb(SAA7134_GPIO_GPMODE1, 0x80);
+               saa_writeb(SAA7134_GPIO_GPSTATUS1, 0x80);
+               break;
        case SAA7134_BOARD_MONSTERTV_MOBILE:
                /* power-up tuner chip */
                saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0x00040000, 0x00040000);
index 7577962..5969481 100644 (file)
@@ -110,6 +110,7 @@ static int mt352_pinnacle_init(struct dvb_frontend* fe)
        mt352_write(fe, fsm_ctl_cfg,    sizeof(fsm_ctl_cfg));
        mt352_write(fe, scan_ctl_cfg,   sizeof(scan_ctl_cfg));
        mt352_write(fe, irq_cfg,        sizeof(irq_cfg));
+
        return 0;
 }
 
@@ -135,8 +136,10 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
                                  struct dvb_frontend_parameters* params,
                                  u8* pllbuf)
 {
-       static int on  = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
-       static int off = TDA9887_PRESENT | TDA9887_PORT2_ACTIVE;
+       u8 off[] = { 0x00, 0xf1};
+       u8 on[]  = { 0x00, 0x71};
+       struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)};
+
        struct saa7134_dev *dev = fe->dvb->priv;
        struct v4l2_frequency f;
 
@@ -144,9 +147,10 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe,
        f.tuner     = 0;
        f.type      = V4L2_TUNER_DIGITAL_TV;
        f.frequency = params->frequency / 1000 * 16 / 1000;
-       saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&on);
+       i2c_transfer(&dev->i2c_adap, &msg, 1);
        saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f);
-       saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&off);
+       msg.buf = on;
+       i2c_transfer(&dev->i2c_adap, &msg, 1);
 
        pinnacle_antenna_pwr(dev, antenna_pwr);
 
index 3964244..32e1849 100644 (file)
@@ -713,8 +713,9 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
                        struct v4l2_frequency *f = arg;
 
                        switch_v4l2();
-                       if (V4L2_TUNER_RADIO == f->type &&
-                           V4L2_TUNER_RADIO != t->mode) {
+                       if ((V4L2_TUNER_RADIO == f->type && V4L2_TUNER_RADIO != t->mode)
+                               || (V4L2_TUNER_DIGITAL_TV == f->type
+                                       && V4L2_TUNER_DIGITAL_TV != t->mode)) {
                                if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
                                            == EINVAL)
                                        return 0;