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" |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 36 | #include <dvb_frontend.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
Andrew de Quincey | 1f10c7a | 2006-08-08 09:10:09 -0300 | [diff] [blame] | 38 | #include "mt352.h" |
| 39 | #include "mt352_priv.h" /* FIXME */ |
| 40 | #include "tda1004x.h" |
| 41 | #include "nxt200x.h" |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 42 | #include "tuner-xc2028.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 44 | #include "tda10086.h" |
| 45 | #include "tda826x.h" |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 46 | #include "tda827x.h" |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 47 | #include "isl6421.h" |
Hartmut Hackmann | 4b1431c | 2008-04-22 14:42:09 -0300 | [diff] [blame] | 48 | #include "isl6405.h" |
Hartmut Hackmann | 6ab465a | 2008-04-22 14:42:11 -0300 | [diff] [blame] | 49 | #include "lnbp21.h" |
Michael Krufky | cb89cd3 | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 50 | #include "tuner-simple.h" |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 51 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
| 53 | MODULE_LICENSE("GPL"); |
| 54 | |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 55 | static unsigned int antenna_pwr; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | module_param(antenna_pwr, int, 0444); |
| 58 | MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); |
| 59 | |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 60 | static int use_frontend; |
Stephan Berberig | b331daa | 2006-12-20 09:37:05 -0300 | [diff] [blame] | 61 | module_param(use_frontend, int, 0644); |
| 62 | 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] | 63 | |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 64 | static int debug; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 65 | module_param(debug, int, 0644); |
| 66 | MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off)."); |
| 67 | |
Janne Grunau | 78e92006 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 68 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
| 69 | |
Trent Piepho | cf3c34c | 2007-03-07 18:19:48 -0300 | [diff] [blame] | 70 | #define dprintk(fmt, arg...) do { if (debug) \ |
| 71 | printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg); } while(0) |
| 72 | |
| 73 | /* Print a warning */ |
| 74 | #define wprintk(fmt, arg...) \ |
| 75 | printk(KERN_WARNING "%s/dvb: " fmt, dev->name, ## arg) |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 76 | |
| 77 | /* ------------------------------------------------------------------ |
| 78 | * mt352 based DVB-T cards |
| 79 | */ |
| 80 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) |
| 82 | { |
| 83 | u32 ok; |
| 84 | |
| 85 | if (!on) { |
| 86 | saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26)); |
| 87 | saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26)); |
| 88 | return 0; |
| 89 | } |
| 90 | |
| 91 | saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26)); |
| 92 | saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26)); |
| 93 | udelay(10); |
| 94 | |
| 95 | saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 28)); |
| 96 | saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28)); |
| 97 | udelay(10); |
| 98 | saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28)); |
| 99 | udelay(10); |
| 100 | ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27); |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 101 | dprintk("%s %s\n", __func__, ok ? "on" : "off"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
| 103 | if (!ok) |
| 104 | saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26)); |
| 105 | return ok; |
| 106 | } |
| 107 | |
| 108 | static int mt352_pinnacle_init(struct dvb_frontend* fe) |
| 109 | { |
| 110 | static u8 clock_config [] = { CLOCK_CTL, 0x3d, 0x28 }; |
| 111 | static u8 reset [] = { RESET, 0x80 }; |
| 112 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 113 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 }; |
| 114 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x31 }; |
| 115 | static u8 fsm_ctl_cfg[] = { 0x7b, 0x04 }; |
| 116 | static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x0f }; |
| 117 | static u8 scan_ctl_cfg [] = { SCAN_CTL, 0x0d }; |
| 118 | static u8 irq_cfg [] = { INTERRUPT_EN_0, 0x00, 0x00, 0x00, 0x00 }; |
| 119 | struct saa7134_dev *dev= fe->dvb->priv; |
| 120 | |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 121 | dprintk("%s called\n", __func__); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | |
| 123 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 124 | udelay(200); |
| 125 | mt352_write(fe, reset, sizeof(reset)); |
| 126 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 127 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 128 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 129 | mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg)); |
| 130 | |
| 131 | mt352_write(fe, fsm_ctl_cfg, sizeof(fsm_ctl_cfg)); |
| 132 | mt352_write(fe, scan_ctl_cfg, sizeof(scan_ctl_cfg)); |
| 133 | mt352_write(fe, irq_cfg, sizeof(irq_cfg)); |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 134 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | return 0; |
| 136 | } |
| 137 | |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 138 | static int mt352_aver777_init(struct dvb_frontend* fe) |
| 139 | { |
| 140 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d }; |
| 141 | static u8 reset [] = { RESET, 0x80 }; |
| 142 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 143 | static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 }; |
| 144 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 }; |
| 145 | |
| 146 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 147 | udelay(200); |
| 148 | mt352_write(fe, reset, sizeof(reset)); |
| 149 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 150 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 151 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
| 152 | |
| 153 | return 0; |
| 154 | } |
| 155 | |
Tim Farrington | 6e501a3 | 2008-06-15 13:33:42 -0300 | [diff] [blame] | 156 | static int mt352_avermedia_xc3028_init(struct dvb_frontend *fe) |
Mauro Carvalho Chehab | 95a2fdb | 2008-03-28 17:52:44 -0300 | [diff] [blame] | 157 | { |
Tim Farrington | 6e501a3 | 2008-06-15 13:33:42 -0300 | [diff] [blame] | 158 | static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d }; |
| 159 | static u8 reset [] = { RESET, 0x80 }; |
| 160 | static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 }; |
| 161 | static u8 agc_cfg [] = { AGC_TARGET, 0xe }; |
Mauro Carvalho Chehab | 95a2fdb | 2008-03-28 17:52:44 -0300 | [diff] [blame] | 162 | static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 }; |
| 163 | |
| 164 | mt352_write(fe, clock_config, sizeof(clock_config)); |
| 165 | udelay(200); |
| 166 | mt352_write(fe, reset, sizeof(reset)); |
| 167 | mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg)); |
| 168 | mt352_write(fe, agc_cfg, sizeof(agc_cfg)); |
| 169 | mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg)); |
Mauro Carvalho Chehab | 95a2fdb | 2008-03-28 17:52:44 -0300 | [diff] [blame] | 170 | return 0; |
| 171 | } |
| 172 | |
Andrew de Quincey | 0463f12 | 2006-05-16 17:22:02 -0300 | [diff] [blame] | 173 | static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, |
| 174 | struct dvb_frontend_parameters* params) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | { |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 176 | u8 off[] = { 0x00, 0xf1}; |
| 177 | u8 on[] = { 0x00, 0x71}; |
| 178 | struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)}; |
| 179 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | struct saa7134_dev *dev = fe->dvb->priv; |
| 181 | struct v4l2_frequency f; |
| 182 | |
| 183 | /* set frequency (mt2050) */ |
| 184 | f.tuner = 0; |
| 185 | f.type = V4L2_TUNER_DIGITAL_TV; |
| 186 | f.frequency = params->frequency / 1000 * 16 / 1000; |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 187 | if (fe->ops.i2c_gate_ctrl) |
| 188 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 189 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 191 | msg.buf = on; |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 192 | if (fe->ops.i2c_gate_ctrl) |
| 193 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | df8cf70 | 2006-03-03 12:09:26 -0300 | [diff] [blame] | 194 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | |
| 196 | pinnacle_antenna_pwr(dev, antenna_pwr); |
| 197 | |
| 198 | /* mt352 setup */ |
Andrew de Quincey | 0463f12 | 2006-05-16 17:22:02 -0300 | [diff] [blame] | 199 | return mt352_pinnacle_init(fe); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | static struct mt352_config pinnacle_300i = { |
| 203 | .demod_address = 0x3c >> 1, |
| 204 | .adc_clock = 20333, |
| 205 | .if2 = 36150, |
| 206 | .no_tuner = 1, |
| 207 | .demod_init = mt352_pinnacle_init, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | }; |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 209 | |
| 210 | static struct mt352_config avermedia_777 = { |
| 211 | .demod_address = 0xf, |
| 212 | .demod_init = mt352_aver777_init, |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 213 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | |
Tim Farrington | 6e501a3 | 2008-06-15 13:33:42 -0300 | [diff] [blame] | 215 | static struct mt352_config avermedia_xc3028_mt352_dev = { |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 216 | .demod_address = (0x1e >> 1), |
| 217 | .no_tuner = 1, |
Tim Farrington | 6e501a3 | 2008-06-15 13:33:42 -0300 | [diff] [blame] | 218 | .demod_init = mt352_avermedia_xc3028_init, |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 219 | }; |
| 220 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 221 | /* ================================================================== |
| 222 | * tda1004x based DVB-T cards, helper functions |
| 223 | */ |
| 224 | |
| 225 | static int philips_tda1004x_request_firmware(struct dvb_frontend *fe, |
| 226 | const struct firmware **fw, char *name) |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 227 | { |
| 228 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 229 | return request_firmware(fw, name, &dev->pci->dev); |
| 230 | } |
| 231 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 232 | /* ------------------------------------------------------------------ |
| 233 | * these tuners are tu1216, td1316(a) |
| 234 | */ |
| 235 | |
| 236 | static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
| 237 | { |
| 238 | struct saa7134_dev *dev = fe->dvb->priv; |
| 239 | struct tda1004x_state *state = fe->demodulator_priv; |
| 240 | u8 addr = state->config->tuner_address; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 241 | u8 tuner_buf[4]; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 242 | 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] | 243 | sizeof(tuner_buf) }; |
| 244 | int tuner_frequency = 0; |
| 245 | u8 band, cp, filter; |
| 246 | |
| 247 | /* determine charge pump */ |
| 248 | tuner_frequency = params->frequency + 36166000; |
| 249 | if (tuner_frequency < 87000000) |
| 250 | return -EINVAL; |
| 251 | else if (tuner_frequency < 130000000) |
| 252 | cp = 3; |
| 253 | else if (tuner_frequency < 160000000) |
| 254 | cp = 5; |
| 255 | else if (tuner_frequency < 200000000) |
| 256 | cp = 6; |
| 257 | else if (tuner_frequency < 290000000) |
| 258 | cp = 3; |
| 259 | else if (tuner_frequency < 420000000) |
| 260 | cp = 5; |
| 261 | else if (tuner_frequency < 480000000) |
| 262 | cp = 6; |
| 263 | else if (tuner_frequency < 620000000) |
| 264 | cp = 3; |
| 265 | else if (tuner_frequency < 830000000) |
| 266 | cp = 5; |
| 267 | else if (tuner_frequency < 895000000) |
| 268 | cp = 7; |
| 269 | else |
| 270 | return -EINVAL; |
| 271 | |
| 272 | /* determine band */ |
| 273 | if (params->frequency < 49000000) |
| 274 | return -EINVAL; |
| 275 | else if (params->frequency < 161000000) |
| 276 | band = 1; |
| 277 | else if (params->frequency < 444000000) |
| 278 | band = 2; |
| 279 | else if (params->frequency < 861000000) |
| 280 | band = 4; |
| 281 | else |
| 282 | return -EINVAL; |
| 283 | |
| 284 | /* setup PLL filter */ |
| 285 | switch (params->u.ofdm.bandwidth) { |
| 286 | case BANDWIDTH_6_MHZ: |
| 287 | filter = 0; |
| 288 | break; |
| 289 | |
| 290 | case BANDWIDTH_7_MHZ: |
| 291 | filter = 0; |
| 292 | break; |
| 293 | |
| 294 | case BANDWIDTH_8_MHZ: |
| 295 | filter = 1; |
| 296 | break; |
| 297 | |
| 298 | default: |
| 299 | return -EINVAL; |
| 300 | } |
| 301 | |
| 302 | /* calculate divisor |
| 303 | * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6) |
| 304 | */ |
| 305 | tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000; |
| 306 | |
| 307 | /* setup tuner buffer */ |
| 308 | tuner_buf[0] = (tuner_frequency >> 8) & 0x7f; |
| 309 | tuner_buf[1] = tuner_frequency & 0xff; |
| 310 | tuner_buf[2] = 0xca; |
| 311 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; |
| 312 | |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 313 | if (fe->ops.i2c_gate_ctrl) |
| 314 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 315 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) { |
Trent Piepho | cf3c34c | 2007-03-07 18:19:48 -0300 | [diff] [blame] | 316 | wprintk("could not write to tuner at addr: 0x%02x\n", |
| 317 | addr << 1); |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 318 | return -EIO; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 319 | } |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 320 | msleep(1); |
| 321 | return 0; |
| 322 | } |
| 323 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 324 | static int philips_tu1216_init(struct dvb_frontend *fe) |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 325 | { |
| 326 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 327 | struct tda1004x_state *state = fe->demodulator_priv; |
| 328 | u8 addr = state->config->tuner_address; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 329 | static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab }; |
| 330 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; |
| 331 | |
| 332 | /* setup PLL configuration */ |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 333 | if (fe->ops.i2c_gate_ctrl) |
| 334 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 335 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) |
| 336 | return -EIO; |
| 337 | msleep(1); |
| 338 | |
| 339 | return 0; |
| 340 | } |
| 341 | |
| 342 | /* ------------------------------------------------------------------ */ |
| 343 | |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 344 | static struct tda1004x_config philips_tu1216_60_config = { |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 345 | .demod_address = 0x8, |
| 346 | .invert = 1, |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 347 | .invert_oclk = 0, |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 348 | .xtal_freq = TDA10046_XTAL_4M, |
| 349 | .agc_config = TDA10046_AGC_DEFAULT, |
| 350 | .if_freq = TDA10046_FREQ_3617, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 351 | .tuner_address = 0x60, |
| 352 | .request_firmware = philips_tda1004x_request_firmware |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | }; |
| 354 | |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 355 | static struct tda1004x_config philips_tu1216_61_config = { |
| 356 | |
| 357 | .demod_address = 0x8, |
| 358 | .invert = 1, |
| 359 | .invert_oclk = 0, |
| 360 | .xtal_freq = TDA10046_XTAL_4M, |
| 361 | .agc_config = TDA10046_AGC_DEFAULT, |
| 362 | .if_freq = TDA10046_FREQ_3617, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 363 | .tuner_address = 0x61, |
| 364 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 365 | }; |
| 366 | |
| 367 | /* ------------------------------------------------------------------ */ |
| 368 | |
Hartmut Hackmann | cbb9452 | 2006-10-30 20:00:16 -0300 | [diff] [blame] | 369 | static int philips_td1316_tuner_init(struct dvb_frontend *fe) |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 370 | { |
| 371 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 372 | struct tda1004x_state *state = fe->demodulator_priv; |
| 373 | u8 addr = state->config->tuner_address; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 374 | static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 375 | 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] | 376 | |
| 377 | /* setup PLL configuration */ |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 378 | if (fe->ops.i2c_gate_ctrl) |
| 379 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 380 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) |
| 381 | return -EIO; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 382 | return 0; |
| 383 | } |
| 384 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 385 | 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] | 386 | { |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 387 | return philips_tda6651_pll_set(fe, params); |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 388 | } |
| 389 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 390 | static int philips_td1316_tuner_sleep(struct dvb_frontend *fe) |
| 391 | { |
| 392 | struct saa7134_dev *dev = fe->dvb->priv; |
| 393 | struct tda1004x_state *state = fe->demodulator_priv; |
| 394 | u8 addr = state->config->tuner_address; |
| 395 | static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 }; |
| 396 | struct i2c_msg analog_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
| 397 | |
| 398 | /* switch the tuner to analog mode */ |
| 399 | if (fe->ops.i2c_gate_ctrl) |
| 400 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 401 | if (i2c_transfer(&dev->i2c_adap, &analog_msg, 1) != 1) |
| 402 | return -EIO; |
| 403 | return 0; |
| 404 | } |
| 405 | |
| 406 | /* ------------------------------------------------------------------ */ |
| 407 | |
Hartmut Hackmann | cbb9452 | 2006-10-30 20:00:16 -0300 | [diff] [blame] | 408 | static int philips_europa_tuner_init(struct dvb_frontend *fe) |
| 409 | { |
| 410 | struct saa7134_dev *dev = fe->dvb->priv; |
| 411 | static u8 msg[] = { 0x00, 0x40}; |
| 412 | struct i2c_msg init_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
| 413 | |
| 414 | |
| 415 | if (philips_td1316_tuner_init(fe)) |
| 416 | return -EIO; |
| 417 | msleep(1); |
| 418 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) |
| 419 | return -EIO; |
| 420 | |
| 421 | return 0; |
| 422 | } |
| 423 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 424 | static int philips_europa_tuner_sleep(struct dvb_frontend *fe) |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 425 | { |
| 426 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 427 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 428 | static u8 msg[] = { 0x00, 0x14 }; |
| 429 | struct i2c_msg analog_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
| 430 | |
| 431 | if (philips_td1316_tuner_sleep(fe)) |
| 432 | return -EIO; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 433 | |
| 434 | /* switch the board to analog mode */ |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 435 | if (fe->ops.i2c_gate_ctrl) |
| 436 | fe->ops.i2c_gate_ctrl(fe, 1); |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 437 | i2c_transfer(&dev->i2c_adap, &analog_msg, 1); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 438 | return 0; |
| 439 | } |
| 440 | |
| 441 | static int philips_europa_demod_sleep(struct dvb_frontend *fe) |
| 442 | { |
| 443 | struct saa7134_dev *dev = fe->dvb->priv; |
| 444 | |
| 445 | if (dev->original_demod_sleep) |
| 446 | dev->original_demod_sleep(fe); |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 447 | fe->ops.i2c_gate_ctrl(fe, 1); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 448 | return 0; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | static struct tda1004x_config philips_europa_config = { |
| 452 | |
| 453 | .demod_address = 0x8, |
| 454 | .invert = 0, |
| 455 | .invert_oclk = 0, |
| 456 | .xtal_freq = TDA10046_XTAL_4M, |
| 457 | .agc_config = TDA10046_AGC_IFO_AUTO_POS, |
| 458 | .if_freq = TDA10046_FREQ_052, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 459 | .tuner_address = 0x61, |
| 460 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 461 | }; |
| 462 | |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 463 | static struct tda1004x_config medion_cardbus = { |
| 464 | .demod_address = 0x08, |
| 465 | .invert = 1, |
| 466 | .invert_oclk = 0, |
| 467 | .xtal_freq = TDA10046_XTAL_16M, |
| 468 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, |
| 469 | .if_freq = TDA10046_FREQ_3613, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 470 | .tuner_address = 0x61, |
| 471 | .request_firmware = philips_tda1004x_request_firmware |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 472 | }; |
| 473 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 474 | /* ------------------------------------------------------------------ |
| 475 | * tda 1004x based cards with philips silicon tuner |
| 476 | */ |
| 477 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 478 | static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable) |
| 479 | { |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 480 | struct tda1004x_state *state = fe->demodulator_priv; |
| 481 | |
| 482 | u8 addr = state->config->i2c_gate; |
| 483 | static u8 tda8290_close[] = { 0x21, 0xc0}; |
| 484 | static u8 tda8290_open[] = { 0x21, 0x80}; |
| 485 | struct i2c_msg tda8290_msg = {.addr = addr,.flags = 0, .len = 2}; |
| 486 | if (enable) { |
| 487 | tda8290_msg.buf = tda8290_close; |
| 488 | } else { |
| 489 | tda8290_msg.buf = tda8290_open; |
| 490 | } |
Hartmut Hackmann | 06be303 | 2007-04-27 12:31:15 -0300 | [diff] [blame] | 491 | if (i2c_transfer(state->i2c, &tda8290_msg, 1) != 1) { |
Trent Piepho | cf3c34c | 2007-03-07 18:19:48 -0300 | [diff] [blame] | 492 | struct saa7134_dev *dev = fe->dvb->priv; |
| 493 | wprintk("could not access tda8290 I2C gate\n"); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 494 | return -EIO; |
| 495 | } |
| 496 | msleep(20); |
| 497 | return 0; |
| 498 | } |
| 499 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 500 | static int philips_tda827x_tuner_init(struct dvb_frontend *fe) |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 501 | { |
| 502 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 503 | struct tda1004x_state *state = fe->demodulator_priv; |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 504 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 505 | switch (state->config->antenna_switch) { |
| 506 | case 0: break; |
| 507 | case 1: dprintk("setting GPIO21 to 0 (TV antenna?)\n"); |
| 508 | saa7134_set_gpio(dev, 21, 0); |
| 509 | break; |
| 510 | case 2: dprintk("setting GPIO21 to 1 (Radio antenna?)\n"); |
| 511 | saa7134_set_gpio(dev, 21, 1); |
| 512 | break; |
| 513 | } |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 514 | return 0; |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 515 | } |
| 516 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 517 | static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe) |
| 518 | { |
| 519 | struct saa7134_dev *dev = fe->dvb->priv; |
| 520 | struct tda1004x_state *state = fe->demodulator_priv; |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 521 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 522 | switch (state->config->antenna_switch) { |
| 523 | case 0: break; |
| 524 | case 1: dprintk("setting GPIO21 to 1 (Radio antenna?)\n"); |
| 525 | saa7134_set_gpio(dev, 21, 1); |
| 526 | break; |
| 527 | case 2: dprintk("setting GPIO21 to 0 (TV antenna?)\n"); |
| 528 | saa7134_set_gpio(dev, 21, 0); |
| 529 | break; |
| 530 | } |
| 531 | return 0; |
| 532 | } |
| 533 | |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 534 | static int configure_tda827x_fe(struct saa7134_dev *dev, |
| 535 | struct tda1004x_config *cdec_conf, |
| 536 | struct tda827x_config *tuner_conf) |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 537 | { |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 538 | dev->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 539 | if (dev->dvb.frontend) { |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 540 | if (cdec_conf->i2c_gate) |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 541 | dev->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl; |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 542 | if (dvb_attach(tda827x_attach, dev->dvb.frontend, |
| 543 | cdec_conf->tuner_address, |
| 544 | &dev->i2c_adap, tuner_conf)) |
| 545 | return 0; |
| 546 | |
| 547 | wprintk("no tda827x tuner found at addr: %02x\n", |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 548 | cdec_conf->tuner_address); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 549 | } |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 550 | return -EINVAL; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 551 | } |
| 552 | |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 553 | /* ------------------------------------------------------------------ */ |
Edgar Simo | 261f508 | 2007-08-20 14:06:00 -0300 | [diff] [blame] | 554 | |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 555 | static struct tda827x_config tda827x_cfg_0 = { |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 556 | .init = philips_tda827x_tuner_init, |
| 557 | .sleep = philips_tda827x_tuner_sleep, |
| 558 | .config = 0, |
| 559 | .switch_addr = 0 |
| 560 | }; |
| 561 | |
| 562 | static struct tda827x_config tda827x_cfg_1 = { |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 563 | .init = philips_tda827x_tuner_init, |
| 564 | .sleep = philips_tda827x_tuner_sleep, |
| 565 | .config = 1, |
| 566 | .switch_addr = 0x4b |
| 567 | }; |
| 568 | |
| 569 | static struct tda827x_config tda827x_cfg_2 = { |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 570 | .init = philips_tda827x_tuner_init, |
| 571 | .sleep = philips_tda827x_tuner_sleep, |
| 572 | .config = 2, |
| 573 | .switch_addr = 0x4b |
| 574 | }; |
| 575 | |
| 576 | static struct tda827x_config tda827x_cfg_2_sw42 = { |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 577 | .init = philips_tda827x_tuner_init, |
| 578 | .sleep = philips_tda827x_tuner_sleep, |
| 579 | .config = 2, |
| 580 | .switch_addr = 0x42 |
| 581 | }; |
| 582 | |
| 583 | /* ------------------------------------------------------------------ */ |
| 584 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 585 | static struct tda1004x_config tda827x_lifeview_config = { |
| 586 | .demod_address = 0x08, |
| 587 | .invert = 1, |
| 588 | .invert_oclk = 0, |
| 589 | .xtal_freq = TDA10046_XTAL_16M, |
| 590 | .agc_config = TDA10046_AGC_TDA827X, |
| 591 | .gpio_config = TDA10046_GP11_I, |
| 592 | .if_freq = TDA10046_FREQ_045, |
| 593 | .tuner_address = 0x60, |
| 594 | .request_firmware = philips_tda1004x_request_firmware |
| 595 | }; |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 596 | |
| 597 | static struct tda1004x_config philips_tiger_config = { |
| 598 | .demod_address = 0x08, |
| 599 | .invert = 1, |
| 600 | .invert_oclk = 0, |
| 601 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 602 | .agc_config = TDA10046_AGC_TDA827X, |
| 603 | .gpio_config = TDA10046_GP11_I, |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 604 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 605 | .i2c_gate = 0x4b, |
| 606 | .tuner_address = 0x61, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 607 | .antenna_switch= 1, |
| 608 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 609 | }; |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 610 | |
| 611 | static struct tda1004x_config cinergy_ht_config = { |
| 612 | .demod_address = 0x08, |
| 613 | .invert = 1, |
| 614 | .invert_oclk = 0, |
| 615 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 616 | .agc_config = TDA10046_AGC_TDA827X, |
| 617 | .gpio_config = TDA10046_GP01_I, |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 618 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 619 | .i2c_gate = 0x4b, |
| 620 | .tuner_address = 0x61, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 621 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 622 | }; |
| 623 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 624 | static struct tda1004x_config cinergy_ht_pci_config = { |
| 625 | .demod_address = 0x08, |
| 626 | .invert = 1, |
| 627 | .invert_oclk = 0, |
| 628 | .xtal_freq = TDA10046_XTAL_16M, |
| 629 | .agc_config = TDA10046_AGC_TDA827X, |
| 630 | .gpio_config = TDA10046_GP01_I, |
| 631 | .if_freq = TDA10046_FREQ_045, |
| 632 | .i2c_gate = 0x4b, |
| 633 | .tuner_address = 0x60, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 634 | .request_firmware = philips_tda1004x_request_firmware |
| 635 | }; |
| 636 | |
| 637 | static struct tda1004x_config philips_tiger_s_config = { |
| 638 | .demod_address = 0x08, |
| 639 | .invert = 1, |
| 640 | .invert_oclk = 0, |
| 641 | .xtal_freq = TDA10046_XTAL_16M, |
| 642 | .agc_config = TDA10046_AGC_TDA827X, |
| 643 | .gpio_config = TDA10046_GP01_I, |
| 644 | .if_freq = TDA10046_FREQ_045, |
| 645 | .i2c_gate = 0x4b, |
| 646 | .tuner_address = 0x61, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 647 | .antenna_switch= 1, |
| 648 | .request_firmware = philips_tda1004x_request_firmware |
| 649 | }; |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 650 | |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 651 | static struct tda1004x_config pinnacle_pctv_310i_config = { |
| 652 | .demod_address = 0x08, |
| 653 | .invert = 1, |
| 654 | .invert_oclk = 0, |
| 655 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 656 | .agc_config = TDA10046_AGC_TDA827X, |
| 657 | .gpio_config = TDA10046_GP11_I, |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 658 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 659 | .i2c_gate = 0x4b, |
| 660 | .tuner_address = 0x61, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 661 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 662 | }; |
| 663 | |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 664 | static struct tda1004x_config hauppauge_hvr_1110_config = { |
| 665 | .demod_address = 0x08, |
| 666 | .invert = 1, |
| 667 | .invert_oclk = 0, |
| 668 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 669 | .agc_config = TDA10046_AGC_TDA827X, |
| 670 | .gpio_config = TDA10046_GP11_I, |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 671 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 672 | .i2c_gate = 0x4b, |
| 673 | .tuner_address = 0x61, |
| 674 | .request_firmware = philips_tda1004x_request_firmware |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 675 | }; |
| 676 | |
Hartmut Hackmann | 8364681 | 2006-10-12 20:38:51 -0300 | [diff] [blame] | 677 | static struct tda1004x_config asus_p7131_dual_config = { |
| 678 | .demod_address = 0x08, |
| 679 | .invert = 1, |
| 680 | .invert_oclk = 0, |
| 681 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 682 | .agc_config = TDA10046_AGC_TDA827X, |
| 683 | .gpio_config = TDA10046_GP11_I, |
Hartmut Hackmann | 8364681 | 2006-10-12 20:38:51 -0300 | [diff] [blame] | 684 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 685 | .i2c_gate = 0x4b, |
| 686 | .tuner_address = 0x61, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 687 | .antenna_switch= 2, |
| 688 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | 8364681 | 2006-10-12 20:38:51 -0300 | [diff] [blame] | 689 | }; |
| 690 | |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 691 | static struct tda1004x_config lifeview_trio_config = { |
| 692 | .demod_address = 0x09, |
| 693 | .invert = 1, |
| 694 | .invert_oclk = 0, |
| 695 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 696 | .agc_config = TDA10046_AGC_TDA827X, |
| 697 | .gpio_config = TDA10046_GP00_I, |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 698 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 699 | .tuner_address = 0x60, |
| 700 | .request_firmware = philips_tda1004x_request_firmware |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 701 | }; |
| 702 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 703 | static struct tda1004x_config tevion_dvbt220rf_config = { |
| 704 | .demod_address = 0x08, |
| 705 | .invert = 1, |
| 706 | .invert_oclk = 0, |
| 707 | .xtal_freq = TDA10046_XTAL_16M, |
| 708 | .agc_config = TDA10046_AGC_TDA827X, |
| 709 | .gpio_config = TDA10046_GP11_I, |
| 710 | .if_freq = TDA10046_FREQ_045, |
| 711 | .tuner_address = 0x60, |
| 712 | .request_firmware = philips_tda1004x_request_firmware |
| 713 | }; |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 714 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 715 | static struct tda1004x_config md8800_dvbt_config = { |
| 716 | .demod_address = 0x08, |
| 717 | .invert = 1, |
| 718 | .invert_oclk = 0, |
| 719 | .xtal_freq = TDA10046_XTAL_16M, |
| 720 | .agc_config = TDA10046_AGC_TDA827X, |
| 721 | .gpio_config = TDA10046_GP01_I, |
| 722 | .if_freq = TDA10046_FREQ_045, |
| 723 | .i2c_gate = 0x4b, |
| 724 | .tuner_address = 0x60, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 725 | .request_firmware = philips_tda1004x_request_firmware |
| 726 | }; |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 727 | |
Hartmut Hackmann | e06cea4 | 2007-03-13 20:58:29 -0300 | [diff] [blame] | 728 | static struct tda1004x_config asus_p7131_4871_config = { |
| 729 | .demod_address = 0x08, |
| 730 | .invert = 1, |
| 731 | .invert_oclk = 0, |
| 732 | .xtal_freq = TDA10046_XTAL_16M, |
| 733 | .agc_config = TDA10046_AGC_TDA827X, |
| 734 | .gpio_config = TDA10046_GP01_I, |
| 735 | .if_freq = TDA10046_FREQ_045, |
| 736 | .i2c_gate = 0x4b, |
| 737 | .tuner_address = 0x61, |
Hartmut Hackmann | e06cea4 | 2007-03-13 20:58:29 -0300 | [diff] [blame] | 738 | .antenna_switch= 2, |
| 739 | .request_firmware = philips_tda1004x_request_firmware |
| 740 | }; |
| 741 | |
Hartmut Hackmann | f3eec0c0 | 2007-03-14 20:33:55 -0300 | [diff] [blame] | 742 | static struct tda1004x_config asus_p7131_hybrid_lna_config = { |
Hartmut Hackmann | e06cea4 | 2007-03-13 20:58:29 -0300 | [diff] [blame] | 743 | .demod_address = 0x08, |
| 744 | .invert = 1, |
| 745 | .invert_oclk = 0, |
| 746 | .xtal_freq = TDA10046_XTAL_16M, |
| 747 | .agc_config = TDA10046_AGC_TDA827X, |
| 748 | .gpio_config = TDA10046_GP11_I, |
| 749 | .if_freq = TDA10046_FREQ_045, |
| 750 | .i2c_gate = 0x4b, |
| 751 | .tuner_address = 0x61, |
Hartmut Hackmann | e06cea4 | 2007-03-13 20:58:29 -0300 | [diff] [blame] | 752 | .antenna_switch= 2, |
| 753 | .request_firmware = philips_tda1004x_request_firmware |
| 754 | }; |
Edgar Simo | 261f508 | 2007-08-20 14:06:00 -0300 | [diff] [blame] | 755 | |
Simon Farnsworth | b39423a | 2007-05-01 10:01:20 -0300 | [diff] [blame] | 756 | static struct tda1004x_config kworld_dvb_t_210_config = { |
| 757 | .demod_address = 0x08, |
| 758 | .invert = 1, |
| 759 | .invert_oclk = 0, |
| 760 | .xtal_freq = TDA10046_XTAL_16M, |
| 761 | .agc_config = TDA10046_AGC_TDA827X, |
| 762 | .gpio_config = TDA10046_GP11_I, |
| 763 | .if_freq = TDA10046_FREQ_045, |
| 764 | .i2c_gate = 0x4b, |
| 765 | .tuner_address = 0x61, |
Simon Farnsworth | b39423a | 2007-05-01 10:01:20 -0300 | [diff] [blame] | 766 | .antenna_switch= 1, |
| 767 | .request_firmware = philips_tda1004x_request_firmware |
| 768 | }; |
Edgar Simo | 261f508 | 2007-08-20 14:06:00 -0300 | [diff] [blame] | 769 | |
Edgar Simo | d90d9f5 | 2007-08-20 14:14:50 -0300 | [diff] [blame] | 770 | static struct tda1004x_config avermedia_super_007_config = { |
| 771 | .demod_address = 0x08, |
| 772 | .invert = 1, |
| 773 | .invert_oclk = 0, |
| 774 | .xtal_freq = TDA10046_XTAL_16M, |
| 775 | .agc_config = TDA10046_AGC_TDA827X, |
| 776 | .gpio_config = TDA10046_GP01_I, |
| 777 | .if_freq = TDA10046_FREQ_045, |
| 778 | .i2c_gate = 0x4b, |
| 779 | .tuner_address = 0x60, |
Edgar Simo | d90d9f5 | 2007-08-20 14:14:50 -0300 | [diff] [blame] | 780 | .antenna_switch= 1, |
| 781 | .request_firmware = philips_tda1004x_request_firmware |
| 782 | }; |
| 783 | |
Hermann Pitton | 4ba2437 | 2008-01-20 19:27:51 -0300 | [diff] [blame] | 784 | static struct tda1004x_config twinhan_dtv_dvb_3056_config = { |
| 785 | .demod_address = 0x08, |
| 786 | .invert = 1, |
| 787 | .invert_oclk = 0, |
| 788 | .xtal_freq = TDA10046_XTAL_16M, |
| 789 | .agc_config = TDA10046_AGC_TDA827X, |
| 790 | .gpio_config = TDA10046_GP01_I, |
| 791 | .if_freq = TDA10046_FREQ_045, |
| 792 | .i2c_gate = 0x42, |
| 793 | .tuner_address = 0x61, |
Hermann Pitton | 4ba2437 | 2008-01-20 19:27:51 -0300 | [diff] [blame] | 794 | .antenna_switch = 1, |
| 795 | .request_firmware = philips_tda1004x_request_firmware |
| 796 | }; |
| 797 | |
hermann pitton | 301e9d6 | 2008-09-14 17:49:14 -0300 | [diff] [blame] | 798 | static struct tda1004x_config asus_tiger_3in1_config = { |
| 799 | .demod_address = 0x0b, |
| 800 | .invert = 1, |
| 801 | .invert_oclk = 0, |
| 802 | .xtal_freq = TDA10046_XTAL_16M, |
| 803 | .agc_config = TDA10046_AGC_TDA827X, |
| 804 | .gpio_config = TDA10046_GP11_I, |
| 805 | .if_freq = TDA10046_FREQ_045, |
| 806 | .i2c_gate = 0x4b, |
| 807 | .tuner_address = 0x61, |
| 808 | .antenna_switch = 1, |
| 809 | .request_firmware = philips_tda1004x_request_firmware |
| 810 | }; |
| 811 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 812 | /* ------------------------------------------------------------------ |
| 813 | * special case: this card uses saa713x GPIO22 for the mode switch |
| 814 | */ |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 815 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 816 | static int ads_duo_tuner_init(struct dvb_frontend *fe) |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 817 | { |
| 818 | struct saa7134_dev *dev = fe->dvb->priv; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 819 | philips_tda827x_tuner_init(fe); |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 820 | /* route TDA8275a AGC input to the channel decoder */ |
Hartmut Hackmann | 06be303 | 2007-04-27 12:31:15 -0300 | [diff] [blame] | 821 | saa7134_set_gpio(dev, 22, 1); |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 822 | return 0; |
| 823 | } |
| 824 | |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 825 | static int ads_duo_tuner_sleep(struct dvb_frontend *fe) |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 826 | { |
| 827 | struct saa7134_dev *dev = fe->dvb->priv; |
| 828 | /* route TDA8275a AGC input to the analog IF chip*/ |
Hartmut Hackmann | 06be303 | 2007-04-27 12:31:15 -0300 | [diff] [blame] | 829 | saa7134_set_gpio(dev, 22, 0); |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 830 | philips_tda827x_tuner_sleep(fe); |
Andrew de Quincey | a79ddae | 2006-04-18 17:47:11 -0300 | [diff] [blame] | 831 | return 0; |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 832 | } |
| 833 | |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 834 | static struct tda827x_config ads_duo_cfg = { |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 835 | .init = ads_duo_tuner_init, |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 836 | .sleep = ads_duo_tuner_sleep, |
| 837 | .config = 0 |
Michael Krufky | 8ce47da | 2007-04-27 12:31:14 -0300 | [diff] [blame] | 838 | }; |
| 839 | |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 840 | static struct tda1004x_config ads_tech_duo_config = { |
| 841 | .demod_address = 0x08, |
| 842 | .invert = 1, |
| 843 | .invert_oclk = 0, |
| 844 | .xtal_freq = TDA10046_XTAL_16M, |
Hartmut Hackmann | 1bb0e86 | 2007-04-27 12:31:10 -0300 | [diff] [blame] | 845 | .agc_config = TDA10046_AGC_TDA827X, |
| 846 | .gpio_config = TDA10046_GP00_I, |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 847 | .if_freq = TDA10046_FREQ_045, |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 848 | .tuner_address = 0x61, |
| 849 | .request_firmware = philips_tda1004x_request_firmware |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 850 | }; |
| 851 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 852 | /* ================================================================== |
| 853 | * tda10086 based DVB-S cards, helper functions |
| 854 | */ |
Hartmut Hackmann | 5eda227 | 2006-08-07 14:03:32 -0300 | [diff] [blame] | 855 | |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 856 | static struct tda10086_config flydvbs = { |
| 857 | .demod_address = 0x0e, |
| 858 | .invert = 0, |
Hartmut Hackmann | ea75baf | 2008-02-09 23:54:24 -0300 | [diff] [blame] | 859 | .diseqc_tone = 0, |
Hartmut Hackmann | 9a1b04e | 2008-04-09 23:07:11 -0300 | [diff] [blame] | 860 | .xtal_freq = TDA10086_XTAL_16M, |
| 861 | }; |
| 862 | |
| 863 | static struct tda10086_config sd1878_4m = { |
| 864 | .demod_address = 0x0e, |
| 865 | .invert = 0, |
| 866 | .diseqc_tone = 0, |
| 867 | .xtal_freq = TDA10086_XTAL_4M, |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 868 | }; |
| 869 | |
Hartmut Hackmann | 1b1cee3 | 2008-04-22 14:42:12 -0300 | [diff] [blame] | 870 | /* ------------------------------------------------------------------ |
| 871 | * special case: lnb supply is connected to the gated i2c |
| 872 | */ |
| 873 | |
| 874 | static int md8800_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
| 875 | { |
| 876 | int res = -EIO; |
| 877 | struct saa7134_dev *dev = fe->dvb->priv; |
| 878 | if (fe->ops.i2c_gate_ctrl) { |
| 879 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 880 | if (dev->original_set_voltage) |
| 881 | res = dev->original_set_voltage(fe, voltage); |
| 882 | fe->ops.i2c_gate_ctrl(fe, 0); |
| 883 | } |
| 884 | return res; |
| 885 | }; |
| 886 | |
| 887 | static int md8800_set_high_voltage(struct dvb_frontend *fe, long arg) |
| 888 | { |
| 889 | int res = -EIO; |
| 890 | struct saa7134_dev *dev = fe->dvb->priv; |
| 891 | if (fe->ops.i2c_gate_ctrl) { |
| 892 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 893 | if (dev->original_set_high_voltage) |
| 894 | res = dev->original_set_high_voltage(fe, arg); |
| 895 | fe->ops.i2c_gate_ctrl(fe, 0); |
| 896 | } |
| 897 | return res; |
| 898 | }; |
| 899 | |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 900 | static int md8800_set_voltage2(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
| 901 | { |
| 902 | struct saa7134_dev *dev = fe->dvb->priv; |
| 903 | u8 wbuf[2] = { 0x1f, 00 }; |
| 904 | u8 rbuf; |
| 905 | struct i2c_msg msg[] = { { .addr = 0x08, .flags = 0, .buf = wbuf, .len = 1 }, |
| 906 | { .addr = 0x08, .flags = I2C_M_RD, .buf = &rbuf, .len = 1 } }; |
| 907 | |
| 908 | if (i2c_transfer(&dev->i2c_adap, msg, 2) != 2) |
| 909 | return -EIO; |
| 910 | /* NOTE: this assumes that gpo1 is used, it might be bit 5 (gpo2) */ |
| 911 | if (voltage == SEC_VOLTAGE_18) |
| 912 | wbuf[1] = rbuf | 0x10; |
| 913 | else |
| 914 | wbuf[1] = rbuf & 0xef; |
| 915 | msg[0].len = 2; |
| 916 | i2c_transfer(&dev->i2c_adap, msg, 1); |
| 917 | return 0; |
| 918 | } |
| 919 | |
| 920 | static int md8800_set_high_voltage2(struct dvb_frontend *fe, long arg) |
| 921 | { |
| 922 | struct saa7134_dev *dev = fe->dvb->priv; |
| 923 | wprintk("%s: sorry can't set high LNB supply voltage from here\n", __func__); |
| 924 | return -EIO; |
| 925 | } |
| 926 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 927 | /* ================================================================== |
| 928 | * nxt200x based ATSC cards, helper functions |
| 929 | */ |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 930 | |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 931 | static struct nxt200x_config avertvhda180 = { |
| 932 | .demod_address = 0x0a, |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 933 | }; |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 934 | |
| 935 | static struct nxt200x_config kworldatsc110 = { |
| 936 | .demod_address = 0x0a, |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 937 | }; |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 938 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 939 | /* ================================================================== |
| 940 | * Core code |
| 941 | */ |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 942 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 943 | static int dvb_init(struct saa7134_dev *dev) |
| 944 | { |
Hartmut Hackmann | 1c4f76a | 2007-04-27 12:31:16 -0300 | [diff] [blame] | 945 | int ret; |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 946 | int attach_xc3028 = 0; |
| 947 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 948 | /* init struct videobuf_dvb */ |
| 949 | dev->ts.nr_bufs = 32; |
| 950 | dev->ts.nr_packets = 32*4; |
| 951 | dev->dvb.name = dev->name; |
Guennadi Liakhovetski | 0705135 | 2008-04-22 14:42:13 -0300 | [diff] [blame] | 952 | videobuf_queue_sg_init(&dev->dvb.dvbq, &saa7134_ts_qops, |
| 953 | &dev->pci->dev, &dev->slock, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 954 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
| 955 | V4L2_FIELD_ALTERNATE, |
| 956 | sizeof(struct saa7134_buf), |
| 957 | dev); |
| 958 | |
| 959 | switch (dev->board) { |
| 960 | case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: |
Trent Piepho | cf3c34c | 2007-03-07 18:19:48 -0300 | [diff] [blame] | 961 | dprintk("pinnacle 300i dvb setup\n"); |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 962 | dev->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 963 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 964 | if (dev->dvb.frontend) { |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 965 | 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] | 966 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 967 | break; |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 968 | case SAA7134_BOARD_AVERMEDIA_777: |
Petr Baudis | 515c208 | 2006-09-26 16:53:53 -0300 | [diff] [blame] | 969 | case SAA7134_BOARD_AVERMEDIA_A16AR: |
Trent Piepho | cf3c34c | 2007-03-07 18:19:48 -0300 | [diff] [blame] | 970 | dprintk("avertv 777 dvb setup\n"); |
Andrew de Quincey | 2bfe031 | 2006-08-08 09:10:08 -0300 | [diff] [blame] | 971 | dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 972 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 973 | if (dev->dvb.frontend) { |
Michael Krufky | fb147e9 | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 974 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 975 | &dev->i2c_adap, 0x61, |
| 976 | TUNER_PHILIPS_TD1316); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 977 | } |
Jose Alberto Reguero | a78d0bf | 2006-02-07 06:25:14 -0200 | [diff] [blame] | 978 | break; |
Mauro Carvalho Chehab | 95a2fdb | 2008-03-28 17:52:44 -0300 | [diff] [blame] | 979 | case SAA7134_BOARD_AVERMEDIA_A16D: |
Tim Farrington | 6e501a3 | 2008-06-15 13:33:42 -0300 | [diff] [blame] | 980 | dprintk("AverMedia A16D dvb setup\n"); |
| 981 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 982 | &avermedia_xc3028_mt352_dev, |
| 983 | &dev->i2c_adap); |
Mauro Carvalho Chehab | 95a2fdb | 2008-03-28 17:52:44 -0300 | [diff] [blame] | 984 | attach_xc3028 = 1; |
| 985 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 986 | case SAA7134_BOARD_MD7134: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 987 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 988 | &medion_cardbus, |
| 989 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 990 | if (dev->dvb.frontend) { |
Michael Krufky | cb89cd3 | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 991 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 992 | &dev->i2c_adap, medion_cardbus.tuner_address, |
| 993 | TUNER_PHILIPS_FMD1216ME_MK3); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 994 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 995 | break; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 996 | case SAA7134_BOARD_PHILIPS_TOUGH: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 997 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 998 | &philips_tu1216_60_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 | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1001 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
| 1002 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1003 | } |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 1004 | break; |
| 1005 | case SAA7134_BOARD_FLYDVBTDUO: |
Peter Missel | 10b7a90 | 2006-01-23 17:11:06 -0200 | [diff] [blame] | 1006 | case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1007 | if (configure_tda827x_fe(dev, &tda827x_lifeview_config, |
| 1008 | &tda827x_cfg_0) < 0) |
| 1009 | goto dettach_frontend; |
Mauro Carvalho Chehab | 86ddd96 | 2005-07-12 13:58:47 -0700 | [diff] [blame] | 1010 | break; |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 1011 | case SAA7134_BOARD_PHILIPS_EUROPA: |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 1012 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1013 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 1014 | &philips_europa_config, |
| 1015 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1016 | if (dev->dvb.frontend) { |
Hartmut Hackmann | 588f983 | 2006-10-18 17:30:42 -0300 | [diff] [blame] | 1017 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; |
| 1018 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
Patrick Boettcher | dea7486 | 2006-05-14 05:01:31 -0300 | [diff] [blame] | 1019 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; |
| 1020 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; |
| 1021 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1022 | } |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 1023 | break; |
| 1024 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1025 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 1026 | &philips_tu1216_61_config, |
| 1027 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1028 | if (dev->dvb.frontend) { |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1029 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; |
| 1030 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1031 | } |
Hartmut Hackmann | 2cf36ac | 2005-11-08 21:36:32 -0800 | [diff] [blame] | 1032 | break; |
Simon Farnsworth | b39423a | 2007-05-01 10:01:20 -0300 | [diff] [blame] | 1033 | case SAA7134_BOARD_KWORLD_DVBT_210: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1034 | if (configure_tda827x_fe(dev, &kworld_dvb_t_210_config, |
| 1035 | &tda827x_cfg_2) < 0) |
| 1036 | goto dettach_frontend; |
Simon Farnsworth | b39423a | 2007-05-01 10:01:20 -0300 | [diff] [blame] | 1037 | break; |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 1038 | case SAA7134_BOARD_PHILIPS_TIGER: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1039 | if (configure_tda827x_fe(dev, &philips_tiger_config, |
| 1040 | &tda827x_cfg_0) < 0) |
| 1041 | goto dettach_frontend; |
Hartmut Hackmann | 587d2fd | 2006-10-06 19:13:50 -0300 | [diff] [blame] | 1042 | break; |
| 1043 | case SAA7134_BOARD_PINNACLE_PCTV_310i: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1044 | if (configure_tda827x_fe(dev, &pinnacle_pctv_310i_config, |
| 1045 | &tda827x_cfg_1) < 0) |
| 1046 | goto dettach_frontend; |
Hartmut Hackmann | 90e9df7 | 2005-11-08 21:38:42 -0800 | [diff] [blame] | 1047 | break; |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 1048 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1049 | if (configure_tda827x_fe(dev, &hauppauge_hvr_1110_config, |
| 1050 | &tda827x_cfg_1) < 0) |
| 1051 | goto dettach_frontend; |
Thomas Genty | c6e53da | 2006-11-05 14:17:30 -0300 | [diff] [blame] | 1052 | break; |
Hartmut Hackmann | d4b0aba | 2005-11-08 21:38:44 -0800 | [diff] [blame] | 1053 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1054 | if (configure_tda827x_fe(dev, &asus_p7131_dual_config, |
| 1055 | &tda827x_cfg_0) < 0) |
| 1056 | goto dettach_frontend; |
Hartmut Hackmann | d4b0aba | 2005-11-08 21:38:44 -0800 | [diff] [blame] | 1057 | break; |
Giampiero Giancipoli | 3d8466e | 2006-02-07 06:49:09 -0200 | [diff] [blame] | 1058 | case SAA7134_BOARD_FLYDVBT_LR301: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1059 | if (configure_tda827x_fe(dev, &tda827x_lifeview_config, |
| 1060 | &tda827x_cfg_0) < 0) |
| 1061 | goto dettach_frontend; |
Giampiero Giancipoli | 3d8466e | 2006-02-07 06:49:09 -0200 | [diff] [blame] | 1062 | break; |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 1063 | case SAA7134_BOARD_FLYDVB_TRIO: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1064 | if (!use_frontend) { /* terrestrial */ |
| 1065 | if (configure_tda827x_fe(dev, &lifeview_trio_config, |
| 1066 | &tda827x_cfg_0) < 0) |
| 1067 | goto dettach_frontend; |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1068 | } else { /* satellite */ |
Nico Sabbi | 1f683cd | 2006-11-15 22:06:56 -0300 | [diff] [blame] | 1069 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap); |
| 1070 | if (dev->dvb.frontend) { |
| 1071 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x63, |
| 1072 | &dev->i2c_adap, 0) == NULL) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1073 | wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1074 | goto dettach_frontend; |
Nico Sabbi | 1f683cd | 2006-11-15 22:06:56 -0300 | [diff] [blame] | 1075 | } |
| 1076 | if (dvb_attach(isl6421_attach, dev->dvb.frontend, &dev->i2c_adap, |
| 1077 | 0x08, 0, 0) == NULL) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1078 | wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1079 | goto dettach_frontend; |
Nico Sabbi | 1f683cd | 2006-11-15 22:06:56 -0300 | [diff] [blame] | 1080 | } |
| 1081 | } |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1082 | } |
Nico Sabbi | 420f32f | 2006-03-03 12:11:28 -0300 | [diff] [blame] | 1083 | break; |
Hartmut Hackmann | df42eaf | 2006-02-07 06:49:10 -0200 | [diff] [blame] | 1084 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: |
Hartmut Hackmann | d95b894 | 2006-03-27 19:39:30 -0300 | [diff] [blame] | 1085 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1086 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 1087 | &ads_tech_duo_config, |
| 1088 | &dev->i2c_adap); |
Andrew de Quincey | 6b3ccab | 2006-04-20 12:01:47 -0300 | [diff] [blame] | 1089 | if (dev->dvb.frontend) { |
Hartmut Hackmann | ede2200 | 2007-04-27 12:31:32 -0300 | [diff] [blame] | 1090 | if (dvb_attach(tda827x_attach,dev->dvb.frontend, |
Hartmut Hackmann | 7bff4b4 | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1091 | ads_tech_duo_config.tuner_address, &dev->i2c_adap, |
| 1092 | &ads_duo_cfg) == NULL) { |
Trent Piepho | cf3c34c | 2007-03-07 18:19:48 -0300 | [diff] [blame] | 1093 | wprintk("no tda827x tuner found at addr: %02x\n", |
Hartmut Hackmann | ede2200 | 2007-04-27 12:31:32 -0300 | [diff] [blame] | 1094 | ads_tech_duo_config.tuner_address); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1095 | goto dettach_frontend; |
Hartmut Hackmann | ede2200 | 2007-04-27 12:31:32 -0300 | [diff] [blame] | 1096 | } |
Mauro Carvalho Chehab | bc36ec7 | 2008-06-14 10:44:04 -0300 | [diff] [blame] | 1097 | } else |
| 1098 | wprintk("failed to attach tda10046\n"); |
Hartmut Hackmann | d95b894 | 2006-03-27 19:39:30 -0300 | [diff] [blame] | 1099 | break; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1100 | case SAA7134_BOARD_TEVION_DVBT_220RF: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1101 | if (configure_tda827x_fe(dev, &tevion_dvbt220rf_config, |
| 1102 | &tda827x_cfg_0) < 0) |
| 1103 | goto dettach_frontend; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1104 | break; |
Hartmut Hackmann | 5eda227 | 2006-08-07 14:03:32 -0300 | [diff] [blame] | 1105 | case SAA7134_BOARD_MEDION_MD8800_QUADRO: |
Hartmut Hackmann | 4b1431c | 2008-04-22 14:42:09 -0300 | [diff] [blame] | 1106 | if (!use_frontend) { /* terrestrial */ |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1107 | if (configure_tda827x_fe(dev, &md8800_dvbt_config, |
| 1108 | &tda827x_cfg_0) < 0) |
| 1109 | goto dettach_frontend; |
Hartmut Hackmann | 4b1431c | 2008-04-22 14:42:09 -0300 | [diff] [blame] | 1110 | } else { /* satellite */ |
| 1111 | dev->dvb.frontend = dvb_attach(tda10086_attach, |
| 1112 | &flydvbs, &dev->i2c_adap); |
| 1113 | if (dev->dvb.frontend) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1114 | struct dvb_frontend *fe = dev->dvb.frontend; |
| 1115 | u8 dev_id = dev->eedata[2]; |
| 1116 | u8 data = 0xc4; |
| 1117 | struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1}; |
| 1118 | |
Hartmut Hackmann | 4b1431c | 2008-04-22 14:42:09 -0300 | [diff] [blame] | 1119 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1120 | 0x60, &dev->i2c_adap, 0) == NULL) { |
Hartmut Hackmann | 4b1431c | 2008-04-22 14:42:09 -0300 | [diff] [blame] | 1121 | wprintk("%s: Medion Quadro, no tda826x " |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1122 | "found !\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1123 | goto dettach_frontend; |
| 1124 | } |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1125 | if (dev_id != 0x08) { |
| 1126 | /* we need to open the i2c gate (we know it exists) */ |
| 1127 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 1128 | if (dvb_attach(isl6405_attach, fe, |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1129 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1130 | wprintk("%s: Medion Quadro, no ISL6405 " |
| 1131 | "found !\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1132 | goto dettach_frontend; |
| 1133 | } |
Hartmut Hackmann | e9c1ac9 | 2008-04-22 14:46:10 -0300 | [diff] [blame] | 1134 | if (dev_id == 0x07) { |
| 1135 | /* fire up the 2nd section of the LNB supply since |
| 1136 | we can't do this from the other section */ |
| 1137 | msg.buf = &data; |
| 1138 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
| 1139 | } |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1140 | fe->ops.i2c_gate_ctrl(fe, 0); |
| 1141 | dev->original_set_voltage = fe->ops.set_voltage; |
| 1142 | fe->ops.set_voltage = md8800_set_voltage; |
| 1143 | dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage; |
| 1144 | fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage; |
| 1145 | } else { |
| 1146 | fe->ops.set_voltage = md8800_set_voltage2; |
| 1147 | fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage2; |
| 1148 | } |
Hartmut Hackmann | 4b1431c | 2008-04-22 14:42:09 -0300 | [diff] [blame] | 1149 | } |
| 1150 | } |
Hartmut Hackmann | 5eda227 | 2006-08-07 14:03:32 -0300 | [diff] [blame] | 1151 | break; |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 1152 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1153 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, |
| 1154 | &dev->i2c_adap); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1155 | if (dev->dvb.frontend) |
Michael Krufky | 4ad8eee5 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1156 | dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, |
Michael Krufky | 47a9991 | 2007-06-12 16:10:51 -0300 | [diff] [blame] | 1157 | NULL, DVB_PLL_TDHU2); |
Michael Krufky | 3b64e8e | 2005-11-08 21:38:20 -0800 | [diff] [blame] | 1158 | break; |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 1159 | case SAA7134_BOARD_KWORLD_ATSC110: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1160 | dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, |
| 1161 | &dev->i2c_adap); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1162 | if (dev->dvb.frontend) |
Michael Krufky | 62ff817a | 2008-04-22 14:46:17 -0300 | [diff] [blame] | 1163 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 1164 | &dev->i2c_adap, 0x61, |
| 1165 | TUNER_PHILIPS_TUV1236D); |
Andrew Burri | 3e1410a | 2006-02-27 00:08:23 -0300 | [diff] [blame] | 1166 | break; |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 1167 | case SAA7134_BOARD_FLYDVBS_LR300: |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1168 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, |
| 1169 | &dev->i2c_adap); |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 1170 | if (dev->dvb.frontend) { |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1171 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, |
| 1172 | &dev->i2c_adap, 0) == NULL) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1173 | wprintk("%s: No tda826x found!\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1174 | goto dettach_frontend; |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 1175 | } |
Michael Krufky | f7b54b1 | 2006-08-08 15:48:08 -0300 | [diff] [blame] | 1176 | if (dvb_attach(isl6421_attach, dev->dvb.frontend, |
| 1177 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1178 | wprintk("%s: No ISL6421 found!\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1179 | goto dettach_frontend; |
Igor M. Liplianin | e2ac28f | 2006-08-08 09:10:10 -0300 | [diff] [blame] | 1180 | } |
| 1181 | } |
| 1182 | break; |
Hartmut Hackmann | cf146ca | 2006-10-02 20:49:24 -0300 | [diff] [blame] | 1183 | case SAA7134_BOARD_ASUS_EUROPA2_HYBRID: |
Matthias Schwarzott | 0e8f4cc | 2008-01-28 12:01:11 -0300 | [diff] [blame] | 1184 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 1185 | &medion_cardbus, |
| 1186 | &dev->i2c_adap); |
Hartmut Hackmann | cf146ca | 2006-10-02 20:49:24 -0300 | [diff] [blame] | 1187 | if (dev->dvb.frontend) { |
| 1188 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; |
| 1189 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; |
Trent Piepho | b7754d7 | 2007-05-08 18:05:16 -0300 | [diff] [blame] | 1190 | |
Michael Krufky | cb89cd3 | 2008-04-22 14:46:16 -0300 | [diff] [blame] | 1191 | dvb_attach(simple_tuner_attach, dev->dvb.frontend, |
| 1192 | &dev->i2c_adap, medion_cardbus.tuner_address, |
| 1193 | TUNER_PHILIPS_FMD1216ME_MK3); |
Hartmut Hackmann | cf146ca | 2006-10-02 20:49:24 -0300 | [diff] [blame] | 1194 | } |
| 1195 | break; |
Hartmut Hackmann | cbb9452 | 2006-10-30 20:00:16 -0300 | [diff] [blame] | 1196 | case SAA7134_BOARD_VIDEOMATE_DVBT_200A: |
| 1197 | dev->dvb.frontend = dvb_attach(tda10046_attach, |
| 1198 | &philips_europa_config, |
| 1199 | &dev->i2c_adap); |
| 1200 | if (dev->dvb.frontend) { |
| 1201 | dev->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init; |
| 1202 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; |
| 1203 | } |
| 1204 | break; |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 1205 | case SAA7134_BOARD_CINERGY_HT_PCMCIA: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1206 | if (configure_tda827x_fe(dev, &cinergy_ht_config, |
| 1207 | &tda827x_cfg_0) < 0) |
| 1208 | goto dettach_frontend; |
Hartmut Hackmann | 550a9a5 | 2006-11-15 21:31:54 -0300 | [diff] [blame] | 1209 | break; |
Michael Krufky | 9de271e | 2007-01-16 18:36:40 -0300 | [diff] [blame] | 1210 | case SAA7134_BOARD_CINERGY_HT_PCI: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1211 | if (configure_tda827x_fe(dev, &cinergy_ht_pci_config, |
| 1212 | &tda827x_cfg_0) < 0) |
| 1213 | goto dettach_frontend; |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1214 | break; |
| 1215 | case SAA7134_BOARD_PHILIPS_TIGER_S: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1216 | if (configure_tda827x_fe(dev, &philips_tiger_s_config, |
| 1217 | &tda827x_cfg_2) < 0) |
| 1218 | goto dettach_frontend; |
Michael Krufky | 9de271e | 2007-01-16 18:36:40 -0300 | [diff] [blame] | 1219 | break; |
Hartmut Hackmann | e06cea4 | 2007-03-13 20:58:29 -0300 | [diff] [blame] | 1220 | case SAA7134_BOARD_ASUS_P7131_4871: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1221 | if (configure_tda827x_fe(dev, &asus_p7131_4871_config, |
| 1222 | &tda827x_cfg_2) < 0) |
| 1223 | goto dettach_frontend; |
Hartmut Hackmann | e06cea4 | 2007-03-13 20:58:29 -0300 | [diff] [blame] | 1224 | break; |
Hartmut Hackmann | f3eec0c0 | 2007-03-14 20:33:55 -0300 | [diff] [blame] | 1225 | case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1226 | if (configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config, |
| 1227 | &tda827x_cfg_2) < 0) |
| 1228 | goto dettach_frontend; |
Hartmut Hackmann | e06cea4 | 2007-03-13 20:58:29 -0300 | [diff] [blame] | 1229 | break; |
Edgar Simo | d90d9f5 | 2007-08-20 14:14:50 -0300 | [diff] [blame] | 1230 | case SAA7134_BOARD_AVERMEDIA_SUPER_007: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1231 | if (configure_tda827x_fe(dev, &avermedia_super_007_config, |
| 1232 | &tda827x_cfg_0) < 0) |
| 1233 | goto dettach_frontend; |
Edgar Simo | d90d9f5 | 2007-08-20 14:14:50 -0300 | [diff] [blame] | 1234 | break; |
Hermann Pitton | 4ba2437 | 2008-01-20 19:27:51 -0300 | [diff] [blame] | 1235 | case SAA7134_BOARD_TWINHAN_DTV_DVB_3056: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1236 | if (configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config, |
| 1237 | &tda827x_cfg_2_sw42) < 0) |
| 1238 | goto dettach_frontend; |
Hermann Pitton | 4ba2437 | 2008-01-20 19:27:51 -0300 | [diff] [blame] | 1239 | break; |
Hartmut Hackmann | 6ab465a | 2008-04-22 14:42:11 -0300 | [diff] [blame] | 1240 | case SAA7134_BOARD_PHILIPS_SNAKE: |
| 1241 | dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, |
| 1242 | &dev->i2c_adap); |
| 1243 | if (dev->dvb.frontend) { |
| 1244 | if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1245 | &dev->i2c_adap, 0) == NULL) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1246 | wprintk("%s: No tda826x found!\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1247 | goto dettach_frontend; |
| 1248 | } |
Hartmut Hackmann | 6ab465a | 2008-04-22 14:42:11 -0300 | [diff] [blame] | 1249 | if (dvb_attach(lnbp21_attach, dev->dvb.frontend, |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1250 | &dev->i2c_adap, 0, 0) == NULL) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1251 | wprintk("%s: No lnbp21 found!\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1252 | goto dettach_frontend; |
| 1253 | } |
Hartmut Hackmann | 6ab465a | 2008-04-22 14:42:11 -0300 | [diff] [blame] | 1254 | } |
| 1255 | break; |
Hermann Pitton | 7b5b3f1 | 2008-04-22 14:42:12 -0300 | [diff] [blame] | 1256 | case SAA7134_BOARD_CREATIX_CTX953: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1257 | if (configure_tda827x_fe(dev, &md8800_dvbt_config, |
| 1258 | &tda827x_cfg_0) < 0) |
| 1259 | goto dettach_frontend; |
Hermann Pitton | 7b5b3f1 | 2008-04-22 14:42:12 -0300 | [diff] [blame] | 1260 | break; |
Russell Kliese | 6a6179b6 | 2008-04-22 14:42:12 -0300 | [diff] [blame] | 1261 | case SAA7134_BOARD_MSI_TVANYWHERE_AD11: |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1262 | if (configure_tda827x_fe(dev, &philips_tiger_s_config, |
| 1263 | &tda827x_cfg_2) < 0) |
| 1264 | goto dettach_frontend; |
Russell Kliese | 6a6179b6 | 2008-04-22 14:42:12 -0300 | [diff] [blame] | 1265 | break; |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 1266 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: |
Tim Farrington | 6e501a3 | 2008-06-15 13:33:42 -0300 | [diff] [blame] | 1267 | dprintk("AverMedia E506R dvb setup\n"); |
| 1268 | saa7134_set_gpio(dev, 25, 0); |
| 1269 | msleep(10); |
| 1270 | saa7134_set_gpio(dev, 25, 1); |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 1271 | dev->dvb.frontend = dvb_attach(mt352_attach, |
Tim Farrington | 6e501a3 | 2008-06-15 13:33:42 -0300 | [diff] [blame] | 1272 | &avermedia_xc3028_mt352_dev, |
| 1273 | &dev->i2c_adap); |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 1274 | attach_xc3028 = 1; |
Massimo Piccioni | e2fc00c | 2008-07-11 13:48:02 -0300 | [diff] [blame] | 1275 | break; |
Hartmut Hackmann | 637afdb | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1276 | case SAA7134_BOARD_MD7134_BRIDGE_2: |
| 1277 | dev->dvb.frontend = dvb_attach(tda10086_attach, |
Hartmut Hackmann | 9a1b04e | 2008-04-09 23:07:11 -0300 | [diff] [blame] | 1278 | &sd1878_4m, &dev->i2c_adap); |
Hartmut Hackmann | 637afdb | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1279 | if (dev->dvb.frontend) { |
| 1280 | struct dvb_frontend *fe; |
| 1281 | if (dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1282 | &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) { |
Hartmut Hackmann | 637afdb | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1283 | wprintk("%s: MD7134 DVB-S, no SD1878 " |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1284 | "found !\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1285 | goto dettach_frontend; |
| 1286 | } |
Hartmut Hackmann | 637afdb | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1287 | /* we need to open the i2c gate (we know it exists) */ |
| 1288 | fe = dev->dvb.frontend; |
| 1289 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 1290 | if (dvb_attach(isl6405_attach, fe, |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1291 | &dev->i2c_adap, 0x08, 0, 0) == NULL) { |
Hartmut Hackmann | 637afdb | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1292 | wprintk("%s: MD7134 DVB-S, no ISL6405 " |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1293 | "found !\n", __func__); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1294 | goto dettach_frontend; |
| 1295 | } |
Hartmut Hackmann | 637afdb | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1296 | fe->ops.i2c_gate_ctrl(fe, 0); |
| 1297 | dev->original_set_voltage = fe->ops.set_voltage; |
| 1298 | fe->ops.set_voltage = md8800_set_voltage; |
| 1299 | dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage; |
| 1300 | fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage; |
| 1301 | } |
| 1302 | break; |
Massimo Piccioni | e2fc00c | 2008-07-11 13:48:02 -0300 | [diff] [blame] | 1303 | case SAA7134_BOARD_AVERMEDIA_M103: |
| 1304 | saa7134_set_gpio(dev, 25, 0); |
| 1305 | msleep(10); |
| 1306 | saa7134_set_gpio(dev, 25, 1); |
| 1307 | dev->dvb.frontend = dvb_attach(mt352_attach, |
| 1308 | &avermedia_xc3028_mt352_dev, |
| 1309 | &dev->i2c_adap); |
| 1310 | attach_xc3028 = 1; |
| 1311 | break; |
hermann pitton | 301e9d6 | 2008-09-14 17:49:14 -0300 | [diff] [blame] | 1312 | case SAA7134_BOARD_ASUSTeK_TIGER_3IN1: |
| 1313 | if (!use_frontend) { /* terrestrial */ |
| 1314 | if (configure_tda827x_fe(dev, &asus_tiger_3in1_config, |
| 1315 | &tda827x_cfg_2) < 0) |
| 1316 | goto dettach_frontend; |
| 1317 | } else { /* satellite */ |
| 1318 | dev->dvb.frontend = dvb_attach(tda10086_attach, |
| 1319 | &flydvbs, &dev->i2c_adap); |
| 1320 | if (dev->dvb.frontend) { |
| 1321 | if (dvb_attach(tda826x_attach, |
| 1322 | dev->dvb.frontend, 0x60, |
| 1323 | &dev->i2c_adap, 0) == NULL) { |
| 1324 | wprintk("%s: Asus Tiger 3in1, no " |
| 1325 | "tda826x found!\n", __func__); |
| 1326 | goto dettach_frontend; |
| 1327 | } |
| 1328 | if (dvb_attach(lnbp21_attach, dev->dvb.frontend, |
| 1329 | &dev->i2c_adap, 0, 0) == NULL) { |
| 1330 | wprintk("%s: Asus Tiger 3in1, no lnbp21" |
| 1331 | " found!\n", __func__); |
| 1332 | goto dettach_frontend; |
| 1333 | } |
| 1334 | } |
| 1335 | } |
| 1336 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1337 | default: |
Trent Piepho | cf3c34c | 2007-03-07 18:19:48 -0300 | [diff] [blame] | 1338 | wprintk("Huh? unknown DVB card?\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1339 | break; |
| 1340 | } |
| 1341 | |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 1342 | if (attach_xc3028) { |
| 1343 | struct dvb_frontend *fe; |
| 1344 | struct xc2028_config cfg = { |
| 1345 | .i2c_adap = &dev->i2c_adap, |
| 1346 | .i2c_addr = 0x61, |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 1347 | }; |
Mauro Carvalho Chehab | 95a2fdb | 2008-03-28 17:52:44 -0300 | [diff] [blame] | 1348 | |
| 1349 | if (!dev->dvb.frontend) |
| 1350 | return -1; |
| 1351 | |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 1352 | fe = dvb_attach(xc2028_attach, dev->dvb.frontend, &cfg); |
| 1353 | if (!fe) { |
| 1354 | printk(KERN_ERR "%s/2: xc3028 attach failed\n", |
| 1355 | dev->name); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1356 | goto dettach_frontend; |
Mauro Carvalho Chehab | bc36a68 | 2008-04-22 14:45:27 -0300 | [diff] [blame] | 1357 | } |
| 1358 | } |
| 1359 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1360 | if (NULL == dev->dvb.frontend) { |
Trent Piepho | cf3c34c | 2007-03-07 18:19:48 -0300 | [diff] [blame] | 1361 | printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1362 | return -1; |
| 1363 | } |
Michael Krufky | d7cba04 | 2008-09-12 13:31:45 -0300 | [diff] [blame^] | 1364 | /* define general-purpose callback pointer */ |
| 1365 | dev->dvb.frontend->callback = saa7134_tuner_callback; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1366 | |
| 1367 | /* register everything else */ |
Janne Grunau | 78e92006 | 2008-04-09 19:13:13 -0300 | [diff] [blame] | 1368 | ret = videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev, |
| 1369 | adapter_nr); |
Hartmut Hackmann | 1c4f76a | 2007-04-27 12:31:16 -0300 | [diff] [blame] | 1370 | |
| 1371 | /* this sequence is necessary to make the tda1004x load its firmware |
| 1372 | * and to enter analog mode of hybrid boards |
| 1373 | */ |
| 1374 | if (!ret) { |
| 1375 | if (dev->dvb.frontend->ops.init) |
| 1376 | dev->dvb.frontend->ops.init(dev->dvb.frontend); |
| 1377 | if (dev->dvb.frontend->ops.sleep) |
| 1378 | dev->dvb.frontend->ops.sleep(dev->dvb.frontend); |
Hartmut Hackmann | 9971f4f | 2007-03-23 21:00:07 -0300 | [diff] [blame] | 1379 | if (dev->dvb.frontend->ops.tuner_ops.sleep) |
| 1380 | dev->dvb.frontend->ops.tuner_ops.sleep(dev->dvb.frontend); |
Hartmut Hackmann | 1c4f76a | 2007-04-27 12:31:16 -0300 | [diff] [blame] | 1381 | } |
| 1382 | return ret; |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1383 | |
| 1384 | dettach_frontend: |
Mauro Carvalho Chehab | bf67cac | 2008-06-07 15:54:10 -0300 | [diff] [blame] | 1385 | if (dev->dvb.frontend) |
| 1386 | dvb_frontend_detach(dev->dvb.frontend); |
Mauro Carvalho Chehab | d557dab | 2008-04-30 15:27:55 -0300 | [diff] [blame] | 1387 | dev->dvb.frontend = NULL; |
| 1388 | |
| 1389 | return -1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1390 | } |
| 1391 | |
| 1392 | static int dvb_fini(struct saa7134_dev *dev) |
| 1393 | { |
Mauro Carvalho Chehab | 7f17112 | 2007-10-18 19:56:47 -0300 | [diff] [blame] | 1394 | /* FIXME: I suspect that this code is bogus, since the entry for |
| 1395 | Pinnacle 300I DVB-T PAL already defines the proper init to allow |
| 1396 | the detection of mt2032 (TDA9887_PORT2_INACTIVE) |
| 1397 | */ |
| 1398 | if (dev->board == SAA7134_BOARD_PINNACLE_300I_DVBT_PAL) { |
| 1399 | struct v4l2_priv_tun_config tda9887_cfg; |
| 1400 | static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1401 | |
Mauro Carvalho Chehab | 7f17112 | 2007-10-18 19:56:47 -0300 | [diff] [blame] | 1402 | tda9887_cfg.tuner = TUNER_TDA9887; |
| 1403 | tda9887_cfg.priv = &on; |
| 1404 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1405 | /* otherwise we don't detect the tuner on next insmod */ |
Mauro Carvalho Chehab | 7f17112 | 2007-10-18 19:56:47 -0300 | [diff] [blame] | 1406 | saa7134_i2c_call_clients(dev, TUNER_SET_CONFIG, &tda9887_cfg); |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1407 | } else if (dev->board == SAA7134_BOARD_MEDION_MD8800_QUADRO) { |
Hartmut Hackmann | e9c1ac9 | 2008-04-22 14:46:10 -0300 | [diff] [blame] | 1408 | if ((dev->eedata[2] == 0x07) && use_frontend) { |
Hartmut Hackmann | 5823b3a | 2008-04-22 14:46:08 -0300 | [diff] [blame] | 1409 | /* turn off the 2nd lnb supply */ |
| 1410 | u8 data = 0x80; |
| 1411 | struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1}; |
| 1412 | struct dvb_frontend *fe; |
| 1413 | fe = dev->dvb.frontend; |
| 1414 | if (fe->ops.i2c_gate_ctrl) { |
| 1415 | fe->ops.i2c_gate_ctrl(fe, 1); |
| 1416 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
| 1417 | fe->ops.i2c_gate_ctrl(fe, 0); |
| 1418 | } |
| 1419 | } |
Mauro Carvalho Chehab | 7f17112 | 2007-10-18 19:56:47 -0300 | [diff] [blame] | 1420 | } |
Mauro Carvalho Chehab | 9950c1b | 2008-04-11 11:29:44 -0300 | [diff] [blame] | 1421 | if (dev->dvb.frontend) |
| 1422 | videobuf_dvb_unregister(&dev->dvb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1423 | return 0; |
| 1424 | } |
| 1425 | |
| 1426 | static struct saa7134_mpeg_ops dvb_ops = { |
| 1427 | .type = SAA7134_MPEG_DVB, |
| 1428 | .init = dvb_init, |
| 1429 | .fini = dvb_fini, |
| 1430 | }; |
| 1431 | |
| 1432 | static int __init dvb_register(void) |
| 1433 | { |
| 1434 | return saa7134_ts_register(&dvb_ops); |
| 1435 | } |
| 1436 | |
| 1437 | static void __exit dvb_unregister(void) |
| 1438 | { |
| 1439 | saa7134_ts_unregister(&dvb_ops); |
| 1440 | } |
| 1441 | |
| 1442 | module_init(dvb_register); |
| 1443 | module_exit(dvb_unregister); |
| 1444 | |
| 1445 | /* ------------------------------------------------------------------ */ |
| 1446 | /* |
| 1447 | * Local variables: |
| 1448 | * c-basic-offset: 8 |
| 1449 | * End: |
| 1450 | */ |