V4L/DVB (3395): Fixed Pinnacle 300i DVB-T support

- 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>

authored by Hartmut Hackmann and committed by Mauro Carvalho Chehab be6f655d 6ba54abe

+18 -8
+7 -2
drivers/media/video/saa7134/saa7134-cards.c
··· 977 977 .radio_type = UNSET, 978 978 .tuner_addr = ADDR_UNSET, 979 979 .radio_addr = ADDR_UNSET, 980 - .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_ACTIVE, 980 + .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_INACTIVE, 981 981 .inputs = {{ 982 982 .name = name_tv, 983 983 .vmux = 3, ··· 1666 1666 .radio_type = UNSET, 1667 1667 .tuner_addr = ADDR_UNSET, 1668 1668 .radio_addr = ADDR_UNSET, 1669 - .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_ACTIVE, 1669 + .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_INACTIVE, 1670 1670 .mpeg = SAA7134_MPEG_DVB, 1671 1671 .inputs = {{ 1672 1672 .name = name_tv, ··· 3205 3205 /* power-up tuner chip */ 3206 3206 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000); 3207 3207 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000); 3208 + case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: 3209 + /* this turns the remote control chip off to work around a bug in it */ 3210 + saa_writeb(SAA7134_GPIO_GPMODE1, 0x80); 3211 + saa_writeb(SAA7134_GPIO_GPSTATUS1, 0x80); 3212 + break; 3208 3213 case SAA7134_BOARD_MONSTERTV_MOBILE: 3209 3214 /* power-up tuner chip */ 3210 3215 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000);
+8 -4
drivers/media/video/saa7134/saa7134-dvb.c
··· 110 110 mt352_write(fe, fsm_ctl_cfg, sizeof(fsm_ctl_cfg)); 111 111 mt352_write(fe, scan_ctl_cfg, sizeof(scan_ctl_cfg)); 112 112 mt352_write(fe, irq_cfg, sizeof(irq_cfg)); 113 + 113 114 return 0; 114 115 } 115 116 ··· 118 117 struct dvb_frontend_parameters* params, 119 118 u8* pllbuf) 120 119 { 121 - static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; 122 - static int off = TDA9887_PRESENT | TDA9887_PORT2_ACTIVE; 120 + u8 off[] = { 0x00, 0xf1}; 121 + u8 on[] = { 0x00, 0x71}; 122 + struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)}; 123 + 123 124 struct saa7134_dev *dev = fe->dvb->priv; 124 125 struct v4l2_frequency f; 125 126 ··· 129 126 f.tuner = 0; 130 127 f.type = V4L2_TUNER_DIGITAL_TV; 131 128 f.frequency = params->frequency / 1000 * 16 / 1000; 132 - saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&on); 129 + i2c_transfer(&dev->i2c_adap, &msg, 1); 133 130 saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); 134 - saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&off); 131 + msg.buf = on; 132 + i2c_transfer(&dev->i2c_adap, &msg, 1); 135 133 136 134 pinnacle_antenna_pwr(dev, antenna_pwr); 137 135
+3 -2
drivers/media/video/tuner-core.c
··· 713 713 struct v4l2_frequency *f = arg; 714 714 715 715 switch_v4l2(); 716 - if (V4L2_TUNER_RADIO == f->type && 717 - V4L2_TUNER_RADIO != t->mode) { 716 + if ((V4L2_TUNER_RADIO == f->type && V4L2_TUNER_RADIO != t->mode) 717 + || (V4L2_TUNER_DIGITAL_TV == f->type 718 + && V4L2_TUNER_DIGITAL_TV != t->mode)) { 718 719 if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") 719 720 == EINVAL) 720 721 return 0;