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