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