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