blob: 5fdb8455fe8a897cfad8caed2e9329b732ddc20a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 *
3 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
4 *
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07005 * Extended 3 / 2005 by Hartmut Hackmann to support various
6 * cards with the tda10046 DVB-T channel decoder
7 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/init.h>
24#include <linux/list.h>
25#include <linux/module.h>
26#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#include <linux/delay.h>
28#include <linux/kthread.h>
29#include <linux/suspend.h>
30
31#include "saa7134-reg.h"
32#include "saa7134.h"
Michael Krufky5e453dc2006-01-09 15:32:31 -020033#include <media/v4l2-common.h>
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -020034#include "dvb-pll.h"
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -030035#include <dvb_frontend.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Andrew de Quincey1f10c7a2006-08-08 09:10:09 -030037#include "mt352.h"
38#include "mt352_priv.h" /* FIXME */
39#include "tda1004x.h"
40#include "nxt200x.h"
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -030041#include "tuner-xc2028.h"
Beholder Intl. Ltd. Dmitry Belimov29309922009-09-30 23:02:21 -030042#include "xc5000.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -030044#include "tda10086.h"
45#include "tda826x.h"
Michael Krufky8ce47da2007-04-27 12:31:14 -030046#include "tda827x.h"
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -030047#include "isl6421.h"
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -030048#include "isl6405.h"
Hartmut Hackmann6ab465a2008-04-22 14:42:11 -030049#include "lnbp21.h"
Michael Krufkycb89cd32008-04-22 14:46:16 -030050#include "tuner-simple.h"
Michael Krufky1bc7f512009-01-19 01:10:49 -030051#include "tda10048.h"
Michael Krufky3abdedd2009-01-19 01:10:49 -030052#include "tda18271.h"
53#include "lgdt3305.h"
54#include "tda8290.h"
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -030055#include "mb86a20s.h"
Timothy Leece027042011-03-25 15:00:33 -030056#include "lgs8gxx.h"
Michael Krufky8ce47da2007-04-27 12:31:14 -030057
Dmitri Belimov47aeba52008-12-23 03:53:03 -030058#include "zl10353.h"
Carlos Corbachodbe87402011-06-25 10:24:28 -030059#include "qt1010.h"
Dmitri Belimov47aeba52008-12-23 03:53:03 -030060
Matthias Schwarzott04574182009-02-24 12:35:16 -030061#include "zl10036.h"
Igor M. Liplianinecfcfec2009-08-13 21:42:21 -030062#include "zl10039.h"
Matthias Schwarzott04574182009-02-24 12:35:16 -030063#include "mt312.h"
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
66MODULE_LICENSE("GPL");
67
Douglas Schilling Landgrafff699e62008-04-22 14:41:48 -030068static unsigned int antenna_pwr;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -070069
Linus Torvalds1da177e2005-04-16 15:20:36 -070070module_param(antenna_pwr, int, 0444);
71MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
72
Douglas Schilling Landgrafff699e62008-04-22 14:41:48 -030073static int use_frontend;
Stephan Berberigb331daa2006-12-20 09:37:05 -030074module_param(use_frontend, int, 0644);
75MODULE_PARM_DESC(use_frontend,"for cards with multiple frontends (0: terrestrial, 1: satellite)");
Nico Sabbi1f683cd2006-11-15 22:06:56 -030076
Douglas Schilling Landgrafff699e62008-04-22 14:41:48 -030077static int debug;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -030078module_param(debug, int, 0644);
79MODULE_PARM_DESC(debug, "Turn on/off module debugging (default:off).");
80
Janne Grunau78e92002008-04-09 19:13:13 -030081DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
82
Trent Piephocf3c34c2007-03-07 18:19:48 -030083#define dprintk(fmt, arg...) do { if (debug) \
84 printk(KERN_DEBUG "%s/dvb: " fmt, dev->name , ## arg); } while(0)
85
86/* Print a warning */
87#define wprintk(fmt, arg...) \
88 printk(KERN_WARNING "%s/dvb: " fmt, dev->name, ## arg)
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -030089
90/* ------------------------------------------------------------------
91 * mt352 based DVB-T cards
92 */
93
Linus Torvalds1da177e2005-04-16 15:20:36 -070094static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
95{
96 u32 ok;
97
98 if (!on) {
99 saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26));
100 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
101 return 0;
102 }
103
104 saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 26));
105 saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
106 udelay(10);
107
108 saa_setl(SAA7134_GPIO_GPMODE0 >> 2, (1 << 28));
109 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
110 udelay(10);
111 saa_setl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 28));
112 udelay(10);
113 ok = saa_readl(SAA7134_GPIO_GPSTATUS0) & (1 << 27);
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -0300114 dprintk("%s %s\n", __func__, ok ? "on" : "off");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
116 if (!ok)
117 saa_clearl(SAA7134_GPIO_GPSTATUS0 >> 2, (1 << 26));
118 return ok;
119}
120
121static int mt352_pinnacle_init(struct dvb_frontend* fe)
122{
123 static u8 clock_config [] = { CLOCK_CTL, 0x3d, 0x28 };
124 static u8 reset [] = { RESET, 0x80 };
125 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
126 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 };
127 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x31 };
128 static u8 fsm_ctl_cfg[] = { 0x7b, 0x04 };
129 static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x0f };
130 static u8 scan_ctl_cfg [] = { SCAN_CTL, 0x0d };
131 static u8 irq_cfg [] = { INTERRUPT_EN_0, 0x00, 0x00, 0x00, 0x00 };
132 struct saa7134_dev *dev= fe->dvb->priv;
133
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -0300134 dprintk("%s called\n", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
136 mt352_write(fe, clock_config, sizeof(clock_config));
137 udelay(200);
138 mt352_write(fe, reset, sizeof(reset));
139 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
140 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
141 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
142 mt352_write(fe, gpp_ctl_cfg, sizeof(gpp_ctl_cfg));
143
144 mt352_write(fe, fsm_ctl_cfg, sizeof(fsm_ctl_cfg));
145 mt352_write(fe, scan_ctl_cfg, sizeof(scan_ctl_cfg));
146 mt352_write(fe, irq_cfg, sizeof(irq_cfg));
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300147
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 return 0;
149}
150
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200151static int mt352_aver777_init(struct dvb_frontend* fe)
152{
153 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d };
154 static u8 reset [] = { RESET, 0x80 };
155 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
156 static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0xa0 };
157 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
158
159 mt352_write(fe, clock_config, sizeof(clock_config));
160 udelay(200);
161 mt352_write(fe, reset, sizeof(reset));
162 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
163 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
164 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
165
166 return 0;
167}
168
Tim Farrington6e501a32008-06-15 13:33:42 -0300169static int mt352_avermedia_xc3028_init(struct dvb_frontend *fe)
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -0300170{
Tim Farrington6e501a32008-06-15 13:33:42 -0300171 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x2d };
172 static u8 reset [] = { RESET, 0x80 };
173 static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
174 static u8 agc_cfg [] = { AGC_TARGET, 0xe };
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -0300175 static u8 capt_range_cfg[] = { CAPT_RANGE, 0x33 };
176
177 mt352_write(fe, clock_config, sizeof(clock_config));
178 udelay(200);
179 mt352_write(fe, reset, sizeof(reset));
180 mt352_write(fe, adc_ctl_1_cfg, sizeof(adc_ctl_1_cfg));
181 mt352_write(fe, agc_cfg, sizeof(agc_cfg));
182 mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -0300183 return 0;
184}
185
Andrew de Quincey0463f122006-05-16 17:22:02 -0300186static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
187 struct dvb_frontend_parameters* params)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188{
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300189 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300190 u8 off[] = { 0x00, 0xf1};
191 u8 on[] = { 0x00, 0x71};
192 struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)};
193
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194 struct saa7134_dev *dev = fe->dvb->priv;
195 struct v4l2_frequency f;
196
197 /* set frequency (mt2050) */
198 f.tuner = 0;
199 f.type = V4L2_TUNER_DIGITAL_TV;
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300200 f.frequency = c->frequency / 1000 * 16 / 1000;
Patrick Boettcherdea74862006-05-14 05:01:31 -0300201 if (fe->ops.i2c_gate_ctrl)
202 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300203 i2c_transfer(&dev->i2c_adap, &msg, 1);
Hans Verkuilfac69862009-01-17 12:17:14 -0300204 saa_call_all(dev, tuner, s_frequency, &f);
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300205 msg.buf = on;
Patrick Boettcherdea74862006-05-14 05:01:31 -0300206 if (fe->ops.i2c_gate_ctrl)
207 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300208 i2c_transfer(&dev->i2c_adap, &msg, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
210 pinnacle_antenna_pwr(dev, antenna_pwr);
211
212 /* mt352 setup */
Andrew de Quincey0463f122006-05-16 17:22:02 -0300213 return mt352_pinnacle_init(fe);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214}
215
216static struct mt352_config pinnacle_300i = {
217 .demod_address = 0x3c >> 1,
218 .adc_clock = 20333,
219 .if2 = 36150,
220 .no_tuner = 1,
221 .demod_init = mt352_pinnacle_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222};
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200223
224static struct mt352_config avermedia_777 = {
225 .demod_address = 0xf,
226 .demod_init = mt352_aver777_init,
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200227};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228
Tim Farrington6e501a32008-06-15 13:33:42 -0300229static struct mt352_config avermedia_xc3028_mt352_dev = {
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -0300230 .demod_address = (0x1e >> 1),
231 .no_tuner = 1,
Tim Farrington6e501a32008-06-15 13:33:42 -0300232 .demod_init = mt352_avermedia_xc3028_init,
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -0300233};
234
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -0300235static struct tda18271_std_map mb86a20s_tda18271_std_map = {
236 .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4,
237 .if_lvl = 7, .rfagc_top = 0x37, },
238};
239
240static struct tda18271_config kworld_tda18271_config = {
241 .std_map = &mb86a20s_tda18271_std_map,
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -0300242 .gate = TDA18271_GATE_DIGITAL,
Mauro Carvalho Chehabecb71d22011-01-14 12:03:03 -0300243 .config = 3, /* Use tuner callback for AGC */
244
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -0300245};
246
247static const struct mb86a20s_config kworld_mb86a20s_config = {
248 .demod_address = 0x10,
249};
250
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -0300251static int kworld_sbtvd_gate_ctrl(struct dvb_frontend* fe, int enable)
252{
253 struct saa7134_dev *dev = fe->dvb->priv;
254
255 unsigned char initmsg[] = {0x45, 0x97};
256 unsigned char msg_enable[] = {0x45, 0xc1};
257 unsigned char msg_disable[] = {0x45, 0x81};
258 struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2};
259
260 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
261 wprintk("could not access the I2C gate\n");
262 return -EIO;
263 }
264 if (enable)
265 msg.buf = msg_enable;
266 else
267 msg.buf = msg_disable;
268 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
269 wprintk("could not access the I2C gate\n");
270 return -EIO;
271 }
272 msleep(20);
273 return 0;
274}
275
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300276/* ==================================================================
277 * tda1004x based DVB-T cards, helper functions
278 */
279
280static int philips_tda1004x_request_firmware(struct dvb_frontend *fe,
281 const struct firmware **fw, char *name)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700282{
283 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300284 return request_firmware(fw, name, &dev->pci->dev);
285}
286
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300287/* ------------------------------------------------------------------
288 * these tuners are tu1216, td1316(a)
289 */
290
291static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
292{
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300293 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300294 struct saa7134_dev *dev = fe->dvb->priv;
295 struct tda1004x_state *state = fe->demodulator_priv;
296 u8 addr = state->config->tuner_address;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700297 u8 tuner_buf[4];
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800298 struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len =
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700299 sizeof(tuner_buf) };
300 int tuner_frequency = 0;
301 u8 band, cp, filter;
302
303 /* determine charge pump */
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300304 tuner_frequency = c->frequency + 36166000;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700305 if (tuner_frequency < 87000000)
306 return -EINVAL;
307 else if (tuner_frequency < 130000000)
308 cp = 3;
309 else if (tuner_frequency < 160000000)
310 cp = 5;
311 else if (tuner_frequency < 200000000)
312 cp = 6;
313 else if (tuner_frequency < 290000000)
314 cp = 3;
315 else if (tuner_frequency < 420000000)
316 cp = 5;
317 else if (tuner_frequency < 480000000)
318 cp = 6;
319 else if (tuner_frequency < 620000000)
320 cp = 3;
321 else if (tuner_frequency < 830000000)
322 cp = 5;
323 else if (tuner_frequency < 895000000)
324 cp = 7;
325 else
326 return -EINVAL;
327
328 /* determine band */
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300329 if (c->frequency < 49000000)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700330 return -EINVAL;
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300331 else if (c->frequency < 161000000)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700332 band = 1;
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300333 else if (c->frequency < 444000000)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700334 band = 2;
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300335 else if (c->frequency < 861000000)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700336 band = 4;
337 else
338 return -EINVAL;
339
340 /* setup PLL filter */
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300341 switch (c->bandwidth_hz) {
342 case 6000000:
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700343 filter = 0;
344 break;
345
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300346 case 7000000:
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700347 filter = 0;
348 break;
349
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300350 case 8000000:
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700351 filter = 1;
352 break;
353
354 default:
355 return -EINVAL;
356 }
357
358 /* calculate divisor
359 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
360 */
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300361 tuner_frequency = (((c->frequency / 1000) * 6) + 217496) / 1000;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700362
363 /* setup tuner buffer */
364 tuner_buf[0] = (tuner_frequency >> 8) & 0x7f;
365 tuner_buf[1] = tuner_frequency & 0xff;
366 tuner_buf[2] = 0xca;
367 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
368
Patrick Boettcherdea74862006-05-14 05:01:31 -0300369 if (fe->ops.i2c_gate_ctrl)
370 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300371 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) {
Trent Piephocf3c34c2007-03-07 18:19:48 -0300372 wprintk("could not write to tuner at addr: 0x%02x\n",
373 addr << 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700374 return -EIO;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300375 }
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700376 msleep(1);
377 return 0;
378}
379
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300380static int philips_tu1216_init(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800381{
382 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300383 struct tda1004x_state *state = fe->demodulator_priv;
384 u8 addr = state->config->tuner_address;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800385 static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab };
386 struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) };
387
388 /* setup PLL configuration */
Patrick Boettcherdea74862006-05-14 05:01:31 -0300389 if (fe->ops.i2c_gate_ctrl)
390 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800391 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
392 return -EIO;
393 msleep(1);
394
395 return 0;
396}
397
398/* ------------------------------------------------------------------ */
399
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800400static struct tda1004x_config philips_tu1216_60_config = {
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700401 .demod_address = 0x8,
402 .invert = 1,
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800403 .invert_oclk = 0,
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700404 .xtal_freq = TDA10046_XTAL_4M,
405 .agc_config = TDA10046_AGC_DEFAULT,
406 .if_freq = TDA10046_FREQ_3617,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300407 .tuner_address = 0x60,
408 .request_firmware = philips_tda1004x_request_firmware
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409};
410
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800411static struct tda1004x_config philips_tu1216_61_config = {
412
413 .demod_address = 0x8,
414 .invert = 1,
415 .invert_oclk = 0,
416 .xtal_freq = TDA10046_XTAL_4M,
417 .agc_config = TDA10046_AGC_DEFAULT,
418 .if_freq = TDA10046_FREQ_3617,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300419 .tuner_address = 0x61,
420 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800421};
422
423/* ------------------------------------------------------------------ */
424
Hartmut Hackmanncbb94522006-10-30 20:00:16 -0300425static int philips_td1316_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800426{
427 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300428 struct tda1004x_state *state = fe->demodulator_priv;
429 u8 addr = state->config->tuner_address;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800430 static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab };
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300431 struct i2c_msg init_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) };
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800432
433 /* setup PLL configuration */
Patrick Boettcherdea74862006-05-14 05:01:31 -0300434 if (fe->ops.i2c_gate_ctrl)
435 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800436 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
437 return -EIO;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800438 return 0;
439}
440
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300441static int philips_td1316_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800442{
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300443 return philips_tda6651_pll_set(fe, params);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800444}
445
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300446static int philips_td1316_tuner_sleep(struct dvb_frontend *fe)
447{
448 struct saa7134_dev *dev = fe->dvb->priv;
449 struct tda1004x_state *state = fe->demodulator_priv;
450 u8 addr = state->config->tuner_address;
451 static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 };
452 struct i2c_msg analog_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) };
453
454 /* switch the tuner to analog mode */
455 if (fe->ops.i2c_gate_ctrl)
456 fe->ops.i2c_gate_ctrl(fe, 1);
457 if (i2c_transfer(&dev->i2c_adap, &analog_msg, 1) != 1)
458 return -EIO;
459 return 0;
460}
461
462/* ------------------------------------------------------------------ */
463
Hartmut Hackmanncbb94522006-10-30 20:00:16 -0300464static int philips_europa_tuner_init(struct dvb_frontend *fe)
465{
466 struct saa7134_dev *dev = fe->dvb->priv;
467 static u8 msg[] = { 0x00, 0x40};
468 struct i2c_msg init_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) };
469
470
471 if (philips_td1316_tuner_init(fe))
472 return -EIO;
473 msleep(1);
474 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
475 return -EIO;
476
477 return 0;
478}
479
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300480static int philips_europa_tuner_sleep(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800481{
482 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800483
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300484 static u8 msg[] = { 0x00, 0x14 };
485 struct i2c_msg analog_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) };
486
487 if (philips_td1316_tuner_sleep(fe))
488 return -EIO;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800489
490 /* switch the board to analog mode */
Patrick Boettcherdea74862006-05-14 05:01:31 -0300491 if (fe->ops.i2c_gate_ctrl)
492 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800493 i2c_transfer(&dev->i2c_adap, &analog_msg, 1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300494 return 0;
495}
496
497static int philips_europa_demod_sleep(struct dvb_frontend *fe)
498{
499 struct saa7134_dev *dev = fe->dvb->priv;
500
501 if (dev->original_demod_sleep)
502 dev->original_demod_sleep(fe);
Patrick Boettcherdea74862006-05-14 05:01:31 -0300503 fe->ops.i2c_gate_ctrl(fe, 1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300504 return 0;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800505}
506
507static struct tda1004x_config philips_europa_config = {
508
509 .demod_address = 0x8,
510 .invert = 0,
511 .invert_oclk = 0,
512 .xtal_freq = TDA10046_XTAL_4M,
513 .agc_config = TDA10046_AGC_IFO_AUTO_POS,
514 .if_freq = TDA10046_FREQ_052,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300515 .tuner_address = 0x61,
516 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800517};
518
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700519static struct tda1004x_config medion_cardbus = {
520 .demod_address = 0x08,
521 .invert = 1,
522 .invert_oclk = 0,
523 .xtal_freq = TDA10046_XTAL_16M,
524 .agc_config = TDA10046_AGC_IFO_AUTO_NEG,
525 .if_freq = TDA10046_FREQ_3613,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300526 .tuner_address = 0x61,
527 .request_firmware = philips_tda1004x_request_firmware
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700528};
529
Vadim Catana128fe952010-05-29 12:49:16 -0300530static struct tda1004x_config technotrend_budget_t3000_config = {
531 .demod_address = 0x8,
532 .invert = 1,
533 .invert_oclk = 0,
534 .xtal_freq = TDA10046_XTAL_4M,
535 .agc_config = TDA10046_AGC_DEFAULT,
536 .if_freq = TDA10046_FREQ_3617,
537 .tuner_address = 0x63,
538 .request_firmware = philips_tda1004x_request_firmware
539};
540
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300541/* ------------------------------------------------------------------
542 * tda 1004x based cards with philips silicon tuner
543 */
544
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300545static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable)
546{
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300547 struct tda1004x_state *state = fe->demodulator_priv;
548
549 u8 addr = state->config->i2c_gate;
550 static u8 tda8290_close[] = { 0x21, 0xc0};
551 static u8 tda8290_open[] = { 0x21, 0x80};
552 struct i2c_msg tda8290_msg = {.addr = addr,.flags = 0, .len = 2};
553 if (enable) {
554 tda8290_msg.buf = tda8290_close;
555 } else {
556 tda8290_msg.buf = tda8290_open;
557 }
Hartmut Hackmann06be3032007-04-27 12:31:15 -0300558 if (i2c_transfer(state->i2c, &tda8290_msg, 1) != 1) {
Trent Piephocf3c34c2007-03-07 18:19:48 -0300559 struct saa7134_dev *dev = fe->dvb->priv;
560 wprintk("could not access tda8290 I2C gate\n");
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300561 return -EIO;
562 }
563 msleep(20);
564 return 0;
565}
566
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300567static int philips_tda827x_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -0300568{
569 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300570 struct tda1004x_state *state = fe->demodulator_priv;
Michael Krufky8ce47da2007-04-27 12:31:14 -0300571
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300572 switch (state->config->antenna_switch) {
573 case 0: break;
574 case 1: dprintk("setting GPIO21 to 0 (TV antenna?)\n");
575 saa7134_set_gpio(dev, 21, 0);
576 break;
577 case 2: dprintk("setting GPIO21 to 1 (Radio antenna?)\n");
578 saa7134_set_gpio(dev, 21, 1);
579 break;
580 }
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300581 return 0;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800582}
583
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300584static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe)
585{
586 struct saa7134_dev *dev = fe->dvb->priv;
587 struct tda1004x_state *state = fe->demodulator_priv;
Michael Krufky8ce47da2007-04-27 12:31:14 -0300588
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300589 switch (state->config->antenna_switch) {
590 case 0: break;
591 case 1: dprintk("setting GPIO21 to 1 (Radio antenna?)\n");
592 saa7134_set_gpio(dev, 21, 1);
593 break;
594 case 2: dprintk("setting GPIO21 to 0 (TV antenna?)\n");
595 saa7134_set_gpio(dev, 21, 0);
596 break;
597 }
598 return 0;
599}
600
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -0300601static int configure_tda827x_fe(struct saa7134_dev *dev,
602 struct tda1004x_config *cdec_conf,
603 struct tda827x_config *tuner_conf)
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300604{
Steven Toth363c35f2008-10-11 11:05:50 -0300605 struct videobuf_dvb_frontend *fe0;
606
Darron Broad92abe9e2008-10-11 11:18:53 -0300607 /* Get the first frontend */
608 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
Steven Toth363c35f2008-10-11 11:05:50 -0300609
610 fe0->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap);
611 if (fe0->dvb.frontend) {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300612 if (cdec_conf->i2c_gate)
Steven Toth363c35f2008-10-11 11:05:50 -0300613 fe0->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
614 if (dvb_attach(tda827x_attach, fe0->dvb.frontend,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -0300615 cdec_conf->tuner_address,
616 &dev->i2c_adap, tuner_conf))
617 return 0;
618
619 wprintk("no tda827x tuner found at addr: %02x\n",
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300620 cdec_conf->tuner_address);
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300621 }
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -0300622 return -EINVAL;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300623}
624
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800625/* ------------------------------------------------------------------ */
Edgar Simo261f5082007-08-20 14:06:00 -0300626
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300627static struct tda827x_config tda827x_cfg_0 = {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300628 .init = philips_tda827x_tuner_init,
629 .sleep = philips_tda827x_tuner_sleep,
630 .config = 0,
631 .switch_addr = 0
632};
633
634static struct tda827x_config tda827x_cfg_1 = {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300635 .init = philips_tda827x_tuner_init,
636 .sleep = philips_tda827x_tuner_sleep,
637 .config = 1,
638 .switch_addr = 0x4b
639};
640
641static struct tda827x_config tda827x_cfg_2 = {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300642 .init = philips_tda827x_tuner_init,
643 .sleep = philips_tda827x_tuner_sleep,
644 .config = 2,
645 .switch_addr = 0x4b
646};
647
648static struct tda827x_config tda827x_cfg_2_sw42 = {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300649 .init = philips_tda827x_tuner_init,
650 .sleep = philips_tda827x_tuner_sleep,
651 .config = 2,
652 .switch_addr = 0x42
653};
654
655/* ------------------------------------------------------------------ */
656
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300657static struct tda1004x_config tda827x_lifeview_config = {
658 .demod_address = 0x08,
659 .invert = 1,
660 .invert_oclk = 0,
661 .xtal_freq = TDA10046_XTAL_16M,
662 .agc_config = TDA10046_AGC_TDA827X,
663 .gpio_config = TDA10046_GP11_I,
664 .if_freq = TDA10046_FREQ_045,
665 .tuner_address = 0x60,
666 .request_firmware = philips_tda1004x_request_firmware
667};
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800668
669static struct tda1004x_config philips_tiger_config = {
670 .demod_address = 0x08,
671 .invert = 1,
672 .invert_oclk = 0,
673 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300674 .agc_config = TDA10046_AGC_TDA827X,
675 .gpio_config = TDA10046_GP11_I,
Hartmut Hackmann550a9a52006-11-15 21:31:54 -0300676 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300677 .i2c_gate = 0x4b,
678 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300679 .antenna_switch= 1,
680 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann550a9a52006-11-15 21:31:54 -0300681};
Hartmut Hackmann550a9a52006-11-15 21:31:54 -0300682
683static struct tda1004x_config cinergy_ht_config = {
684 .demod_address = 0x08,
685 .invert = 1,
686 .invert_oclk = 0,
687 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300688 .agc_config = TDA10046_AGC_TDA827X,
689 .gpio_config = TDA10046_GP01_I,
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800690 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300691 .i2c_gate = 0x4b,
692 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300693 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800694};
695
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300696static struct tda1004x_config cinergy_ht_pci_config = {
697 .demod_address = 0x08,
698 .invert = 1,
699 .invert_oclk = 0,
700 .xtal_freq = TDA10046_XTAL_16M,
701 .agc_config = TDA10046_AGC_TDA827X,
702 .gpio_config = TDA10046_GP01_I,
703 .if_freq = TDA10046_FREQ_045,
704 .i2c_gate = 0x4b,
705 .tuner_address = 0x60,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300706 .request_firmware = philips_tda1004x_request_firmware
707};
708
709static struct tda1004x_config philips_tiger_s_config = {
710 .demod_address = 0x08,
711 .invert = 1,
712 .invert_oclk = 0,
713 .xtal_freq = TDA10046_XTAL_16M,
714 .agc_config = TDA10046_AGC_TDA827X,
715 .gpio_config = TDA10046_GP01_I,
716 .if_freq = TDA10046_FREQ_045,
717 .i2c_gate = 0x4b,
718 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300719 .antenna_switch= 1,
720 .request_firmware = philips_tda1004x_request_firmware
721};
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200722
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -0300723static struct tda1004x_config pinnacle_pctv_310i_config = {
724 .demod_address = 0x08,
725 .invert = 1,
726 .invert_oclk = 0,
727 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300728 .agc_config = TDA10046_AGC_TDA827X,
729 .gpio_config = TDA10046_GP11_I,
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -0300730 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300731 .i2c_gate = 0x4b,
732 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300733 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -0300734};
735
Thomas Gentyc6e53da2006-11-05 14:17:30 -0300736static struct tda1004x_config hauppauge_hvr_1110_config = {
737 .demod_address = 0x08,
738 .invert = 1,
739 .invert_oclk = 0,
740 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300741 .agc_config = TDA10046_AGC_TDA827X,
742 .gpio_config = TDA10046_GP11_I,
Thomas Gentyc6e53da2006-11-05 14:17:30 -0300743 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300744 .i2c_gate = 0x4b,
745 .tuner_address = 0x61,
746 .request_firmware = philips_tda1004x_request_firmware
Thomas Gentyc6e53da2006-11-05 14:17:30 -0300747};
748
Hartmut Hackmann83646812006-10-12 20:38:51 -0300749static struct tda1004x_config asus_p7131_dual_config = {
750 .demod_address = 0x08,
751 .invert = 1,
752 .invert_oclk = 0,
753 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300754 .agc_config = TDA10046_AGC_TDA827X,
755 .gpio_config = TDA10046_GP11_I,
Hartmut Hackmann83646812006-10-12 20:38:51 -0300756 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300757 .i2c_gate = 0x4b,
758 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300759 .antenna_switch= 2,
760 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann83646812006-10-12 20:38:51 -0300761};
762
Nico Sabbi420f32f2006-03-03 12:11:28 -0300763static struct tda1004x_config lifeview_trio_config = {
764 .demod_address = 0x09,
765 .invert = 1,
766 .invert_oclk = 0,
767 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300768 .agc_config = TDA10046_AGC_TDA827X,
769 .gpio_config = TDA10046_GP00_I,
Nico Sabbi420f32f2006-03-03 12:11:28 -0300770 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300771 .tuner_address = 0x60,
772 .request_firmware = philips_tda1004x_request_firmware
Nico Sabbi420f32f2006-03-03 12:11:28 -0300773};
774
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300775static struct tda1004x_config tevion_dvbt220rf_config = {
776 .demod_address = 0x08,
777 .invert = 1,
778 .invert_oclk = 0,
779 .xtal_freq = TDA10046_XTAL_16M,
780 .agc_config = TDA10046_AGC_TDA827X,
781 .gpio_config = TDA10046_GP11_I,
782 .if_freq = TDA10046_FREQ_045,
783 .tuner_address = 0x60,
784 .request_firmware = philips_tda1004x_request_firmware
785};
Nico Sabbi420f32f2006-03-03 12:11:28 -0300786
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300787static struct tda1004x_config md8800_dvbt_config = {
788 .demod_address = 0x08,
789 .invert = 1,
790 .invert_oclk = 0,
791 .xtal_freq = TDA10046_XTAL_16M,
792 .agc_config = TDA10046_AGC_TDA827X,
793 .gpio_config = TDA10046_GP01_I,
794 .if_freq = TDA10046_FREQ_045,
795 .i2c_gate = 0x4b,
796 .tuner_address = 0x60,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300797 .request_firmware = philips_tda1004x_request_firmware
798};
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200799
Hartmut Hackmanne06cea42007-03-13 20:58:29 -0300800static struct tda1004x_config asus_p7131_4871_config = {
801 .demod_address = 0x08,
802 .invert = 1,
803 .invert_oclk = 0,
804 .xtal_freq = TDA10046_XTAL_16M,
805 .agc_config = TDA10046_AGC_TDA827X,
806 .gpio_config = TDA10046_GP01_I,
807 .if_freq = TDA10046_FREQ_045,
808 .i2c_gate = 0x4b,
809 .tuner_address = 0x61,
Hartmut Hackmanne06cea42007-03-13 20:58:29 -0300810 .antenna_switch= 2,
811 .request_firmware = philips_tda1004x_request_firmware
812};
813
Hartmut Hackmannf3eec0c02007-03-14 20:33:55 -0300814static struct tda1004x_config asus_p7131_hybrid_lna_config = {
Hartmut Hackmanne06cea42007-03-13 20:58:29 -0300815 .demod_address = 0x08,
816 .invert = 1,
817 .invert_oclk = 0,
818 .xtal_freq = TDA10046_XTAL_16M,
819 .agc_config = TDA10046_AGC_TDA827X,
820 .gpio_config = TDA10046_GP11_I,
821 .if_freq = TDA10046_FREQ_045,
822 .i2c_gate = 0x4b,
823 .tuner_address = 0x61,
Hartmut Hackmanne06cea42007-03-13 20:58:29 -0300824 .antenna_switch= 2,
825 .request_firmware = philips_tda1004x_request_firmware
826};
Edgar Simo261f5082007-08-20 14:06:00 -0300827
Simon Farnsworthb39423a2007-05-01 10:01:20 -0300828static struct tda1004x_config kworld_dvb_t_210_config = {
829 .demod_address = 0x08,
830 .invert = 1,
831 .invert_oclk = 0,
832 .xtal_freq = TDA10046_XTAL_16M,
833 .agc_config = TDA10046_AGC_TDA827X,
834 .gpio_config = TDA10046_GP11_I,
835 .if_freq = TDA10046_FREQ_045,
836 .i2c_gate = 0x4b,
837 .tuner_address = 0x61,
Simon Farnsworthb39423a2007-05-01 10:01:20 -0300838 .antenna_switch= 1,
839 .request_firmware = philips_tda1004x_request_firmware
840};
Edgar Simo261f5082007-08-20 14:06:00 -0300841
Edgar Simod90d9f52007-08-20 14:14:50 -0300842static struct tda1004x_config avermedia_super_007_config = {
843 .demod_address = 0x08,
844 .invert = 1,
845 .invert_oclk = 0,
846 .xtal_freq = TDA10046_XTAL_16M,
847 .agc_config = TDA10046_AGC_TDA827X,
848 .gpio_config = TDA10046_GP01_I,
849 .if_freq = TDA10046_FREQ_045,
850 .i2c_gate = 0x4b,
851 .tuner_address = 0x60,
Edgar Simod90d9f52007-08-20 14:14:50 -0300852 .antenna_switch= 1,
853 .request_firmware = philips_tda1004x_request_firmware
854};
855
Hermann Pitton4ba24372008-01-20 19:27:51 -0300856static struct tda1004x_config twinhan_dtv_dvb_3056_config = {
857 .demod_address = 0x08,
858 .invert = 1,
859 .invert_oclk = 0,
860 .xtal_freq = TDA10046_XTAL_16M,
861 .agc_config = TDA10046_AGC_TDA827X,
862 .gpio_config = TDA10046_GP01_I,
863 .if_freq = TDA10046_FREQ_045,
864 .i2c_gate = 0x42,
865 .tuner_address = 0x61,
Hermann Pitton4ba24372008-01-20 19:27:51 -0300866 .antenna_switch = 1,
867 .request_firmware = philips_tda1004x_request_firmware
868};
869
hermann pitton301e9d62008-09-14 17:49:14 -0300870static struct tda1004x_config asus_tiger_3in1_config = {
871 .demod_address = 0x0b,
872 .invert = 1,
873 .invert_oclk = 0,
874 .xtal_freq = TDA10046_XTAL_16M,
875 .agc_config = TDA10046_AGC_TDA827X,
876 .gpio_config = TDA10046_GP11_I,
877 .if_freq = TDA10046_FREQ_045,
878 .i2c_gate = 0x4b,
879 .tuner_address = 0x61,
880 .antenna_switch = 1,
881 .request_firmware = philips_tda1004x_request_firmware
882};
883
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300884/* ------------------------------------------------------------------
885 * special case: this card uses saa713x GPIO22 for the mode switch
886 */
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200887
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300888static int ads_duo_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200889{
890 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300891 philips_tda827x_tuner_init(fe);
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200892 /* route TDA8275a AGC input to the channel decoder */
Hartmut Hackmann06be3032007-04-27 12:31:15 -0300893 saa7134_set_gpio(dev, 22, 1);
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200894 return 0;
895}
896
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300897static int ads_duo_tuner_sleep(struct dvb_frontend *fe)
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200898{
899 struct saa7134_dev *dev = fe->dvb->priv;
900 /* route TDA8275a AGC input to the analog IF chip*/
Hartmut Hackmann06be3032007-04-27 12:31:15 -0300901 saa7134_set_gpio(dev, 22, 0);
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300902 philips_tda827x_tuner_sleep(fe);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300903 return 0;
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200904}
905
Michael Krufky8ce47da2007-04-27 12:31:14 -0300906static struct tda827x_config ads_duo_cfg = {
Michael Krufky8ce47da2007-04-27 12:31:14 -0300907 .init = ads_duo_tuner_init,
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300908 .sleep = ads_duo_tuner_sleep,
909 .config = 0
Michael Krufky8ce47da2007-04-27 12:31:14 -0300910};
911
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200912static struct tda1004x_config ads_tech_duo_config = {
913 .demod_address = 0x08,
914 .invert = 1,
915 .invert_oclk = 0,
916 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300917 .agc_config = TDA10046_AGC_TDA827X,
918 .gpio_config = TDA10046_GP00_I,
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200919 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300920 .tuner_address = 0x61,
921 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200922};
923
Dmitri Belimov47aeba52008-12-23 03:53:03 -0300924static struct zl10353_config behold_h6_config = {
925 .demod_address = 0x1e>>1,
926 .no_tuner = 1,
927 .parallel_ts = 1,
Antti Palosaari5f77af92009-03-10 13:06:40 -0300928 .disable_i2c_gate_ctrl = 1,
Dmitri Belimov47aeba52008-12-23 03:53:03 -0300929};
930
Beholder Intl. Ltd. Dmitry Belimov29309922009-09-30 23:02:21 -0300931static struct xc5000_config behold_x7_tunerconfig = {
932 .i2c_address = 0xc2>>1,
933 .if_khz = 4560,
Devin Heitmueller2a0d0562009-09-30 23:04:39 -0300934 .radio_input = XC5000_RADIO_FM1,
Beholder Intl. Ltd. Dmitry Belimov29309922009-09-30 23:02:21 -0300935};
936
937static struct zl10353_config behold_x7_config = {
938 .demod_address = 0x1e>>1,
939 .if2 = 45600,
940 .no_tuner = 1,
941 .parallel_ts = 1,
942 .disable_i2c_gate_ctrl = 1,
943};
944
Carlos Corbachodbe87402011-06-25 10:24:28 -0300945static struct zl10353_config videomate_t750_zl10353_config = {
946 .demod_address = 0x0f,
947 .no_tuner = 1,
948 .parallel_ts = 1,
949 .disable_i2c_gate_ctrl = 1,
950};
951
952static struct qt1010_config videomate_t750_qt1010_config = {
953 .i2c_address = 0x62
954};
955
956
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300957/* ==================================================================
958 * tda10086 based DVB-S cards, helper functions
959 */
Hartmut Hackmann5eda2272006-08-07 14:03:32 -0300960
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -0300961static struct tda10086_config flydvbs = {
962 .demod_address = 0x0e,
963 .invert = 0,
Hartmut Hackmannea75baf2008-02-09 23:54:24 -0300964 .diseqc_tone = 0,
Hartmut Hackmann9a1b04e2008-04-09 23:07:11 -0300965 .xtal_freq = TDA10086_XTAL_16M,
966};
967
968static struct tda10086_config sd1878_4m = {
969 .demod_address = 0x0e,
970 .invert = 0,
971 .diseqc_tone = 0,
972 .xtal_freq = TDA10086_XTAL_4M,
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -0300973};
974
Hartmut Hackmann1b1cee32008-04-22 14:42:12 -0300975/* ------------------------------------------------------------------
976 * special case: lnb supply is connected to the gated i2c
977 */
978
979static int md8800_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
980{
981 int res = -EIO;
982 struct saa7134_dev *dev = fe->dvb->priv;
983 if (fe->ops.i2c_gate_ctrl) {
984 fe->ops.i2c_gate_ctrl(fe, 1);
985 if (dev->original_set_voltage)
986 res = dev->original_set_voltage(fe, voltage);
987 fe->ops.i2c_gate_ctrl(fe, 0);
988 }
989 return res;
990};
991
992static int md8800_set_high_voltage(struct dvb_frontend *fe, long arg)
993{
994 int res = -EIO;
995 struct saa7134_dev *dev = fe->dvb->priv;
996 if (fe->ops.i2c_gate_ctrl) {
997 fe->ops.i2c_gate_ctrl(fe, 1);
998 if (dev->original_set_high_voltage)
999 res = dev->original_set_high_voltage(fe, arg);
1000 fe->ops.i2c_gate_ctrl(fe, 0);
1001 }
1002 return res;
1003};
1004
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001005static int md8800_set_voltage2(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
1006{
1007 struct saa7134_dev *dev = fe->dvb->priv;
1008 u8 wbuf[2] = { 0x1f, 00 };
1009 u8 rbuf;
1010 struct i2c_msg msg[] = { { .addr = 0x08, .flags = 0, .buf = wbuf, .len = 1 },
1011 { .addr = 0x08, .flags = I2C_M_RD, .buf = &rbuf, .len = 1 } };
1012
1013 if (i2c_transfer(&dev->i2c_adap, msg, 2) != 2)
1014 return -EIO;
1015 /* NOTE: this assumes that gpo1 is used, it might be bit 5 (gpo2) */
1016 if (voltage == SEC_VOLTAGE_18)
1017 wbuf[1] = rbuf | 0x10;
1018 else
1019 wbuf[1] = rbuf & 0xef;
1020 msg[0].len = 2;
1021 i2c_transfer(&dev->i2c_adap, msg, 1);
1022 return 0;
1023}
1024
1025static int md8800_set_high_voltage2(struct dvb_frontend *fe, long arg)
1026{
1027 struct saa7134_dev *dev = fe->dvb->priv;
1028 wprintk("%s: sorry can't set high LNB supply voltage from here\n", __func__);
1029 return -EIO;
1030}
1031
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001032/* ==================================================================
1033 * nxt200x based ATSC cards, helper functions
1034 */
Hartmut Hackmann90e9df72005-11-08 21:38:42 -08001035
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001036static struct nxt200x_config avertvhda180 = {
1037 .demod_address = 0x0a,
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001038};
Andrew Burri3e1410a2006-02-27 00:08:23 -03001039
1040static struct nxt200x_config kworldatsc110 = {
1041 .demod_address = 0x0a,
Andrew Burri3e1410a2006-02-27 00:08:23 -03001042};
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001043
Matthias Schwarzott04574182009-02-24 12:35:16 -03001044/* ------------------------------------------------------------------ */
1045
1046static struct mt312_config avertv_a700_mt312 = {
1047 .demod_address = 0x0e,
1048 .voltage_inverted = 1,
1049};
1050
1051static struct zl10036_config avertv_a700_tuner = {
1052 .tuner_address = 0x60,
1053};
1054
Igor M. Liplianinecfcfec2009-08-13 21:42:21 -03001055static struct mt312_config zl10313_compro_s350_config = {
1056 .demod_address = 0x0e,
1057};
1058
Michael Krufky3abdedd2009-01-19 01:10:49 -03001059static struct lgdt3305_config hcw_lgdt3305_config = {
1060 .i2c_addr = 0x0e,
1061 .mpeg_mode = LGDT3305_MPEG_SERIAL,
1062 .tpclk_edge = LGDT3305_TPCLK_RISING_EDGE,
1063 .tpvalid_polarity = LGDT3305_TP_VALID_HIGH,
1064 .deny_i2c_rptr = 1,
1065 .spectral_inversion = 1,
1066 .qam_if_khz = 4000,
1067 .vsb_if_khz = 3250,
1068};
1069
Michael Krufky1bc7f512009-01-19 01:10:49 -03001070static struct tda10048_config hcw_tda10048_config = {
1071 .demod_address = 0x10 >> 1,
1072 .output_mode = TDA10048_SERIAL_OUTPUT,
1073 .fwbulkwritelen = TDA10048_BULKWRITE_200,
1074 .inversion = TDA10048_INVERSION_ON,
1075 .dtv6_if_freq_khz = TDA10048_IF_3300,
1076 .dtv7_if_freq_khz = TDA10048_IF_3500,
1077 .dtv8_if_freq_khz = TDA10048_IF_4000,
1078 .clk_freq_khz = TDA10048_CLK_16000,
1079 .disable_gate_access = 1,
1080};
1081
Michael Krufky3abdedd2009-01-19 01:10:49 -03001082static struct tda18271_std_map hauppauge_tda18271_std_map = {
1083 .atsc_6 = { .if_freq = 3250, .agc_mode = 3, .std = 4,
1084 .if_lvl = 1, .rfagc_top = 0x58, },
1085 .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 5,
1086 .if_lvl = 1, .rfagc_top = 0x58, },
1087};
1088
1089static struct tda18271_config hcw_tda18271_config = {
1090 .std_map = &hauppauge_tda18271_std_map,
1091 .gate = TDA18271_GATE_ANALOG,
1092 .config = 3,
Michael Krufky542cb052009-08-29 17:45:48 -03001093 .output_opt = TDA18271_OUTPUT_LT_OFF,
Michael Krufky3abdedd2009-01-19 01:10:49 -03001094};
1095
1096static struct tda829x_config tda829x_no_probe = {
1097 .probe_tuner = TDA829X_DONT_PROBE,
1098};
1099
Henk Vergonet6c119ff2009-09-18 20:44:37 -03001100static struct tda10048_config zolid_tda10048_config = {
1101 .demod_address = 0x10 >> 1,
1102 .output_mode = TDA10048_PARALLEL_OUTPUT,
1103 .fwbulkwritelen = TDA10048_BULKWRITE_200,
1104 .inversion = TDA10048_INVERSION_ON,
1105 .dtv6_if_freq_khz = TDA10048_IF_3300,
1106 .dtv7_if_freq_khz = TDA10048_IF_3500,
1107 .dtv8_if_freq_khz = TDA10048_IF_4000,
1108 .clk_freq_khz = TDA10048_CLK_16000,
1109 .disable_gate_access = 1,
1110};
1111
1112static struct tda18271_config zolid_tda18271_config = {
1113 .gate = TDA18271_GATE_ANALOG,
1114};
1115
Michael Krufky184e7692009-06-05 04:28:28 -03001116static struct tda10048_config dtv1000s_tda10048_config = {
1117 .demod_address = 0x10 >> 1,
1118 .output_mode = TDA10048_PARALLEL_OUTPUT,
1119 .fwbulkwritelen = TDA10048_BULKWRITE_200,
1120 .inversion = TDA10048_INVERSION_ON,
1121 .dtv6_if_freq_khz = TDA10048_IF_3300,
1122 .dtv7_if_freq_khz = TDA10048_IF_3800,
1123 .dtv8_if_freq_khz = TDA10048_IF_4300,
1124 .clk_freq_khz = TDA10048_CLK_16000,
1125 .disable_gate_access = 1,
1126};
1127
1128static struct tda18271_std_map dtv1000s_tda18271_std_map = {
1129 .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4,
1130 .if_lvl = 1, .rfagc_top = 0x37, },
1131 .dvbt_7 = { .if_freq = 3800, .agc_mode = 3, .std = 5,
1132 .if_lvl = 1, .rfagc_top = 0x37, },
1133 .dvbt_8 = { .if_freq = 4300, .agc_mode = 3, .std = 6,
1134 .if_lvl = 1, .rfagc_top = 0x37, },
1135};
1136
1137static struct tda18271_config dtv1000s_tda18271_config = {
1138 .std_map = &dtv1000s_tda18271_std_map,
1139 .gate = TDA18271_GATE_ANALOG,
1140};
1141
Timothy Leece027042011-03-25 15:00:33 -03001142static struct lgs8gxx_config prohdtv_pro2_lgs8g75_config = {
1143 .prod = LGS8GXX_PROD_LGS8G75,
1144 .demod_address = 0x1d,
1145 .serial_ts = 0,
1146 .ts_clk_pol = 1,
1147 .ts_clk_gated = 0,
1148 .if_clk_freq = 30400, /* 30.4 MHz */
1149 .if_freq = 4000, /* 4.00 MHz */
1150 .if_neg_center = 0,
1151 .ext_adc = 0,
1152 .adc_signed = 1,
1153 .adc_vpp = 3, /* 2.0 Vpp */
1154 .if_neg_edge = 1,
1155};
1156
1157static struct tda18271_config prohdtv_pro2_tda18271_config = {
1158 .gate = TDA18271_GATE_ANALOG,
1159 .output_opt = TDA18271_OUTPUT_LT_OFF,
1160};
1161
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001162/* ==================================================================
1163 * Core code
1164 */
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001165
Linus Torvalds1da177e2005-04-16 15:20:36 -07001166static int dvb_init(struct saa7134_dev *dev)
1167{
Hartmut Hackmann1c4f76a2007-04-27 12:31:16 -03001168 int ret;
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001169 int attach_xc3028 = 0;
Steven Toth363c35f2008-10-11 11:05:50 -03001170 struct videobuf_dvb_frontend *fe0;
1171
Darron Broadf972e0bd2008-10-11 11:24:30 -03001172 /* FIXME: add support for multi-frontend */
1173 mutex_init(&dev->frontends.lock);
Darron Broad7bdf84f2008-10-15 13:43:41 -03001174 INIT_LIST_HEAD(&dev->frontends.felist);
Darron Broadf972e0bd2008-10-11 11:24:30 -03001175
1176 printk(KERN_INFO "%s() allocating 1 frontend\n", __func__);
Darron Broadf3f741e2008-11-11 08:50:02 -03001177 fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, 1);
1178 if (!fe0) {
Darron Broadf972e0bd2008-10-11 11:24:30 -03001179 printk(KERN_ERR "%s() failed to alloc\n", __func__);
1180 return -ENOMEM;
1181 }
1182
Linus Torvalds1da177e2005-04-16 15:20:36 -07001183 /* init struct videobuf_dvb */
1184 dev->ts.nr_bufs = 32;
1185 dev->ts.nr_packets = 32*4;
Steven Toth363c35f2008-10-11 11:05:50 -03001186 fe0->dvb.name = dev->name;
1187 videobuf_queue_sg_init(&fe0->dvb.dvbq, &saa7134_ts_qops,
Guennadi Liakhovetski07051352008-04-22 14:42:13 -03001188 &dev->pci->dev, &dev->slock,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001189 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1190 V4L2_FIELD_ALTERNATE,
1191 sizeof(struct saa7134_buf),
Hans Verkuil08bff032010-09-20 17:39:46 -03001192 dev, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001193
1194 switch (dev->board) {
1195 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
Trent Piephocf3c34c2007-03-07 18:19:48 -03001196 dprintk("pinnacle 300i dvb setup\n");
Steven Toth363c35f2008-10-11 11:05:50 -03001197 fe0->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001198 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001199 if (fe0->dvb.frontend) {
1200 fe0->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params;
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001201 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001202 break;
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -02001203 case SAA7134_BOARD_AVERMEDIA_777:
Petr Baudis515c2082006-09-26 16:53:53 -03001204 case SAA7134_BOARD_AVERMEDIA_A16AR:
Trent Piephocf3c34c2007-03-07 18:19:48 -03001205 dprintk("avertv 777 dvb setup\n");
Steven Toth363c35f2008-10-11 11:05:50 -03001206 fe0->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001207 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001208 if (fe0->dvb.frontend) {
1209 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Michael Krufkyfb147e92008-04-22 14:46:16 -03001210 &dev->i2c_adap, 0x61,
1211 TUNER_PHILIPS_TD1316);
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001212 }
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -02001213 break;
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -03001214 case SAA7134_BOARD_AVERMEDIA_A16D:
Tim Farrington6e501a32008-06-15 13:33:42 -03001215 dprintk("AverMedia A16D dvb setup\n");
Steven Toth363c35f2008-10-11 11:05:50 -03001216 fe0->dvb.frontend = dvb_attach(mt352_attach,
Tim Farrington6e501a32008-06-15 13:33:42 -03001217 &avermedia_xc3028_mt352_dev,
1218 &dev->i2c_adap);
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -03001219 attach_xc3028 = 1;
1220 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001221 case SAA7134_BOARD_MD7134:
Steven Toth363c35f2008-10-11 11:05:50 -03001222 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001223 &medion_cardbus,
1224 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001225 if (fe0->dvb.frontend) {
1226 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Michael Krufkycb89cd32008-04-22 14:46:16 -03001227 &dev->i2c_adap, medion_cardbus.tuner_address,
1228 TUNER_PHILIPS_FMD1216ME_MK3);
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001229 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001230 break;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001231 case SAA7134_BOARD_PHILIPS_TOUGH:
Steven Toth363c35f2008-10-11 11:05:50 -03001232 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001233 &philips_tu1216_60_config,
1234 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001235 if (fe0->dvb.frontend) {
1236 fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init;
1237 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set;
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001238 }
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001239 break;
1240 case SAA7134_BOARD_FLYDVBTDUO:
Peter Missel10b7a902006-01-23 17:11:06 -02001241 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001242 if (configure_tda827x_fe(dev, &tda827x_lifeview_config,
1243 &tda827x_cfg_0) < 0)
1244 goto dettach_frontend;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001245 break;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001246 case SAA7134_BOARD_PHILIPS_EUROPA:
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001247 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
Danny Woode3c6e1a2009-09-20 12:14:21 -03001248 case SAA7134_BOARD_ASUS_EUROPA_HYBRID:
Steven Toth363c35f2008-10-11 11:05:50 -03001249 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001250 &philips_europa_config,
1251 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001252 if (fe0->dvb.frontend) {
1253 dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep;
1254 fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
1255 fe0->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init;
1256 fe0->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep;
1257 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001258 }
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001259 break;
Vadim Catana128fe952010-05-29 12:49:16 -03001260 case SAA7134_BOARD_TECHNOTREND_BUDGET_T3000:
1261 fe0->dvb.frontend = dvb_attach(tda10046_attach,
1262 &technotrend_budget_t3000_config,
1263 &dev->i2c_adap);
1264 if (fe0->dvb.frontend) {
1265 dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep;
1266 fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
1267 fe0->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init;
1268 fe0->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep;
1269 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;
1270 }
1271 break;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001272 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
Steven Toth363c35f2008-10-11 11:05:50 -03001273 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001274 &philips_tu1216_61_config,
1275 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001276 if (fe0->dvb.frontend) {
1277 fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init;
1278 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set;
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001279 }
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001280 break;
Simon Farnsworthb39423a2007-05-01 10:01:20 -03001281 case SAA7134_BOARD_KWORLD_DVBT_210:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001282 if (configure_tda827x_fe(dev, &kworld_dvb_t_210_config,
1283 &tda827x_cfg_2) < 0)
1284 goto dettach_frontend;
Simon Farnsworthb39423a2007-05-01 10:01:20 -03001285 break;
Michael Krufky0e316ec2009-08-03 16:51:33 -03001286 case SAA7134_BOARD_HAUPPAUGE_HVR1120:
Michael Krufky1bc7f512009-01-19 01:10:49 -03001287 fe0->dvb.frontend = dvb_attach(tda10048_attach,
1288 &hcw_tda10048_config,
1289 &dev->i2c_adap);
1290 if (fe0->dvb.frontend != NULL) {
1291 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1292 &dev->i2c_adap, 0x4b,
1293 &tda829x_no_probe);
1294 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1295 0x60, &dev->i2c_adap,
1296 &hcw_tda18271_config);
1297 }
1298 break;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -08001299 case SAA7134_BOARD_PHILIPS_TIGER:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001300 if (configure_tda827x_fe(dev, &philips_tiger_config,
1301 &tda827x_cfg_0) < 0)
1302 goto dettach_frontend;
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -03001303 break;
1304 case SAA7134_BOARD_PINNACLE_PCTV_310i:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001305 if (configure_tda827x_fe(dev, &pinnacle_pctv_310i_config,
1306 &tda827x_cfg_1) < 0)
1307 goto dettach_frontend;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -08001308 break;
Thomas Gentyc6e53da2006-11-05 14:17:30 -03001309 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001310 if (configure_tda827x_fe(dev, &hauppauge_hvr_1110_config,
1311 &tda827x_cfg_1) < 0)
1312 goto dettach_frontend;
Thomas Gentyc6e53da2006-11-05 14:17:30 -03001313 break;
Michael Krufkyb5f05062009-08-03 16:51:33 -03001314 case SAA7134_BOARD_HAUPPAUGE_HVR1150:
Michael Krufky3abdedd2009-01-19 01:10:49 -03001315 fe0->dvb.frontend = dvb_attach(lgdt3305_attach,
1316 &hcw_lgdt3305_config,
1317 &dev->i2c_adap);
1318 if (fe0->dvb.frontend) {
1319 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1320 &dev->i2c_adap, 0x4b,
1321 &tda829x_no_probe);
1322 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1323 0x60, &dev->i2c_adap,
1324 &hcw_tda18271_config);
1325 }
1326 break;
Hartmut Hackmannd4b0aba2005-11-08 21:38:44 -08001327 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001328 if (configure_tda827x_fe(dev, &asus_p7131_dual_config,
1329 &tda827x_cfg_0) < 0)
1330 goto dettach_frontend;
Hartmut Hackmannd4b0aba2005-11-08 21:38:44 -08001331 break;
Giampiero Giancipoli3d8466e2006-02-07 06:49:09 -02001332 case SAA7134_BOARD_FLYDVBT_LR301:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001333 if (configure_tda827x_fe(dev, &tda827x_lifeview_config,
1334 &tda827x_cfg_0) < 0)
1335 goto dettach_frontend;
Giampiero Giancipoli3d8466e2006-02-07 06:49:09 -02001336 break;
Darron Broad92abe9e2008-10-11 11:18:53 -03001337 case SAA7134_BOARD_FLYDVB_TRIO:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001338 if (!use_frontend) { /* terrestrial */
1339 if (configure_tda827x_fe(dev, &lifeview_trio_config,
1340 &tda827x_cfg_0) < 0)
1341 goto dettach_frontend;
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -03001342 } else { /* satellite */
Steven Toth363c35f2008-10-11 11:05:50 -03001343 fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
1344 if (fe0->dvb.frontend) {
1345 if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x63,
Nico Sabbi1f683cd2006-11-15 22:06:56 -03001346 &dev->i2c_adap, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001347 wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001348 goto dettach_frontend;
Nico Sabbi1f683cd2006-11-15 22:06:56 -03001349 }
Steven Toth363c35f2008-10-11 11:05:50 -03001350 if (dvb_attach(isl6421_attach, fe0->dvb.frontend, &dev->i2c_adap,
Nico Sabbi1f683cd2006-11-15 22:06:56 -03001351 0x08, 0, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001352 wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001353 goto dettach_frontend;
Nico Sabbi1f683cd2006-11-15 22:06:56 -03001354 }
1355 }
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001356 }
Nico Sabbi420f32f2006-03-03 12:11:28 -03001357 break;
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -02001358 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
Hartmut Hackmannd95b8942006-03-27 19:39:30 -03001359 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS:
Steven Toth363c35f2008-10-11 11:05:50 -03001360 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001361 &ads_tech_duo_config,
1362 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001363 if (fe0->dvb.frontend) {
1364 if (dvb_attach(tda827x_attach,fe0->dvb.frontend,
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -03001365 ads_tech_duo_config.tuner_address, &dev->i2c_adap,
1366 &ads_duo_cfg) == NULL) {
Trent Piephocf3c34c2007-03-07 18:19:48 -03001367 wprintk("no tda827x tuner found at addr: %02x\n",
Hartmut Hackmannede22002007-04-27 12:31:32 -03001368 ads_tech_duo_config.tuner_address);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001369 goto dettach_frontend;
Hartmut Hackmannede22002007-04-27 12:31:32 -03001370 }
Mauro Carvalho Chehabbc36ec72008-06-14 10:44:04 -03001371 } else
1372 wprintk("failed to attach tda10046\n");
Hartmut Hackmannd95b8942006-03-27 19:39:30 -03001373 break;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001374 case SAA7134_BOARD_TEVION_DVBT_220RF:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001375 if (configure_tda827x_fe(dev, &tevion_dvbt220rf_config,
1376 &tda827x_cfg_0) < 0)
1377 goto dettach_frontend;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001378 break;
Hartmut Hackmann5eda2272006-08-07 14:03:32 -03001379 case SAA7134_BOARD_MEDION_MD8800_QUADRO:
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001380 if (!use_frontend) { /* terrestrial */
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001381 if (configure_tda827x_fe(dev, &md8800_dvbt_config,
1382 &tda827x_cfg_0) < 0)
1383 goto dettach_frontend;
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001384 } else { /* satellite */
Steven Toth363c35f2008-10-11 11:05:50 -03001385 fe0->dvb.frontend = dvb_attach(tda10086_attach,
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001386 &flydvbs, &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001387 if (fe0->dvb.frontend) {
1388 struct dvb_frontend *fe = fe0->dvb.frontend;
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001389 u8 dev_id = dev->eedata[2];
1390 u8 data = 0xc4;
1391 struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1};
1392
Steven Toth363c35f2008-10-11 11:05:50 -03001393 if (dvb_attach(tda826x_attach, fe0->dvb.frontend,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001394 0x60, &dev->i2c_adap, 0) == NULL) {
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001395 wprintk("%s: Medion Quadro, no tda826x "
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001396 "found !\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001397 goto dettach_frontend;
1398 }
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001399 if (dev_id != 0x08) {
1400 /* we need to open the i2c gate (we know it exists) */
1401 fe->ops.i2c_gate_ctrl(fe, 1);
1402 if (dvb_attach(isl6405_attach, fe,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001403 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001404 wprintk("%s: Medion Quadro, no ISL6405 "
1405 "found !\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001406 goto dettach_frontend;
1407 }
Hartmut Hackmanne9c1ac92008-04-22 14:46:10 -03001408 if (dev_id == 0x07) {
1409 /* fire up the 2nd section of the LNB supply since
1410 we can't do this from the other section */
1411 msg.buf = &data;
1412 i2c_transfer(&dev->i2c_adap, &msg, 1);
1413 }
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001414 fe->ops.i2c_gate_ctrl(fe, 0);
1415 dev->original_set_voltage = fe->ops.set_voltage;
1416 fe->ops.set_voltage = md8800_set_voltage;
1417 dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;
1418 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;
1419 } else {
1420 fe->ops.set_voltage = md8800_set_voltage2;
1421 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage2;
1422 }
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001423 }
1424 }
Hartmut Hackmann5eda2272006-08-07 14:03:32 -03001425 break;
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001426 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
Steven Toth363c35f2008-10-11 11:05:50 -03001427 fe0->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001428 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001429 if (fe0->dvb.frontend)
1430 dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x61,
Michael Krufky47a99912007-06-12 16:10:51 -03001431 NULL, DVB_PLL_TDHU2);
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001432 break;
Adam Gloverf689d902008-05-06 03:20:27 -03001433 case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI:
Andrew Burri3e1410a2006-02-27 00:08:23 -03001434 case SAA7134_BOARD_KWORLD_ATSC110:
Steven Toth363c35f2008-10-11 11:05:50 -03001435 fe0->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001436 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001437 if (fe0->dvb.frontend)
1438 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Michael Krufky62ff817a2008-04-22 14:46:17 -03001439 &dev->i2c_adap, 0x61,
1440 TUNER_PHILIPS_TUV1236D);
Andrew Burri3e1410a2006-02-27 00:08:23 -03001441 break;
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -03001442 case SAA7134_BOARD_FLYDVBS_LR300:
Steven Toth363c35f2008-10-11 11:05:50 -03001443 fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001444 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001445 if (fe0->dvb.frontend) {
1446 if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001447 &dev->i2c_adap, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001448 wprintk("%s: No tda826x found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001449 goto dettach_frontend;
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -03001450 }
Steven Toth363c35f2008-10-11 11:05:50 -03001451 if (dvb_attach(isl6421_attach, fe0->dvb.frontend,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001452 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001453 wprintk("%s: No ISL6421 found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001454 goto dettach_frontend;
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -03001455 }
1456 }
1457 break;
Hartmut Hackmanncf146ca2006-10-02 20:49:24 -03001458 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID:
Steven Toth363c35f2008-10-11 11:05:50 -03001459 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Matthias Schwarzott0e8f4cc2008-01-28 12:01:11 -03001460 &medion_cardbus,
1461 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001462 if (fe0->dvb.frontend) {
1463 dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep;
1464 fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
Trent Piephob7754d72007-05-08 18:05:16 -03001465
Steven Toth363c35f2008-10-11 11:05:50 -03001466 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Michael Krufkycb89cd32008-04-22 14:46:16 -03001467 &dev->i2c_adap, medion_cardbus.tuner_address,
1468 TUNER_PHILIPS_FMD1216ME_MK3);
Hartmut Hackmanncf146ca2006-10-02 20:49:24 -03001469 }
1470 break;
Hartmut Hackmanncbb94522006-10-30 20:00:16 -03001471 case SAA7134_BOARD_VIDEOMATE_DVBT_200A:
Steven Toth363c35f2008-10-11 11:05:50 -03001472 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Hartmut Hackmanncbb94522006-10-30 20:00:16 -03001473 &philips_europa_config,
1474 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001475 if (fe0->dvb.frontend) {
1476 fe0->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init;
1477 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;
Hartmut Hackmanncbb94522006-10-30 20:00:16 -03001478 }
1479 break;
Hartmut Hackmann550a9a52006-11-15 21:31:54 -03001480 case SAA7134_BOARD_CINERGY_HT_PCMCIA:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001481 if (configure_tda827x_fe(dev, &cinergy_ht_config,
1482 &tda827x_cfg_0) < 0)
1483 goto dettach_frontend;
Hartmut Hackmann550a9a52006-11-15 21:31:54 -03001484 break;
Michael Krufky9de271e2007-01-16 18:36:40 -03001485 case SAA7134_BOARD_CINERGY_HT_PCI:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001486 if (configure_tda827x_fe(dev, &cinergy_ht_pci_config,
1487 &tda827x_cfg_0) < 0)
1488 goto dettach_frontend;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001489 break;
1490 case SAA7134_BOARD_PHILIPS_TIGER_S:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001491 if (configure_tda827x_fe(dev, &philips_tiger_s_config,
1492 &tda827x_cfg_2) < 0)
1493 goto dettach_frontend;
Michael Krufky9de271e2007-01-16 18:36:40 -03001494 break;
Hartmut Hackmanne06cea42007-03-13 20:58:29 -03001495 case SAA7134_BOARD_ASUS_P7131_4871:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001496 if (configure_tda827x_fe(dev, &asus_p7131_4871_config,
1497 &tda827x_cfg_2) < 0)
1498 goto dettach_frontend;
Hartmut Hackmanne06cea42007-03-13 20:58:29 -03001499 break;
Hartmut Hackmannf3eec0c02007-03-14 20:33:55 -03001500 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001501 if (configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config,
1502 &tda827x_cfg_2) < 0)
1503 goto dettach_frontend;
Hartmut Hackmanne06cea42007-03-13 20:58:29 -03001504 break;
Edgar Simod90d9f52007-08-20 14:14:50 -03001505 case SAA7134_BOARD_AVERMEDIA_SUPER_007:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001506 if (configure_tda827x_fe(dev, &avermedia_super_007_config,
1507 &tda827x_cfg_0) < 0)
1508 goto dettach_frontend;
Edgar Simod90d9f52007-08-20 14:14:50 -03001509 break;
Hermann Pitton4ba24372008-01-20 19:27:51 -03001510 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001511 if (configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config,
1512 &tda827x_cfg_2_sw42) < 0)
1513 goto dettach_frontend;
Hermann Pitton4ba24372008-01-20 19:27:51 -03001514 break;
Hartmut Hackmann6ab465a2008-04-22 14:42:11 -03001515 case SAA7134_BOARD_PHILIPS_SNAKE:
Steven Toth363c35f2008-10-11 11:05:50 -03001516 fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
Hartmut Hackmann6ab465a2008-04-22 14:42:11 -03001517 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001518 if (fe0->dvb.frontend) {
1519 if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001520 &dev->i2c_adap, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001521 wprintk("%s: No tda826x found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001522 goto dettach_frontend;
1523 }
Steven Toth363c35f2008-10-11 11:05:50 -03001524 if (dvb_attach(lnbp21_attach, fe0->dvb.frontend,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001525 &dev->i2c_adap, 0, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001526 wprintk("%s: No lnbp21 found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001527 goto dettach_frontend;
1528 }
Hartmut Hackmann6ab465a2008-04-22 14:42:11 -03001529 }
1530 break;
Hermann Pitton7b5b3f12008-04-22 14:42:12 -03001531 case SAA7134_BOARD_CREATIX_CTX953:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001532 if (configure_tda827x_fe(dev, &md8800_dvbt_config,
1533 &tda827x_cfg_0) < 0)
1534 goto dettach_frontend;
Hermann Pitton7b5b3f12008-04-22 14:42:12 -03001535 break;
Russell Kliese6a6179b62008-04-22 14:42:12 -03001536 case SAA7134_BOARD_MSI_TVANYWHERE_AD11:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001537 if (configure_tda827x_fe(dev, &philips_tiger_s_config,
1538 &tda827x_cfg_2) < 0)
1539 goto dettach_frontend;
Russell Kliese6a6179b62008-04-22 14:42:12 -03001540 break;
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001541 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
Tim Farrington6e501a32008-06-15 13:33:42 -03001542 dprintk("AverMedia E506R dvb setup\n");
1543 saa7134_set_gpio(dev, 25, 0);
1544 msleep(10);
1545 saa7134_set_gpio(dev, 25, 1);
Steven Toth363c35f2008-10-11 11:05:50 -03001546 fe0->dvb.frontend = dvb_attach(mt352_attach,
Tim Farrington6e501a32008-06-15 13:33:42 -03001547 &avermedia_xc3028_mt352_dev,
1548 &dev->i2c_adap);
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001549 attach_xc3028 = 1;
Massimo Piccionie2fc00c2008-07-11 13:48:02 -03001550 break;
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001551 case SAA7134_BOARD_MD7134_BRIDGE_2:
Steven Toth363c35f2008-10-11 11:05:50 -03001552 fe0->dvb.frontend = dvb_attach(tda10086_attach,
Hartmut Hackmann9a1b04e2008-04-09 23:07:11 -03001553 &sd1878_4m, &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001554 if (fe0->dvb.frontend) {
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001555 struct dvb_frontend *fe;
Steven Toth363c35f2008-10-11 11:05:50 -03001556 if (dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001557 &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) {
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001558 wprintk("%s: MD7134 DVB-S, no SD1878 "
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001559 "found !\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001560 goto dettach_frontend;
1561 }
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001562 /* we need to open the i2c gate (we know it exists) */
Steven Toth363c35f2008-10-11 11:05:50 -03001563 fe = fe0->dvb.frontend;
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001564 fe->ops.i2c_gate_ctrl(fe, 1);
1565 if (dvb_attach(isl6405_attach, fe,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001566 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001567 wprintk("%s: MD7134 DVB-S, no ISL6405 "
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001568 "found !\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001569 goto dettach_frontend;
1570 }
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001571 fe->ops.i2c_gate_ctrl(fe, 0);
1572 dev->original_set_voltage = fe->ops.set_voltage;
1573 fe->ops.set_voltage = md8800_set_voltage;
1574 dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;
1575 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;
1576 }
1577 break;
Massimo Piccionie2fc00c2008-07-11 13:48:02 -03001578 case SAA7134_BOARD_AVERMEDIA_M103:
1579 saa7134_set_gpio(dev, 25, 0);
1580 msleep(10);
1581 saa7134_set_gpio(dev, 25, 1);
Steven Toth363c35f2008-10-11 11:05:50 -03001582 fe0->dvb.frontend = dvb_attach(mt352_attach,
Massimo Piccionie2fc00c2008-07-11 13:48:02 -03001583 &avermedia_xc3028_mt352_dev,
1584 &dev->i2c_adap);
1585 attach_xc3028 = 1;
1586 break;
hermann pitton301e9d62008-09-14 17:49:14 -03001587 case SAA7134_BOARD_ASUSTeK_TIGER_3IN1:
1588 if (!use_frontend) { /* terrestrial */
1589 if (configure_tda827x_fe(dev, &asus_tiger_3in1_config,
1590 &tda827x_cfg_2) < 0)
1591 goto dettach_frontend;
1592 } else { /* satellite */
Steven Toth363c35f2008-10-11 11:05:50 -03001593 fe0->dvb.frontend = dvb_attach(tda10086_attach,
hermann pitton301e9d62008-09-14 17:49:14 -03001594 &flydvbs, &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001595 if (fe0->dvb.frontend) {
hermann pitton301e9d62008-09-14 17:49:14 -03001596 if (dvb_attach(tda826x_attach,
Steven Toth363c35f2008-10-11 11:05:50 -03001597 fe0->dvb.frontend, 0x60,
hermann pitton301e9d62008-09-14 17:49:14 -03001598 &dev->i2c_adap, 0) == NULL) {
1599 wprintk("%s: Asus Tiger 3in1, no "
1600 "tda826x found!\n", __func__);
1601 goto dettach_frontend;
1602 }
Steven Toth363c35f2008-10-11 11:05:50 -03001603 if (dvb_attach(lnbp21_attach, fe0->dvb.frontend,
hermann pitton301e9d62008-09-14 17:49:14 -03001604 &dev->i2c_adap, 0, 0) == NULL) {
1605 wprintk("%s: Asus Tiger 3in1, no lnbp21"
1606 " found!\n", __func__);
1607 goto dettach_frontend;
1608 }
1609 }
1610 }
1611 break;
Hermann Pitton028165a2008-10-04 21:37:36 -03001612 case SAA7134_BOARD_ASUSTeK_TIGER:
1613 if (configure_tda827x_fe(dev, &philips_tiger_config,
1614 &tda827x_cfg_0) < 0)
1615 goto dettach_frontend;
1616 break;
Dmitri Belimov47aeba52008-12-23 03:53:03 -03001617 case SAA7134_BOARD_BEHOLD_H6:
Mauro Carvalho Chehabb0c4be82008-12-30 19:10:09 -03001618 fe0->dvb.frontend = dvb_attach(zl10353_attach,
Dmitri Belimov47aeba52008-12-23 03:53:03 -03001619 &behold_h6_config,
1620 &dev->i2c_adap);
Mauro Carvalho Chehabb0c4be82008-12-30 19:10:09 -03001621 if (fe0->dvb.frontend) {
1622 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Dmitri Belimov47aeba52008-12-23 03:53:03 -03001623 &dev->i2c_adap, 0x61,
Beholder Intl. Ltd. Dmitry Belimov4786dd62009-08-04 20:07:42 -03001624 TUNER_PHILIPS_FMD1216MEX_MK3);
Dmitri Belimov47aeba52008-12-23 03:53:03 -03001625 }
1626 break;
Beholder Intl. Ltd. Dmitry Belimov29309922009-09-30 23:02:21 -03001627 case SAA7134_BOARD_BEHOLD_X7:
1628 fe0->dvb.frontend = dvb_attach(zl10353_attach,
1629 &behold_x7_config,
1630 &dev->i2c_adap);
1631 if (fe0->dvb.frontend) {
1632 dvb_attach(xc5000_attach, fe0->dvb.frontend,
1633 &dev->i2c_adap, &behold_x7_tunerconfig);
1634 }
1635 break;
Dmitri Belimov0faa2ed2010-04-06 01:00:05 -03001636 case SAA7134_BOARD_BEHOLD_H7:
1637 fe0->dvb.frontend = dvb_attach(zl10353_attach,
1638 &behold_x7_config,
1639 &dev->i2c_adap);
1640 if (fe0->dvb.frontend) {
1641 dvb_attach(xc5000_attach, fe0->dvb.frontend,
1642 &dev->i2c_adap, &behold_x7_tunerconfig);
1643 }
1644 break;
Matthias Schwarzott04574182009-02-24 12:35:16 -03001645 case SAA7134_BOARD_AVERMEDIA_A700_PRO:
1646 case SAA7134_BOARD_AVERMEDIA_A700_HYBRID:
1647 /* Zarlink ZL10313 */
1648 fe0->dvb.frontend = dvb_attach(mt312_attach,
1649 &avertv_a700_mt312, &dev->i2c_adap);
1650 if (fe0->dvb.frontend) {
1651 if (dvb_attach(zl10036_attach, fe0->dvb.frontend,
1652 &avertv_a700_tuner, &dev->i2c_adap) == NULL) {
1653 wprintk("%s: No zl10036 found!\n",
1654 __func__);
1655 }
1656 }
1657 break;
Igor M. Liplianinecfcfec2009-08-13 21:42:21 -03001658 case SAA7134_BOARD_VIDEOMATE_S350:
1659 fe0->dvb.frontend = dvb_attach(mt312_attach,
1660 &zl10313_compro_s350_config, &dev->i2c_adap);
1661 if (fe0->dvb.frontend)
1662 if (dvb_attach(zl10039_attach, fe0->dvb.frontend,
1663 0x60, &dev->i2c_adap) == NULL)
1664 wprintk("%s: No zl10039 found!\n",
1665 __func__);
1666
1667 break;
Carlos Corbachodbe87402011-06-25 10:24:28 -03001668 case SAA7134_BOARD_VIDEOMATE_T750:
1669 fe0->dvb.frontend = dvb_attach(zl10353_attach,
1670 &videomate_t750_zl10353_config,
1671 &dev->i2c_adap);
1672 if (fe0->dvb.frontend != NULL) {
1673 if (dvb_attach(qt1010_attach,
1674 fe0->dvb.frontend,
1675 &dev->i2c_adap,
1676 &videomate_t750_qt1010_config) == NULL)
1677 wprintk("error attaching QT1010\n");
1678 }
1679 break;
Henk Vergonet6c119ff2009-09-18 20:44:37 -03001680 case SAA7134_BOARD_ZOLID_HYBRID_PCI:
1681 fe0->dvb.frontend = dvb_attach(tda10048_attach,
1682 &zolid_tda10048_config,
1683 &dev->i2c_adap);
1684 if (fe0->dvb.frontend != NULL) {
1685 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1686 &dev->i2c_adap, 0x4b,
1687 &tda829x_no_probe);
1688 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1689 0x60, &dev->i2c_adap,
1690 &zolid_tda18271_config);
1691 }
1692 break;
Michael Krufky184e7692009-06-05 04:28:28 -03001693 case SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S:
1694 fe0->dvb.frontend = dvb_attach(tda10048_attach,
1695 &dtv1000s_tda10048_config,
1696 &dev->i2c_adap);
1697 if (fe0->dvb.frontend != NULL) {
1698 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1699 &dev->i2c_adap, 0x4b,
1700 &tda829x_no_probe);
1701 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1702 0x60, &dev->i2c_adap,
1703 &dtv1000s_tda18271_config);
1704 }
1705 break;
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001706 case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG:
Mauro Carvalho Chehabecb71d22011-01-14 12:03:03 -03001707 /* Switch to digital mode */
1708 saa7134_tuner_callback(dev, 0,
1709 TDA18271_CALLBACK_CMD_AGC_ENABLE, 1);
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001710 fe0->dvb.frontend = dvb_attach(mb86a20s_attach,
1711 &kworld_mb86a20s_config,
1712 &dev->i2c_adap);
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001713 if (fe0->dvb.frontend != NULL) {
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -03001714 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1715 &dev->i2c_adap, 0x4b,
1716 &tda829x_no_probe);
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001717 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1718 0x60, &dev->i2c_adap,
1719 &kworld_tda18271_config);
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -03001720 fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_gate_ctrl;
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001721 }
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -03001722
1723 /* mb86a20s need to use the I2C gateway */
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001724 break;
Timothy Leece027042011-03-25 15:00:33 -03001725 case SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2:
1726 fe0->dvb.frontend = dvb_attach(lgs8gxx_attach,
1727 &prohdtv_pro2_lgs8g75_config,
1728 &dev->i2c_adap);
1729 if (fe0->dvb.frontend != NULL) {
1730 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1731 &dev->i2c_adap, 0x4b,
1732 &tda829x_no_probe);
1733 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1734 0x60, &dev->i2c_adap,
1735 &prohdtv_pro2_tda18271_config);
1736 }
1737 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001738 default:
Trent Piephocf3c34c2007-03-07 18:19:48 -03001739 wprintk("Huh? unknown DVB card?\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001740 break;
1741 }
1742
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001743 if (attach_xc3028) {
1744 struct dvb_frontend *fe;
1745 struct xc2028_config cfg = {
1746 .i2c_adap = &dev->i2c_adap,
1747 .i2c_addr = 0x61,
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001748 };
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -03001749
Steven Toth363c35f2008-10-11 11:05:50 -03001750 if (!fe0->dvb.frontend)
Darron Broadf3f741e2008-11-11 08:50:02 -03001751 goto dettach_frontend;
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -03001752
Steven Toth363c35f2008-10-11 11:05:50 -03001753 fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg);
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001754 if (!fe) {
1755 printk(KERN_ERR "%s/2: xc3028 attach failed\n",
1756 dev->name);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001757 goto dettach_frontend;
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001758 }
1759 }
1760
Steven Toth363c35f2008-10-11 11:05:50 -03001761 if (NULL == fe0->dvb.frontend) {
Trent Piephocf3c34c2007-03-07 18:19:48 -03001762 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name);
Darron Broadf3f741e2008-11-11 08:50:02 -03001763 goto dettach_frontend;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001764 }
Michael Krufkyd7cba042008-09-12 13:31:45 -03001765 /* define general-purpose callback pointer */
Steven Toth363c35f2008-10-11 11:05:50 -03001766 fe0->dvb.frontend->callback = saa7134_tuner_callback;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001767
1768 /* register everything else */
Steven Toth363c35f2008-10-11 11:05:50 -03001769 ret = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
Michael Krufky9133aee2009-05-23 18:00:59 -03001770 &dev->pci->dev, adapter_nr, 0, NULL);
Hartmut Hackmann1c4f76a2007-04-27 12:31:16 -03001771
1772 /* this sequence is necessary to make the tda1004x load its firmware
1773 * and to enter analog mode of hybrid boards
1774 */
1775 if (!ret) {
Steven Toth363c35f2008-10-11 11:05:50 -03001776 if (fe0->dvb.frontend->ops.init)
1777 fe0->dvb.frontend->ops.init(fe0->dvb.frontend);
1778 if (fe0->dvb.frontend->ops.sleep)
1779 fe0->dvb.frontend->ops.sleep(fe0->dvb.frontend);
1780 if (fe0->dvb.frontend->ops.tuner_ops.sleep)
1781 fe0->dvb.frontend->ops.tuner_ops.sleep(fe0->dvb.frontend);
Hartmut Hackmann1c4f76a2007-04-27 12:31:16 -03001782 }
1783 return ret;
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001784
1785dettach_frontend:
Darron Broadf3f741e2008-11-11 08:50:02 -03001786 videobuf_dvb_dealloc_frontends(&dev->frontends);
1787 return -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001788}
1789
1790static int dvb_fini(struct saa7134_dev *dev)
1791{
Steven Toth363c35f2008-10-11 11:05:50 -03001792 struct videobuf_dvb_frontend *fe0;
1793
1794 /* Get the first frontend */
1795 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
1796 if (!fe0)
1797 return -EINVAL;
1798
Mauro Carvalho Chehab7f171122007-10-18 19:56:47 -03001799 /* FIXME: I suspect that this code is bogus, since the entry for
1800 Pinnacle 300I DVB-T PAL already defines the proper init to allow
1801 the detection of mt2032 (TDA9887_PORT2_INACTIVE)
1802 */
1803 if (dev->board == SAA7134_BOARD_PINNACLE_300I_DVBT_PAL) {
1804 struct v4l2_priv_tun_config tda9887_cfg;
1805 static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001806
Mauro Carvalho Chehab7f171122007-10-18 19:56:47 -03001807 tda9887_cfg.tuner = TUNER_TDA9887;
1808 tda9887_cfg.priv = &on;
1809
Linus Torvalds1da177e2005-04-16 15:20:36 -07001810 /* otherwise we don't detect the tuner on next insmod */
Hans Verkuilfac69862009-01-17 12:17:14 -03001811 saa_call_all(dev, tuner, s_config, &tda9887_cfg);
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001812 } else if (dev->board == SAA7134_BOARD_MEDION_MD8800_QUADRO) {
Hartmut Hackmanne9c1ac92008-04-22 14:46:10 -03001813 if ((dev->eedata[2] == 0x07) && use_frontend) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001814 /* turn off the 2nd lnb supply */
1815 u8 data = 0x80;
1816 struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1};
1817 struct dvb_frontend *fe;
Steven Toth363c35f2008-10-11 11:05:50 -03001818 fe = fe0->dvb.frontend;
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001819 if (fe->ops.i2c_gate_ctrl) {
1820 fe->ops.i2c_gate_ctrl(fe, 1);
1821 i2c_transfer(&dev->i2c_adap, &msg, 1);
1822 fe->ops.i2c_gate_ctrl(fe, 0);
1823 }
1824 }
Mauro Carvalho Chehab7f171122007-10-18 19:56:47 -03001825 }
Darron Broadf3f741e2008-11-11 08:50:02 -03001826 videobuf_dvb_unregister_bus(&dev->frontends);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001827 return 0;
1828}
1829
1830static struct saa7134_mpeg_ops dvb_ops = {
1831 .type = SAA7134_MPEG_DVB,
1832 .init = dvb_init,
1833 .fini = dvb_fini,
1834};
1835
1836static int __init dvb_register(void)
1837{
1838 return saa7134_ts_register(&dvb_ops);
1839}
1840
1841static void __exit dvb_unregister(void)
1842{
1843 saa7134_ts_unregister(&dvb_ops);
1844}
1845
1846module_init(dvb_register);
1847module_exit(dvb_unregister);
1848
1849/* ------------------------------------------------------------------ */
1850/*
1851 * Local variables:
1852 * c-basic-offset: 8
1853 * End:
1854 */