Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
| 4 | * |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 5 | * Extended 3 / 2005 by Hartmut Hackmann to support various |
| 6 | * cards with the tda10046 DVB-T channel decoder |
| 7 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 21 | */ |
| 22 | |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/list.h> |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/kernel.h> |
| 27 | #include <linux/slab.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/kthread.h> |
| 30 | #include <linux/suspend.h> |
| 31 | |
| 32 | #include "saa7134-reg.h" |
| 33 | #include "saa7134.h" |
Michael Krufky | 5e453dc | 2006-01-09 15:32:31 -0200 | [diff] [blame] | 34 | #include <media/v4l2-common.h> |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 35 | #include "dvb-pll.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Andrew de Quincey | 1f10c7a | 2006-08-08 09:10:09 -0300 | [diff] [blame] | 37 | #include "mt352.h" |
| 38 | #include "mt352_priv.h" /* FIXME */ |
| 39 | #include "tda1004x.h" |
| 40 | #include "nxt200x.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 42 | #include "tda10086.h" |
| 43 | #include "tda826x.h" |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 44 | #include "tda827x.h" |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 45 | #include "isl6421.h" |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
| 48 | MODULE_LICENSE("GPL"); |
| 49 | |
| 50 | static unsigned int antenna_pwr = 0; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | module_param(antenna_pwr, int, 0444); |
| 53 | MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); |
| 54 | |
Stephan Berberig | b331daa | 2006-12-20 09:37:05 -0300 | [diff] [blame] | 55 | static int use_frontend = 0; |
| 56 | module_param(use_frontend, int, 0644); |
| 57 | MODULE_PARM_DESC(use_frontend,"for cards with multiple frontends (0: terrestrial, 1: satellite)"); |
Nico Sabbi | 1f683cd | 2006-11-15 22:06:56 -0300 | [diff] [blame] | 58 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 59 | static int debug = 0; |
| 60 | module_param(debug, int, 0644); |
| 61 | MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off)."); |
| 62 | |
| 63 | #define dprintk(fmt, arg...) if (debug) \ |
| 64 | printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg) |
| 65 | |
| 66 | /* ------------------------------------------------------------------ |
| 67 | * mt352 based DVB-T cards |
| 68 | */ |
| 69 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) |
| 71 | { |
| 72 | u32 ok; |
| 73 | |
| 74 | if (!on) { |
| 75 | saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26)); |
| 76 | saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26)); |
| 77 | return 0; |
| 78 | } |
| 79 | |
| 80 | saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26)); |
| 81 | saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26)); |
| 82 | udelay(10); |
| 83 | |
| 84 | saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 28)); |
| 85 | saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28)); |
| 86 | udelay(10); |
| 87 | saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28)); |
| 88 | udelay(10); |
| 89 | ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27); |
| 90 | printk("%s: %s %s\n", dev->name, __FUNCTION__, |
| 91 | ok ? "on" : "off"); |
| 92 | |
| 93 | if (!ok) |
| 94 | saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26)); |
| 95 | return ok; |
| 96 | } |
| 97 | |
| 98 | static int mt352_pinnacle_init(struct dvb_frontend* fe) |
| 99 | { |
| 100 | static u8 clock_config [] = { CLOCK_CTL, 0x3d, 0x28 }; |
| 101 | static u8 reset [] = { RESET, 0x80 }; |
| 102 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 103 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 }; |
| 104 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x31 }; |
| 105 | static u8 fsm_ctl_cfg[] = { 0x7b, 0x04 }; |
| 106 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x0f }; |
| 107 | static u8 scan_ctl_cfg [] = { SCAN_CTL, 0x0d }; |
| 108 | static u8 irq_cfg [] = { INTERRUPT_EN_0, 0x00, 0x00, 0x00, 0x00 }; |
| 109 | struct saa7134_dev *dev= fe->dvb->priv; |
| 110 | |
| 111 | printk("%s: %s called\n",dev->name,__FUNCTION__); |
| 112 | |
| 113 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 114 | udelay(200); |
| 115 | mt352_write(fe, reset, sizeof(reset)); |
| 116 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 117 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 118 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 119 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 120 | |
| 121 | mt352_write(fe, fsm_ctl_cfg, sizeof(fsm_ctl_cfg)); |
| 122 | mt352_write(fe, scan_ctl_cfg, sizeof(scan_ctl_cfg)); |
| 123 | mt352_write(fe, irq_cfg, sizeof(irq_cfg)); |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 124 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | return 0; |
| 126 | } |
| 127 | |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 128 | static int mt352_aver777_init(struct dvb_frontend* fe) |
| 129 | { |
| 130 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d }; |
| 131 | static u8 reset [] = { RESET, 0x80 }; |
| 132 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 133 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 }; |
| 134 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 }; |
| 135 | |
| 136 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 137 | udelay(200); |
| 138 | mt352_write(fe, reset, sizeof(reset)); |
| 139 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 140 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 141 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 142 | |
| 143 | return 0; |
| 144 | } |
| 145 | |
Andrew de Quincey | 0463f12 | 2006-05-16 17:22:02 -0300 | [diff] [blame] | 146 | static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, |
| 147 | struct dvb_frontend_parameters* params) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | { |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 149 | u8 off[] = { 0x00, 0xf1}; |
| 150 | u8 on[] = { 0x00, 0x71}; |
| 151 | struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)}; |
| 152 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | struct saa7134_dev *dev = fe->dvb->priv; |
| 154 | struct v4l2_frequency f; |
| 155 | |
| 156 | /* set frequency (mt2050) */ |
| 157 | f.tuner = 0; |
| 158 | f.type = V4L2_TUNER_DIGITAL_TV; |
| 159 | f.frequency = params->frequency / 1000 * 16 / 1000; |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 160 | if (fe->ops.i2c_gate_ctrl) |
| 161 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 162 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 164 | msg.buf = on; |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 165 | if (fe->ops.i2c_gate_ctrl) |
| 166 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 167 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | |
| 169 | pinnacle_antenna_pwr(dev, antenna_pwr); |
| 170 | |
| 171 | /* mt352 setup */ |
Andrew de Quincey | 0463f12 | 2006-05-16 17:22:02 -0300 | [diff] [blame] | 172 | return mt352_pinnacle_init(fe); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | } |
| 174 | |
Andrew de Quincey | bd4956b | 2006-04-18 21:38:49 -0300 | [diff] [blame] | 175 | static int mt352_aver777_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf, int buf_len) |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 176 | { |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 177 | if (buf_len < 5) |
| 178 | return -EINVAL; |
| 179 | |
| 180 | pllbuf[0] = 0x61; |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 181 | dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1, |
| 182 | params->frequency, |
| 183 | params->u.ofdm.bandwidth); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 184 | return 5; |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 185 | } |
| 186 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | static struct mt352_config pinnacle_300i = { |
| 188 | .demod_address = 0x3c >> 1, |
| 189 | .adc_clock = 20333, |
| 190 | .if2 = 36150, |
| 191 | .no_tuner = 1, |
| 192 | .demod_init = mt352_pinnacle_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | }; |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 194 | |
| 195 | static struct mt352_config avermedia_777 = { |
| 196 | .demod_address = 0xf, |
| 197 | .demod_init = mt352_aver777_init, |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 198 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 200 | /* ================================================================== |
| 201 | * tda1004x based DVB-T cards, helper functions |
| 202 | */ |
| 203 | |
| 204 | static int philips_tda1004x_request_firmware(struct dvb_frontend *fe, |
| 205 | const struct firmware **fw, char *name) |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 206 | { |
| 207 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 208 | return request_firmware(fw, name, &dev->pci->dev); |
| 209 | } |
| 210 | |
| 211 | static void philips_tda1004x_set_board_name(struct dvb_frontend *fe, char *name) |
| 212 | { |
| 213 | size_t len; |
| 214 | |
| 215 | len = sizeof(fe->ops.info.name); |
| 216 | strncpy(fe->ops.info.name, name, len); |
| 217 | fe->ops.info.name[len - 1] = 0; |
| 218 | } |
| 219 | |
| 220 | /* ------------------------------------------------------------------ |
| 221 | * these tuners are tu1216, td1316(a) |
| 222 | */ |
| 223 | |
| 224 | static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
| 225 | { |
| 226 | struct saa7134_dev *dev = fe->dvb->priv; |
| 227 | struct tda1004x_state *state = fe->demodulator_priv; |
| 228 | u8 addr = state->config->tuner_address; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 229 | u8 tuner_buf[4]; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 230 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len = |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 231 | sizeof(tuner_buf) }; |
| 232 | int tuner_frequency = 0; |
| 233 | u8 band, cp, filter; |
| 234 | |
| 235 | /* determine charge pump */ |
| 236 | tuner_frequency = params->frequency + 36166000; |
| 237 | if (tuner_frequency < 87000000) |
| 238 | return -EINVAL; |
| 239 | else if (tuner_frequency < 130000000) |
| 240 | cp = 3; |
| 241 | else if (tuner_frequency < 160000000) |
| 242 | cp = 5; |
| 243 | else if (tuner_frequency < 200000000) |
| 244 | cp = 6; |
| 245 | else if (tuner_frequency < 290000000) |
| 246 | cp = 3; |
| 247 | else if (tuner_frequency < 420000000) |
| 248 | cp = 5; |
| 249 | else if (tuner_frequency < 480000000) |
| 250 | cp = 6; |
| 251 | else if (tuner_frequency < 620000000) |
| 252 | cp = 3; |
| 253 | else if (tuner_frequency < 830000000) |
| 254 | cp = 5; |
| 255 | else if (tuner_frequency < 895000000) |
| 256 | cp = 7; |
| 257 | else |
| 258 | return -EINVAL; |
| 259 | |
| 260 | /* determine band */ |
| 261 | if (params->frequency < 49000000) |
| 262 | return -EINVAL; |
| 263 | else if (params->frequency < 161000000) |
| 264 | band = 1; |
| 265 | else if (params->frequency < 444000000) |
| 266 | band = 2; |
| 267 | else if (params->frequency < 861000000) |
| 268 | band = 4; |
| 269 | else |
| 270 | return -EINVAL; |
| 271 | |
| 272 | /* setup PLL filter */ |
| 273 | switch (params->u.ofdm.bandwidth) { |
| 274 | case BANDWIDTH_6_MHZ: |
| 275 | filter = 0; |
| 276 | break; |
| 277 | |
| 278 | case BANDWIDTH_7_MHZ: |
| 279 | filter = 0; |
| 280 | break; |
| 281 | |
| 282 | case BANDWIDTH_8_MHZ: |
| 283 | filter = 1; |
| 284 | break; |
| 285 | |
| 286 | default: |
| 287 | return -EINVAL; |
| 288 | } |
| 289 | |
| 290 | /* calculate divisor |
| 291 | * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) |
| 292 | */ |
| 293 | tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000; |
| 294 | |
| 295 | /* setup tuner buffer */ |
| 296 | tuner_buf[0] = (tuner_frequency >> 8) & 0x7f; |
| 297 | tuner_buf[1] = tuner_frequency & 0xff; |
| 298 | tuner_buf[2] = 0xca; |
| 299 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; |
| 300 | |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 301 | if (fe->ops.i2c_gate_ctrl) |
| 302 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 303 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) { |
| 304 | printk("%s/dvb: could not write to tuner at addr: 0x%02x\n",dev->name, addr << 1); |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 305 | return -EIO; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 306 | } |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 307 | msleep(1); |
| 308 | return 0; |
| 309 | } |
| 310 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 311 | static int philips_tu1216_init(struct dvb_frontend *fe) |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 312 | { |
| 313 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 314 | struct tda1004x_state *state = fe->demodulator_priv; |
| 315 | u8 addr = state->config->tuner_address; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 316 | static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; |
| 317 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; |
| 318 | |
| 319 | /* setup PLL configuration */ |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 320 | if (fe->ops.i2c_gate_ctrl) |
| 321 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 322 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) |
| 323 | return -EIO; |
| 324 | msleep(1); |
| 325 | |
| 326 | return 0; |
| 327 | } |
| 328 | |
| 329 | /* ------------------------------------------------------------------ */ |
| 330 | |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 331 | static struct tda1004x_config philips_tu1216_60_config = { |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 332 | .demod_address = 0x8, |
| 333 | .invert = 1, |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 334 | .invert_oclk = 0, |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 335 | .xtal_freq = TDA10046_XTAL_4M, |
| 336 | .agc_config = TDA10046_AGC_DEFAULT, |
| 337 | .if_freq = TDA10046_FREQ_3617, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 338 | .tuner_address = 0x60, |
| 339 | .request_firmware = philips_tda1004x_request_firmware |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | }; |
| 341 | |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 342 | static struct tda1004x_config philips_tu1216_61_config = { |
| 343 | |
| 344 | .demod_address = 0x8, |
| 345 | .invert = 1, |
| 346 | .invert_oclk = 0, |
| 347 | .xtal_freq = TDA10046_XTAL_4M, |
| 348 | .agc_config = TDA10046_AGC_DEFAULT, |
| 349 | .if_freq = TDA10046_FREQ_3617, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 350 | .tuner_address = 0x61, |
| 351 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 352 | }; |
| 353 | |
| 354 | /* ------------------------------------------------------------------ */ |
| 355 | |
Hartmut Hackmann | cbb9452 | 2006-10-30 20:00:16 -0300 | [diff] [blame] | 356 | static int philips_td1316_tuner_init(struct dvb_frontend *fe) |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 357 | { |
| 358 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 359 | struct tda1004x_state *state = fe->demodulator_priv; |
| 360 | u8 addr = state->config->tuner_address; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 361 | static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 362 | struct i2c_msg init_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 363 | |
| 364 | /* setup PLL configuration */ |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 365 | if (fe->ops.i2c_gate_ctrl) |
| 366 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 367 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) |
| 368 | return -EIO; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 369 | return 0; |
| 370 | } |
| 371 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 372 | static int philips_td1316_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 373 | { |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 374 | return philips_tda6651_pll_set(fe, params); |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 375 | } |
| 376 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 377 | static int philips_td1316_tuner_sleep(struct dvb_frontend *fe) |
| 378 | { |
| 379 | struct saa7134_dev *dev = fe->dvb->priv; |
| 380 | struct tda1004x_state *state = fe->demodulator_priv; |
| 381 | u8 addr = state->config->tuner_address; |
| 382 | static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 }; |
| 383 | struct i2c_msg analog_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
| 384 | |
| 385 | /* switch the tuner to analog mode */ |
| 386 | if (fe->ops.i2c_gate_ctrl) |
| 387 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 388 | if (i2c_transfer(&dev->i2c_adap, &analog_msg, 1) != 1) |
| 389 | return -EIO; |
| 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | /* ------------------------------------------------------------------ */ |
| 394 | |
Hartmut Hackmann | cbb9452 | 2006-10-30 20:00:16 -0300 | [diff] [blame] | 395 | static int philips_europa_tuner_init(struct dvb_frontend *fe) |
| 396 | { |
| 397 | struct saa7134_dev *dev = fe->dvb->priv; |
| 398 | static u8 msg[] = { 0x00, 0x40}; |
| 399 | struct i2c_msg init_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
| 400 | |
| 401 | |
| 402 | if (philips_td1316_tuner_init(fe)) |
| 403 | return -EIO; |
| 404 | msleep(1); |
| 405 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) |
| 406 | return -EIO; |
| 407 | |
| 408 | return 0; |
| 409 | } |
| 410 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 411 | static int philips_europa_tuner_sleep(struct dvb_frontend *fe) |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 412 | { |
| 413 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 414 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 415 | static u8 msg[] = { 0x00, 0x14 }; |
| 416 | struct i2c_msg analog_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
| 417 | |
| 418 | if (philips_td1316_tuner_sleep(fe)) |
| 419 | return -EIO; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 420 | |
| 421 | /* switch the board to analog mode */ |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 422 | if (fe->ops.i2c_gate_ctrl) |
| 423 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 424 | i2c_transfer(&dev->i2c_adap, &analog_msg, 1); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 425 | return 0; |
| 426 | } |
| 427 | |
| 428 | static int philips_europa_demod_sleep(struct dvb_frontend *fe) |
| 429 | { |
| 430 | struct saa7134_dev *dev = fe->dvb->priv; |
| 431 | |
| 432 | if (dev->original_demod_sleep) |
| 433 | dev->original_demod_sleep(fe); |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 434 | fe->ops.i2c_gate_ctrl(fe, 1); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 435 | return 0; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | static struct tda1004x_config philips_europa_config = { |
| 439 | |
| 440 | .demod_address = 0x8, |
| 441 | .invert = 0, |
| 442 | .invert_oclk = 0, |
| 443 | .xtal_freq = TDA10046_XTAL_4M, |
| 444 | .agc_config = TDA10046_AGC_IFO_AUTO_POS, |
| 445 | .if_freq = TDA10046_FREQ_052, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 446 | .tuner_address = 0x61, |
| 447 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 448 | }; |
| 449 | |
| 450 | /* ------------------------------------------------------------------ */ |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 451 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 452 | static int philips_fmd1216_tuner_init(struct dvb_frontend *fe) |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 453 | { |
| 454 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 455 | struct tda1004x_state *state = fe->demodulator_priv; |
| 456 | u8 addr = state->config->tuner_address; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 457 | /* this message is to set up ATC and ALC */ |
| 458 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 459 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 460 | |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 461 | if (fe->ops.i2c_gate_ctrl) |
| 462 | fe->ops.i2c_gate_ctrl(fe, 1); |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 463 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) |
| 464 | return -EIO; |
| 465 | msleep(1); |
| 466 | |
| 467 | return 0; |
| 468 | } |
| 469 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 470 | static int philips_fmd1216_tuner_sleep(struct dvb_frontend *fe) |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 471 | { |
| 472 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 473 | struct tda1004x_state *state = fe->demodulator_priv; |
| 474 | u8 addr = state->config->tuner_address; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 475 | /* this message actually turns the tuner back to analog mode */ |
| 476 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 477 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 478 | |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 479 | if (fe->ops.i2c_gate_ctrl) |
| 480 | fe->ops.i2c_gate_ctrl(fe, 1); |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 481 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); |
| 482 | msleep(1); |
| 483 | fmd1216_init[2] = 0x86; |
| 484 | fmd1216_init[3] = 0x54; |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 485 | if (fe->ops.i2c_gate_ctrl) |
| 486 | fe->ops.i2c_gate_ctrl(fe, 1); |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 487 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); |
| 488 | msleep(1); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 489 | return 0; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 490 | } |
| 491 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 492 | static int philips_fmd1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 493 | { |
| 494 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 495 | struct tda1004x_state *state = fe->demodulator_priv; |
| 496 | u8 addr = state->config->tuner_address; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 497 | u8 tuner_buf[4]; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 498 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len = |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 499 | sizeof(tuner_buf) }; |
| 500 | int tuner_frequency = 0; |
| 501 | int divider = 0; |
| 502 | u8 band, mode, cp; |
| 503 | |
| 504 | /* determine charge pump */ |
| 505 | tuner_frequency = params->frequency + 36130000; |
| 506 | if (tuner_frequency < 87000000) |
| 507 | return -EINVAL; |
| 508 | /* low band */ |
| 509 | else if (tuner_frequency < 180000000) { |
| 510 | band = 1; |
| 511 | mode = 7; |
| 512 | cp = 0; |
| 513 | } else if (tuner_frequency < 195000000) { |
| 514 | band = 1; |
| 515 | mode = 6; |
| 516 | cp = 1; |
| 517 | /* mid band */ |
| 518 | } else if (tuner_frequency < 366000000) { |
| 519 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { |
| 520 | band = 10; |
| 521 | } else { |
| 522 | band = 2; |
| 523 | } |
| 524 | mode = 7; |
| 525 | cp = 0; |
| 526 | } else if (tuner_frequency < 478000000) { |
| 527 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { |
| 528 | band = 10; |
| 529 | } else { |
| 530 | band = 2; |
| 531 | } |
| 532 | mode = 6; |
| 533 | cp = 1; |
| 534 | /* high band */ |
| 535 | } else if (tuner_frequency < 662000000) { |
| 536 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { |
| 537 | band = 12; |
| 538 | } else { |
| 539 | band = 4; |
| 540 | } |
| 541 | mode = 7; |
| 542 | cp = 0; |
| 543 | } else if (tuner_frequency < 840000000) { |
| 544 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { |
| 545 | band = 12; |
| 546 | } else { |
| 547 | band = 4; |
| 548 | } |
| 549 | mode = 6; |
| 550 | cp = 1; |
| 551 | } else { |
| 552 | if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) { |
| 553 | band = 12; |
| 554 | } else { |
| 555 | band = 4; |
| 556 | } |
| 557 | mode = 7; |
| 558 | cp = 1; |
| 559 | |
| 560 | } |
| 561 | /* calculate divisor */ |
| 562 | /* ((36166000 + Finput) / 166666) rounded! */ |
| 563 | divider = (tuner_frequency + 83333) / 166667; |
| 564 | |
| 565 | /* setup tuner buffer */ |
| 566 | tuner_buf[0] = (divider >> 8) & 0x7f; |
| 567 | tuner_buf[1] = divider & 0xff; |
| 568 | tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4; |
| 569 | tuner_buf[3] = 0x40 | band; |
| 570 | |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 571 | if (fe->ops.i2c_gate_ctrl) |
| 572 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 573 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) { |
| 574 | printk("%s/dvb: could not write to tuner at addr: 0x%02x\n",dev->name, addr << 1); |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 575 | return -EIO; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 576 | } |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 577 | return 0; |
| 578 | } |
| 579 | |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 580 | static struct tda1004x_config medion_cardbus = { |
| 581 | .demod_address = 0x08, |
| 582 | .invert = 1, |
| 583 | .invert_oclk = 0, |
| 584 | .xtal_freq = TDA10046_XTAL_16M, |
| 585 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, |
| 586 | .if_freq = TDA10046_FREQ_3613, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 587 | .tuner_address = 0x61, |
| 588 | .request_firmware = philips_tda1004x_request_firmware |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 589 | }; |
| 590 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 591 | /* ------------------------------------------------------------------ |
| 592 | * tda 1004x based cards with philips silicon tuner |
| 593 | */ |
| 594 | |
| 595 | static void philips_tda827x_lna_gain(struct dvb_frontend *fe, int high) |
| 596 | { |
| 597 | struct saa7134_dev *dev = fe->dvb->priv; |
| 598 | struct tda1004x_state *state = fe->demodulator_priv; |
| 599 | u8 addr = state->config->i2c_gate; |
| 600 | u8 config = state->config->tuner_config; |
| 601 | u8 GP00_CF[] = {0x20, 0x01}; |
| 602 | u8 GP00_LEV[] = {0x22, 0x00}; |
| 603 | |
| 604 | struct i2c_msg msg = {.addr = addr,.flags = 0,.buf = GP00_CF, .len = 2}; |
| 605 | if (config) { |
| 606 | if (high) { |
| 607 | dprintk("setting LNA to high gain\n"); |
| 608 | } else { |
| 609 | dprintk("setting LNA to low gain\n"); |
| 610 | } |
| 611 | } |
| 612 | switch (config) { |
| 613 | case 0: /* no LNA */ |
| 614 | break; |
| 615 | case 1: /* switch is GPIO 0 of tda8290 */ |
| 616 | case 2: |
| 617 | /* turn Vsync off */ |
| 618 | saa7134_set_gpio(dev, 22, 0); |
| 619 | GP00_LEV[1] = high ? 0 : 1; |
| 620 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) { |
| 621 | printk("%s/dvb: could not access tda8290 at addr: 0x%02x\n",dev->name, addr << 1); |
| 622 | return; |
| 623 | } |
| 624 | msg.buf = GP00_LEV; |
| 625 | if (config == 2) |
| 626 | GP00_LEV[1] = high ? 1 : 0; |
| 627 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
| 628 | break; |
| 629 | case 3: /* switch with GPIO of saa713x */ |
| 630 | saa7134_set_gpio(dev, 22, high); |
| 631 | break; |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable) |
| 636 | { |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 637 | struct tda1004x_state *state = fe->demodulator_priv; |
| 638 | |
| 639 | u8 addr = state->config->i2c_gate; |
| 640 | static u8 tda8290_close[] = { 0x21, 0xc0}; |
| 641 | static u8 tda8290_open[] = { 0x21, 0x80}; |
| 642 | struct i2c_msg tda8290_msg = {.addr = addr,.flags = 0, .len = 2}; |
| 643 | if (enable) { |
| 644 | tda8290_msg.buf = tda8290_close; |
| 645 | } else { |
| 646 | tda8290_msg.buf = tda8290_open; |
| 647 | } |
Hartmut Hackmann | 06be303 | 2007-04-27 12:31:15 -0300 | [diff] [blame] | 648 | if (i2c_transfer(state->i2c, &tda8290_msg, 1) != 1) { |
| 649 | printk("saa7134/dvb: could not access tda8290 I2C gate\n"); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 650 | return -EIO; |
| 651 | } |
| 652 | msleep(20); |
| 653 | return 0; |
| 654 | } |
| 655 | |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 656 | /* ------------------------------------------------------------------ */ |
| 657 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 658 | static int philips_tda827x_tuner_init(struct dvb_frontend *fe) |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 659 | { |
| 660 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 661 | struct tda1004x_state *state = fe->demodulator_priv; |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 662 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 663 | switch (state->config->antenna_switch) { |
| 664 | case 0: break; |
| 665 | case 1: dprintk("setting GPIO21 to 0 (TV antenna?)\n"); |
| 666 | saa7134_set_gpio(dev, 21, 0); |
| 667 | break; |
| 668 | case 2: dprintk("setting GPIO21 to 1 (Radio antenna?)\n"); |
| 669 | saa7134_set_gpio(dev, 21, 1); |
| 670 | break; |
| 671 | } |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 672 | return 0; |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 673 | } |
| 674 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 675 | static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe) |
| 676 | { |
| 677 | struct saa7134_dev *dev = fe->dvb->priv; |
| 678 | struct tda1004x_state *state = fe->demodulator_priv; |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 679 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 680 | switch (state->config->antenna_switch) { |
| 681 | case 0: break; |
| 682 | case 1: dprintk("setting GPIO21 to 1 (Radio antenna?)\n"); |
| 683 | saa7134_set_gpio(dev, 21, 1); |
| 684 | break; |
| 685 | case 2: dprintk("setting GPIO21 to 0 (TV antenna?)\n"); |
| 686 | saa7134_set_gpio(dev, 21, 0); |
| 687 | break; |
| 688 | } |
| 689 | return 0; |
| 690 | } |
| 691 | |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 692 | static struct tda827x_config tda827x_cfg = { |
| 693 | .lna_gain = philips_tda827x_lna_gain, |
| 694 | .init = philips_tda827x_tuner_init, |
| 695 | .sleep = philips_tda827x_tuner_sleep |
| 696 | }; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 697 | |
| 698 | static void configure_tda827x_fe(struct saa7134_dev *dev, struct tda1004x_config *tda_conf, |
| 699 | char *board_name) |
| 700 | { |
| 701 | dev->dvb.frontend = dvb_attach(tda10046_attach, tda_conf, &dev->i2c_adap); |
| 702 | if (dev->dvb.frontend) { |
| 703 | if (tda_conf->i2c_gate) |
| 704 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 705 | dvb_attach(tda827x_attach,dev->dvb.frontend, |
| 706 | tda_conf->tuner_address,&dev->i2c_adap,&tda827x_cfg); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 707 | } |
| 708 | philips_tda1004x_set_board_name(dev->dvb.frontend, board_name); |
| 709 | } |
| 710 | |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 711 | /* ------------------------------------------------------------------ */ |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 712 | static struct tda1004x_config tda827x_lifeview_config = { |
| 713 | .demod_address = 0x08, |
| 714 | .invert = 1, |
| 715 | .invert_oclk = 0, |
| 716 | .xtal_freq = TDA10046_XTAL_16M, |
| 717 | .agc_config = TDA10046_AGC_TDA827X, |
| 718 | .gpio_config = TDA10046_GP11_I, |
| 719 | .if_freq = TDA10046_FREQ_045, |
| 720 | .tuner_address = 0x60, |
| 721 | .request_firmware = philips_tda1004x_request_firmware |
| 722 | }; |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 723 | |
| 724 | static struct tda1004x_config philips_tiger_config = { |
| 725 | .demod_address = 0x08, |
| 726 | .invert = 1, |
| 727 | .invert_oclk = 0, |
| 728 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 729 | .agc_config = TDA10046_AGC_TDA827X, |
| 730 | .gpio_config = TDA10046_GP11_I, |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 731 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 732 | .i2c_gate = 0x4b, |
| 733 | .tuner_address = 0x61, |
| 734 | .tuner_config = 0, |
| 735 | .antenna_switch= 1, |
| 736 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 737 | }; |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 738 | |
| 739 | static struct tda1004x_config cinergy_ht_config = { |
| 740 | .demod_address = 0x08, |
| 741 | .invert = 1, |
| 742 | .invert_oclk = 0, |
| 743 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 744 | .agc_config = TDA10046_AGC_TDA827X, |
| 745 | .gpio_config = TDA10046_GP01_I, |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 746 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 747 | .i2c_gate = 0x4b, |
| 748 | .tuner_address = 0x61, |
| 749 | .tuner_config = 0, |
| 750 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 751 | }; |
| 752 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 753 | static struct tda1004x_config cinergy_ht_pci_config = { |
| 754 | .demod_address = 0x08, |
| 755 | .invert = 1, |
| 756 | .invert_oclk = 0, |
| 757 | .xtal_freq = TDA10046_XTAL_16M, |
| 758 | .agc_config = TDA10046_AGC_TDA827X, |
| 759 | .gpio_config = TDA10046_GP01_I, |
| 760 | .if_freq = TDA10046_FREQ_045, |
| 761 | .i2c_gate = 0x4b, |
| 762 | .tuner_address = 0x60, |
| 763 | .tuner_config = 0, |
| 764 | .request_firmware = philips_tda1004x_request_firmware |
| 765 | }; |
| 766 | |
| 767 | static struct tda1004x_config philips_tiger_s_config = { |
| 768 | .demod_address = 0x08, |
| 769 | .invert = 1, |
| 770 | .invert_oclk = 0, |
| 771 | .xtal_freq = TDA10046_XTAL_16M, |
| 772 | .agc_config = TDA10046_AGC_TDA827X, |
| 773 | .gpio_config = TDA10046_GP01_I, |
| 774 | .if_freq = TDA10046_FREQ_045, |
| 775 | .i2c_gate = 0x4b, |
| 776 | .tuner_address = 0x61, |
| 777 | .tuner_config = 2, |
| 778 | .antenna_switch= 1, |
| 779 | .request_firmware = philips_tda1004x_request_firmware |
| 780 | }; |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 781 | |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 782 | static struct tda1004x_config pinnacle_pctv_310i_config = { |
| 783 | .demod_address = 0x08, |
| 784 | .invert = 1, |
| 785 | .invert_oclk = 0, |
| 786 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 787 | .agc_config = TDA10046_AGC_TDA827X, |
| 788 | .gpio_config = TDA10046_GP11_I, |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 789 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 790 | .i2c_gate = 0x4b, |
| 791 | .tuner_address = 0x61, |
| 792 | .tuner_config = 1, |
| 793 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 794 | }; |
| 795 | |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 796 | static struct tda1004x_config hauppauge_hvr_1110_config = { |
| 797 | .demod_address = 0x08, |
| 798 | .invert = 1, |
| 799 | .invert_oclk = 0, |
| 800 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 801 | .agc_config = TDA10046_AGC_TDA827X, |
| 802 | .gpio_config = TDA10046_GP11_I, |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 803 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 804 | .i2c_gate = 0x4b, |
| 805 | .tuner_address = 0x61, |
| 806 | .request_firmware = philips_tda1004x_request_firmware |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 807 | }; |
| 808 | |
Hartmut Hackmann | 8364681 | 2006-10-12 20:38:51 -0300 | [diff] [blame] | 809 | static struct tda1004x_config asus_p7131_dual_config = { |
| 810 | .demod_address = 0x08, |
| 811 | .invert = 1, |
| 812 | .invert_oclk = 0, |
| 813 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 814 | .agc_config = TDA10046_AGC_TDA827X, |
| 815 | .gpio_config = TDA10046_GP11_I, |
Hartmut Hackmann | 8364681 | 2006-10-12 20:38:51 -0300 | [diff] [blame] | 816 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 817 | .i2c_gate = 0x4b, |
| 818 | .tuner_address = 0x61, |
| 819 | .tuner_config = 0, |
| 820 | .antenna_switch= 2, |
| 821 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 8364681 | 2006-10-12 20:38:51 -0300 | [diff] [blame] | 822 | }; |
| 823 | |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 824 | static struct tda1004x_config lifeview_trio_config = { |
| 825 | .demod_address = 0x09, |
| 826 | .invert = 1, |
| 827 | .invert_oclk = 0, |
| 828 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 829 | .agc_config = TDA10046_AGC_TDA827X, |
| 830 | .gpio_config = TDA10046_GP00_I, |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 831 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 832 | .tuner_address = 0x60, |
| 833 | .request_firmware = philips_tda1004x_request_firmware |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 834 | }; |
| 835 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 836 | static struct tda1004x_config tevion_dvbt220rf_config = { |
| 837 | .demod_address = 0x08, |
| 838 | .invert = 1, |
| 839 | .invert_oclk = 0, |
| 840 | .xtal_freq = TDA10046_XTAL_16M, |
| 841 | .agc_config = TDA10046_AGC_TDA827X, |
| 842 | .gpio_config = TDA10046_GP11_I, |
| 843 | .if_freq = TDA10046_FREQ_045, |
| 844 | .tuner_address = 0x60, |
| 845 | .request_firmware = philips_tda1004x_request_firmware |
| 846 | }; |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 847 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 848 | static struct tda1004x_config md8800_dvbt_config = { |
| 849 | .demod_address = 0x08, |
| 850 | .invert = 1, |
| 851 | .invert_oclk = 0, |
| 852 | .xtal_freq = TDA10046_XTAL_16M, |
| 853 | .agc_config = TDA10046_AGC_TDA827X, |
| 854 | .gpio_config = TDA10046_GP01_I, |
| 855 | .if_freq = TDA10046_FREQ_045, |
| 856 | .i2c_gate = 0x4b, |
| 857 | .tuner_address = 0x60, |
| 858 | .tuner_config = 0, |
| 859 | .request_firmware = philips_tda1004x_request_firmware |
| 860 | }; |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 861 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 862 | /* ------------------------------------------------------------------ |
| 863 | * special case: this card uses saa713x GPIO22 for the mode switch |
| 864 | */ |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 865 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 866 | static int ads_duo_tuner_init(struct dvb_frontend *fe) |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 867 | { |
| 868 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 869 | philips_tda827x_tuner_init(fe); |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 870 | /* route TDA8275a AGC input to the channel decoder */ |
Hartmut Hackmann | 06be303 | 2007-04-27 12:31:15 -0300 | [diff] [blame] | 871 | saa7134_set_gpio(dev, 22, 1); |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 872 | return 0; |
| 873 | } |
| 874 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 875 | static int ads_duo_tuner_sleep(struct dvb_frontend *fe) |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 876 | { |
| 877 | struct saa7134_dev *dev = fe->dvb->priv; |
| 878 | /* route TDA8275a AGC input to the analog IF chip*/ |
Hartmut Hackmann | 06be303 | 2007-04-27 12:31:15 -0300 | [diff] [blame] | 879 | saa7134_set_gpio(dev, 22, 0); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 880 | philips_tda827x_tuner_sleep(fe); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 881 | return 0; |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 882 | } |
| 883 | |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 884 | static struct tda827x_config ads_duo_cfg = { |
| 885 | .lna_gain = philips_tda827x_lna_gain, |
| 886 | .init = ads_duo_tuner_init, |
| 887 | .sleep = ads_duo_tuner_sleep |
| 888 | }; |
| 889 | |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 890 | static struct tda1004x_config ads_tech_duo_config = { |
| 891 | .demod_address = 0x08, |
| 892 | .invert = 1, |
| 893 | .invert_oclk = 0, |
| 894 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 895 | .agc_config = TDA10046_AGC_TDA827X, |
| 896 | .gpio_config = TDA10046_GP00_I, |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 897 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 898 | .tuner_address = 0x61, |
| 899 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 900 | }; |
| 901 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 902 | /* ================================================================== |
| 903 | * tda10086 based DVB-S cards, helper functions |
| 904 | */ |
Hartmut Hackmann | 5eda227 | 2006-08-07 14:03:32 -0300 | [diff] [blame] | 905 | |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 906 | static struct tda10086_config flydvbs = { |
| 907 | .demod_address = 0x0e, |
| 908 | .invert = 0, |
| 909 | }; |
| 910 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 911 | /* ================================================================== |
| 912 | * nxt200x based ATSC cards, helper functions |
| 913 | */ |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 914 | |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 915 | static struct nxt200x_config avertvhda180 = { |
| 916 | .demod_address = 0x0a, |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 917 | }; |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 918 | |
Curt Meyers | fbc81c0 | 2006-02-27 00:08:27 -0300 | [diff] [blame] | 919 | static int nxt200x_set_pll_input(u8 *buf, int input) |
| 920 | { |
| 921 | if (input) |
| 922 | buf[3] |= 0x08; |
| 923 | else |
| 924 | buf[3] &= ~0x08; |
| 925 | return 0; |
| 926 | } |
| 927 | |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 928 | static struct nxt200x_config kworldatsc110 = { |
| 929 | .demod_address = 0x0a, |
Curt Meyers | fbc81c0 | 2006-02-27 00:08:27 -0300 | [diff] [blame] | 930 | .set_pll_input = nxt200x_set_pll_input, |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 931 | }; |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 932 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 933 | /* ================================================================== |
| 934 | * Core code |
| 935 | */ |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 936 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 937 | static int dvb_init(struct saa7134_dev *dev) |
| 938 | { |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 939 | char *board_name; |
Hartmut Hackmann | 1c4f76a | 2007-04-27 12:31:16 -0300 | [diff] [blame^] | 940 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 941 | /* init struct videobuf_dvb */ |
| 942 | dev->ts.nr_bufs = 32; |
| 943 | dev->ts.nr_packets = 32*4; |
| 944 | dev->dvb.name = dev->name; |
| 945 | videobuf_queue_init(&dev->dvb.dvbq, &saa7134_ts_qops, |
| 946 | dev->pci, &dev->slock, |
| 947 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
| 948 | V4L2_FIELD_ALTERNATE, |
| 949 | sizeof(struct saa7134_buf), |
| 950 | dev); |
| 951 | |
| 952 | switch (dev->board) { |
| 953 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
| 954 | printk("%s: pinnacle 300i dvb setup\n",dev->name); |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 955 | dev->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 956 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 957 | if (dev->dvb.frontend) { |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 958 | dev->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 959 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 960 | break; |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 961 | case SAA7134_BOARD_AVERMEDIA_777: |
Petr Baudis | 515c208 | 2006-09-26 16:53:53 -0300 | [diff] [blame] | 962 | case SAA7134_BOARD_AVERMEDIA_A16AR: |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 963 | printk("%s: avertv 777 dvb setup\n",dev->name); |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 964 | dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 965 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 966 | if (dev->dvb.frontend) { |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 967 | dev->dvb.frontend->ops.tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs; |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 968 | } |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 969 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 970 | case SAA7134_BOARD_MD7134: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 971 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 972 | &medion_cardbus, |
| 973 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 974 | if (dev->dvb.frontend) { |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 975 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; |
| 976 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; |
| 977 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 978 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVB-T Medion MD7134"); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 979 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 980 | break; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 981 | case SAA7134_BOARD_PHILIPS_TOUGH: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 982 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 983 | &philips_tu1216_60_config, |
| 984 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 985 | if (dev->dvb.frontend) { |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 986 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
| 987 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
| 988 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVB-T Philips TOUGH"); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 989 | } |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 990 | break; |
| 991 | case SAA7134_BOARD_FLYDVBTDUO: |
Peter Missel | 10b7a90 | 2006-01-23 17:11:06 -0200 | [diff] [blame] | 992 | case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 993 | configure_tda827x_fe(dev, &tda827x_lifeview_config, "DVB-T Lifeview FlyDVB Duo"); |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 994 | break; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 995 | case SAA7134_BOARD_PHILIPS_EUROPA: |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 996 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 997 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 998 | &philips_europa_config, |
| 999 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1000 | if (dev->dvb.frontend) { |
Hartmut Hackmann | 588f983 | 2006-10-18 17:30:42 -0300 | [diff] [blame] | 1001 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; |
| 1002 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 1003 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; |
| 1004 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; |
| 1005 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1006 | if (dev->board == SAA7134_BOARD_VIDEOMATE_DVBT_300) |
| 1007 | board_name = "DVB-T Compro VideoMate 300"; |
| 1008 | else |
| 1009 | board_name = "DVB-T Philips Europa"; |
| 1010 | philips_tda1004x_set_board_name(dev->dvb.frontend, board_name); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1011 | } |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 1012 | break; |
| 1013 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1014 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 1015 | &philips_tu1216_61_config, |
| 1016 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1017 | if (dev->dvb.frontend) { |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1018 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
| 1019 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
| 1020 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVB-T Compro VideoMate 200"); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1021 | } |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 1022 | break; |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 1023 | case SAA7134_BOARD_PHILIPS_TIGER: |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1024 | configure_tda827x_fe(dev, &philips_tiger_config, "DVB-T Philips Tiger"); |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 1025 | break; |
| 1026 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1027 | configure_tda827x_fe(dev, &pinnacle_pctv_310i_config, "DVB-T Pinnacle PCTV 310i"); |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 1028 | break; |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 1029 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1030 | configure_tda827x_fe(dev, &hauppauge_hvr_1110_config, "DVB-T Hauppauge HVR 1110"); |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 1031 | break; |
Hartmut Hackmann | d4b0aba | 2005-11-08 21:38:44 -0800 | [diff] [blame] | 1032 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: |
Hartmut Hackmann | 06be303 | 2007-04-27 12:31:15 -0300 | [diff] [blame] | 1033 | configure_tda827x_fe(dev, &asus_p7131_dual_config, "DVB-T Asus P7131 Dual"); |
Hartmut Hackmann | d4b0aba | 2005-11-08 21:38:44 -0800 | [diff] [blame] | 1034 | break; |
Giampiero Giancipoli | 3d8466e | 2006-02-07 06:49:09 -0200 | [diff] [blame] | 1035 | case SAA7134_BOARD_FLYDVBT_LR301: |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1036 | configure_tda827x_fe(dev, &tda827x_lifeview_config, "DVB-T Lifeview FlyDVBT LR301"); |
Giampiero Giancipoli | 3d8466e | 2006-02-07 06:49:09 -0200 | [diff] [blame] | 1037 | break; |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 1038 | case SAA7134_BOARD_FLYDVB_TRIO: |
Stephan Berberig | b331daa | 2006-12-20 09:37:05 -0300 | [diff] [blame] | 1039 | if(! use_frontend) { //terrestrial |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1040 | configure_tda827x_fe(dev, &lifeview_trio_config, NULL); |
Nico Sabbi | 1f683cd | 2006-11-15 22:06:56 -0300 | [diff] [blame] | 1041 | } else { //satellite |
| 1042 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); |
| 1043 | if (dev->dvb.frontend) { |
| 1044 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, |
| 1045 | &dev->i2c_adap, 0) == NULL) { |
| 1046 | printk("%s: Lifeview Trio, No tda826x found!\n", __FUNCTION__); |
| 1047 | } |
| 1048 | if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap, |
| 1049 | 0x08, 0, 0) == NULL) { |
| 1050 | printk("%s: Lifeview Trio, No ISL6421 found!\n", __FUNCTION__); |
| 1051 | } |
| 1052 | } |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1053 | } |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 1054 | break; |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 1055 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: |
Hartmut Hackmann | d95b894 | 2006-03-27 19:39:30 -0300 | [diff] [blame] | 1056 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1057 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 1058 | &ads_tech_duo_config, |
| 1059 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1060 | if (dev->dvb.frontend) { |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 1061 | dvb_attach(tda827x_attach,dev->dvb.frontend, |
| 1062 | ads_tech_duo_config.tuner_address, |
| 1063 | &dev->i2c_adap,&ads_duo_cfg); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1064 | if (dev->board == SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331) |
| 1065 | board_name = "DVB-T ADS DUO Cardbus PTV331"; |
| 1066 | else |
| 1067 | board_name = "DVB-T Lifeview FlyDVT Cardbus"; |
| 1068 | philips_tda1004x_set_board_name(dev->dvb.frontend, board_name); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1069 | } |
Hartmut Hackmann | d95b894 | 2006-03-27 19:39:30 -0300 | [diff] [blame] | 1070 | break; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1071 | case SAA7134_BOARD_TEVION_DVBT_220RF: |
| 1072 | configure_tda827x_fe(dev, &tevion_dvbt220rf_config, "DVB-T Tevion 220RF"); |
| 1073 | break; |
Hartmut Hackmann | 5eda227 | 2006-08-07 14:03:32 -0300 | [diff] [blame] | 1074 | case SAA7134_BOARD_MEDION_MD8800_QUADRO: |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1075 | configure_tda827x_fe(dev, &md8800_dvbt_config, "DVB-T Medion MD8800"); |
Hartmut Hackmann | 5eda227 | 2006-08-07 14:03:32 -0300 | [diff] [blame] | 1076 | break; |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 1077 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1078 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, |
| 1079 | &dev->i2c_adap); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 1080 | if (dev->dvb.frontend) { |
Michael Krufky | 4ad8eee5 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1081 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
| 1082 | NULL, &dvb_pll_tdhu2); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 1083 | } |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 1084 | break; |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 1085 | case SAA7134_BOARD_KWORLD_ATSC110: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1086 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, |
| 1087 | &dev->i2c_adap); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 1088 | if (dev->dvb.frontend) { |
Michael Krufky | 4ad8eee5 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1089 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
| 1090 | NULL, &dvb_pll_tuv1236d); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 1091 | } |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 1092 | break; |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 1093 | case SAA7134_BOARD_FLYDVBS_LR300: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1094 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, |
| 1095 | &dev->i2c_adap); |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 1096 | if (dev->dvb.frontend) { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1097 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, |
| 1098 | &dev->i2c_adap, 0) == NULL) { |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 1099 | printk("%s: No tda826x found!\n", __FUNCTION__); |
| 1100 | } |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1101 | if (dvb_attach(isl6421_attach, dev->dvb.frontend, |
| 1102 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 1103 | printk("%s: No ISL6421 found!\n", __FUNCTION__); |
| 1104 | } |
| 1105 | } |
| 1106 | break; |
Hartmut Hackmann | cf146ca | 2006-10-02 20:49:24 -0300 | [diff] [blame] | 1107 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: |
| 1108 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, |
| 1109 | &dev->i2c_adap); |
| 1110 | if (dev->dvb.frontend) { |
| 1111 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; |
| 1112 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
| 1113 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; |
| 1114 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; |
| 1115 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1116 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVBT Asus Europa 2 Hybrid"); |
Hartmut Hackmann | cf146ca | 2006-10-02 20:49:24 -0300 | [diff] [blame] | 1117 | } |
| 1118 | break; |
Hartmut Hackmann | cbb9452 | 2006-10-30 20:00:16 -0300 | [diff] [blame] | 1119 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: |
| 1120 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 1121 | &philips_europa_config, |
| 1122 | &dev->i2c_adap); |
| 1123 | if (dev->dvb.frontend) { |
| 1124 | dev->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; |
| 1125 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1126 | philips_tda1004x_set_board_name(dev->dvb.frontend, "DVBT Compro Videomate 200a"); |
Hartmut Hackmann | cbb9452 | 2006-10-30 20:00:16 -0300 | [diff] [blame] | 1127 | } |
| 1128 | break; |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 1129 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1130 | configure_tda827x_fe(dev, &cinergy_ht_config, "DVB-T Terratec Cinergy HT Cardbus"); |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 1131 | break; |
Michael Krufky | 9de271e | 2007-01-16 18:36:40 -0300 | [diff] [blame] | 1132 | case SAA7134_BOARD_CINERGY_HT_PCI: |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1133 | configure_tda827x_fe(dev, &cinergy_ht_pci_config, "DVB-T Terratec Cinergy HT PCI"); |
| 1134 | break; |
| 1135 | case SAA7134_BOARD_PHILIPS_TIGER_S: |
| 1136 | configure_tda827x_fe(dev, &philips_tiger_s_config, "DVB-T Philips Tiger S"); |
Michael Krufky | 9de271e | 2007-01-16 18:36:40 -0300 | [diff] [blame] | 1137 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1138 | default: |
| 1139 | printk("%s: Huh? unknown DVB card?\n",dev->name); |
| 1140 | break; |
| 1141 | } |
| 1142 | |
| 1143 | if (NULL == dev->dvb.frontend) { |
| 1144 | printk("%s: frontend initialization failed\n",dev->name); |
| 1145 | return -1; |
| 1146 | } |
| 1147 | |
| 1148 | /* register everything else */ |
Hartmut Hackmann | 1c4f76a | 2007-04-27 12:31:16 -0300 | [diff] [blame^] | 1149 | ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev); |
| 1150 | |
| 1151 | /* this sequence is necessary to make the tda1004x load its firmware |
| 1152 | * and to enter analog mode of hybrid boards |
| 1153 | */ |
| 1154 | if (!ret) { |
| 1155 | if (dev->dvb.frontend->ops.init) |
| 1156 | dev->dvb.frontend->ops.init(dev->dvb.frontend); |
| 1157 | if (dev->dvb.frontend->ops.sleep) |
| 1158 | dev->dvb.frontend->ops.sleep(dev->dvb.frontend); |
| 1159 | } |
| 1160 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1161 | } |
| 1162 | |
| 1163 | static int dvb_fini(struct saa7134_dev *dev) |
| 1164 | { |
| 1165 | static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; |
| 1166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1167 | switch (dev->board) { |
| 1168 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
| 1169 | /* otherwise we don't detect the tuner on next insmod */ |
| 1170 | saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&on); |
| 1171 | break; |
| 1172 | }; |
| 1173 | videobuf_dvb_unregister(&dev->dvb); |
| 1174 | return 0; |
| 1175 | } |
| 1176 | |
| 1177 | static struct saa7134_mpeg_ops dvb_ops = { |
| 1178 | .type = SAA7134_MPEG_DVB, |
| 1179 | .init = dvb_init, |
| 1180 | .fini = dvb_fini, |
| 1181 | }; |
| 1182 | |
| 1183 | static int __init dvb_register(void) |
| 1184 | { |
| 1185 | return saa7134_ts_register(&dvb_ops); |
| 1186 | } |
| 1187 | |
| 1188 | static void __exit dvb_unregister(void) |
| 1189 | { |
| 1190 | saa7134_ts_unregister(&dvb_ops); |
| 1191 | } |
| 1192 | |
| 1193 | module_init(dvb_register); |
| 1194 | module_exit(dvb_unregister); |
| 1195 | |
| 1196 | /* ------------------------------------------------------------------ */ |
| 1197 | /* |
| 1198 | * Local variables: |
| 1199 | * c-basic-offset: 8 |
| 1200 | * End: |
| 1201 | */ |