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