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