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