blob: 089fa0fb5c94d359c1a91ce9c5b2630a209a0991 [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
Mauro Carvalho Chehab14d24d12011-12-24 12:24:33 -0300186static int mt352_pinnacle_tuner_set_params(struct dvb_frontend *fe)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187{
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300188 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300189 u8 off[] = { 0x00, 0xf1};
190 u8 on[] = { 0x00, 0x71};
191 struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)};
192
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 struct saa7134_dev *dev = fe->dvb->priv;
194 struct v4l2_frequency f;
195
196 /* set frequency (mt2050) */
197 f.tuner = 0;
198 f.type = V4L2_TUNER_DIGITAL_TV;
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300199 f.frequency = c->frequency / 1000 * 16 / 1000;
Patrick Boettcherdea74862006-05-14 05:01:31 -0300200 if (fe->ops.i2c_gate_ctrl)
201 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300202 i2c_transfer(&dev->i2c_adap, &msg, 1);
Hans Verkuilfac69862009-01-17 12:17:14 -0300203 saa_call_all(dev, tuner, s_frequency, &f);
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300204 msg.buf = on;
Patrick Boettcherdea74862006-05-14 05:01:31 -0300205 if (fe->ops.i2c_gate_ctrl)
206 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmanndf8cf702006-03-03 12:09:26 -0300207 i2c_transfer(&dev->i2c_adap, &msg, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208
209 pinnacle_antenna_pwr(dev, antenna_pwr);
210
211 /* mt352 setup */
Andrew de Quincey0463f122006-05-16 17:22:02 -0300212 return mt352_pinnacle_init(fe);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213}
214
215static struct mt352_config pinnacle_300i = {
216 .demod_address = 0x3c >> 1,
217 .adc_clock = 20333,
218 .if2 = 36150,
219 .no_tuner = 1,
220 .demod_init = mt352_pinnacle_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221};
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200222
223static struct mt352_config avermedia_777 = {
224 .demod_address = 0xf,
225 .demod_init = mt352_aver777_init,
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -0200226};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227
Tim Farrington6e501a32008-06-15 13:33:42 -0300228static struct mt352_config avermedia_xc3028_mt352_dev = {
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -0300229 .demod_address = (0x1e >> 1),
230 .no_tuner = 1,
Tim Farrington6e501a32008-06-15 13:33:42 -0300231 .demod_init = mt352_avermedia_xc3028_init,
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -0300232};
233
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -0300234static struct tda18271_std_map mb86a20s_tda18271_std_map = {
235 .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4,
236 .if_lvl = 7, .rfagc_top = 0x37, },
237};
238
239static struct tda18271_config kworld_tda18271_config = {
240 .std_map = &mb86a20s_tda18271_std_map,
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -0300241 .gate = TDA18271_GATE_DIGITAL,
Mauro Carvalho Chehabecb71d22011-01-14 12:03:03 -0300242 .config = 3, /* Use tuner callback for AGC */
243
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -0300244};
245
246static const struct mb86a20s_config kworld_mb86a20s_config = {
247 .demod_address = 0x10,
248};
249
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -0300250static int kworld_sbtvd_gate_ctrl(struct dvb_frontend* fe, int enable)
251{
252 struct saa7134_dev *dev = fe->dvb->priv;
253
254 unsigned char initmsg[] = {0x45, 0x97};
255 unsigned char msg_enable[] = {0x45, 0xc1};
256 unsigned char msg_disable[] = {0x45, 0x81};
257 struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2};
258
259 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
260 wprintk("could not access the I2C gate\n");
261 return -EIO;
262 }
263 if (enable)
264 msg.buf = msg_enable;
265 else
266 msg.buf = msg_disable;
267 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
268 wprintk("could not access the I2C gate\n");
269 return -EIO;
270 }
271 msleep(20);
272 return 0;
273}
274
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300275/* ==================================================================
276 * tda1004x based DVB-T cards, helper functions
277 */
278
279static int philips_tda1004x_request_firmware(struct dvb_frontend *fe,
280 const struct firmware **fw, char *name)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700281{
282 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300283 return request_firmware(fw, name, &dev->pci->dev);
284}
285
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300286/* ------------------------------------------------------------------
287 * these tuners are tu1216, td1316(a)
288 */
289
Mauro Carvalho Chehab14d24d12011-12-24 12:24:33 -0300290static int philips_tda6651_pll_set(struct dvb_frontend *fe)
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300291{
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300292 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300293 struct saa7134_dev *dev = fe->dvb->priv;
294 struct tda1004x_state *state = fe->demodulator_priv;
295 u8 addr = state->config->tuner_address;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700296 u8 tuner_buf[4];
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800297 struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tuner_buf,.len =
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700298 sizeof(tuner_buf) };
299 int tuner_frequency = 0;
300 u8 band, cp, filter;
301
302 /* determine charge pump */
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300303 tuner_frequency = c->frequency + 36166000;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700304 if (tuner_frequency < 87000000)
305 return -EINVAL;
306 else if (tuner_frequency < 130000000)
307 cp = 3;
308 else if (tuner_frequency < 160000000)
309 cp = 5;
310 else if (tuner_frequency < 200000000)
311 cp = 6;
312 else if (tuner_frequency < 290000000)
313 cp = 3;
314 else if (tuner_frequency < 420000000)
315 cp = 5;
316 else if (tuner_frequency < 480000000)
317 cp = 6;
318 else if (tuner_frequency < 620000000)
319 cp = 3;
320 else if (tuner_frequency < 830000000)
321 cp = 5;
322 else if (tuner_frequency < 895000000)
323 cp = 7;
324 else
325 return -EINVAL;
326
327 /* determine band */
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300328 if (c->frequency < 49000000)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700329 return -EINVAL;
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300330 else if (c->frequency < 161000000)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700331 band = 1;
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300332 else if (c->frequency < 444000000)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700333 band = 2;
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300334 else if (c->frequency < 861000000)
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700335 band = 4;
336 else
337 return -EINVAL;
338
339 /* setup PLL filter */
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300340 switch (c->bandwidth_hz) {
341 case 6000000:
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700342 filter = 0;
343 break;
344
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300345 case 7000000:
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700346 filter = 0;
347 break;
348
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300349 case 8000000:
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700350 filter = 1;
351 break;
352
353 default:
354 return -EINVAL;
355 }
356
357 /* calculate divisor
358 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
359 */
Mauro Carvalho Chehabb09cf612011-12-23 12:25:04 -0300360 tuner_frequency = (((c->frequency / 1000) * 6) + 217496) / 1000;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700361
362 /* setup tuner buffer */
363 tuner_buf[0] = (tuner_frequency >> 8) & 0x7f;
364 tuner_buf[1] = tuner_frequency & 0xff;
365 tuner_buf[2] = 0xca;
366 tuner_buf[3] = (cp << 5) | (filter << 3) | band;
367
Patrick Boettcherdea74862006-05-14 05:01:31 -0300368 if (fe->ops.i2c_gate_ctrl)
369 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300370 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) {
Trent Piephocf3c34c2007-03-07 18:19:48 -0300371 wprintk("could not write to tuner at addr: 0x%02x\n",
372 addr << 1);
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700373 return -EIO;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300374 }
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700375 msleep(1);
376 return 0;
377}
378
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300379static int philips_tu1216_init(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800380{
381 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300382 struct tda1004x_state *state = fe->demodulator_priv;
383 u8 addr = state->config->tuner_address;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800384 static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab };
385 struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) };
386
387 /* setup PLL configuration */
Patrick Boettcherdea74862006-05-14 05:01:31 -0300388 if (fe->ops.i2c_gate_ctrl)
389 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800390 if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
391 return -EIO;
392 msleep(1);
393
394 return 0;
395}
396
397/* ------------------------------------------------------------------ */
398
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800399static struct tda1004x_config philips_tu1216_60_config = {
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700400 .demod_address = 0x8,
401 .invert = 1,
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800402 .invert_oclk = 0,
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700403 .xtal_freq = TDA10046_XTAL_4M,
404 .agc_config = TDA10046_AGC_DEFAULT,
405 .if_freq = TDA10046_FREQ_3617,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300406 .tuner_address = 0x60,
407 .request_firmware = philips_tda1004x_request_firmware
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408};
409
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800410static struct tda1004x_config philips_tu1216_61_config = {
411
412 .demod_address = 0x8,
413 .invert = 1,
414 .invert_oclk = 0,
415 .xtal_freq = TDA10046_XTAL_4M,
416 .agc_config = TDA10046_AGC_DEFAULT,
417 .if_freq = TDA10046_FREQ_3617,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300418 .tuner_address = 0x61,
419 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800420};
421
422/* ------------------------------------------------------------------ */
423
Hartmut Hackmanncbb94522006-10-30 20:00:16 -0300424static int philips_td1316_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800425{
426 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300427 struct tda1004x_state *state = fe->demodulator_priv;
428 u8 addr = state->config->tuner_address;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800429 static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab };
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300430 struct i2c_msg init_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) };
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800431
432 /* setup PLL configuration */
Patrick Boettcherdea74862006-05-14 05:01:31 -0300433 if (fe->ops.i2c_gate_ctrl)
434 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800435 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
436 return -EIO;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800437 return 0;
438}
439
Mauro Carvalho Chehab14d24d12011-12-24 12:24:33 -0300440static int philips_td1316_tuner_set_params(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800441{
Mauro Carvalho Chehab14d24d12011-12-24 12:24:33 -0300442 return philips_tda6651_pll_set(fe);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800443}
444
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300445static int philips_td1316_tuner_sleep(struct dvb_frontend *fe)
446{
447 struct saa7134_dev *dev = fe->dvb->priv;
448 struct tda1004x_state *state = fe->demodulator_priv;
449 u8 addr = state->config->tuner_address;
450 static u8 msg[] = { 0x0b, 0xdc, 0x86, 0xa4 };
451 struct i2c_msg analog_msg = {.addr = addr,.flags = 0,.buf = msg,.len = sizeof(msg) };
452
453 /* switch the tuner to analog mode */
454 if (fe->ops.i2c_gate_ctrl)
455 fe->ops.i2c_gate_ctrl(fe, 1);
456 if (i2c_transfer(&dev->i2c_adap, &analog_msg, 1) != 1)
457 return -EIO;
458 return 0;
459}
460
461/* ------------------------------------------------------------------ */
462
Hartmut Hackmanncbb94522006-10-30 20:00:16 -0300463static int philips_europa_tuner_init(struct dvb_frontend *fe)
464{
465 struct saa7134_dev *dev = fe->dvb->priv;
466 static u8 msg[] = { 0x00, 0x40};
467 struct i2c_msg init_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) };
468
469
470 if (philips_td1316_tuner_init(fe))
471 return -EIO;
472 msleep(1);
473 if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1)
474 return -EIO;
475
476 return 0;
477}
478
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300479static int philips_europa_tuner_sleep(struct dvb_frontend *fe)
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800480{
481 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800482
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300483 static u8 msg[] = { 0x00, 0x14 };
484 struct i2c_msg analog_msg = {.addr = 0x43,.flags = 0,.buf = msg,.len = sizeof(msg) };
485
486 if (philips_td1316_tuner_sleep(fe))
487 return -EIO;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800488
489 /* switch the board to analog mode */
Patrick Boettcherdea74862006-05-14 05:01:31 -0300490 if (fe->ops.i2c_gate_ctrl)
491 fe->ops.i2c_gate_ctrl(fe, 1);
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800492 i2c_transfer(&dev->i2c_adap, &analog_msg, 1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300493 return 0;
494}
495
496static int philips_europa_demod_sleep(struct dvb_frontend *fe)
497{
498 struct saa7134_dev *dev = fe->dvb->priv;
499
500 if (dev->original_demod_sleep)
501 dev->original_demod_sleep(fe);
Patrick Boettcherdea74862006-05-14 05:01:31 -0300502 fe->ops.i2c_gate_ctrl(fe, 1);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300503 return 0;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800504}
505
506static struct tda1004x_config philips_europa_config = {
507
508 .demod_address = 0x8,
509 .invert = 0,
510 .invert_oclk = 0,
511 .xtal_freq = TDA10046_XTAL_4M,
512 .agc_config = TDA10046_AGC_IFO_AUTO_POS,
513 .if_freq = TDA10046_FREQ_052,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300514 .tuner_address = 0x61,
515 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -0800516};
517
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700518static struct tda1004x_config medion_cardbus = {
519 .demod_address = 0x08,
520 .invert = 1,
521 .invert_oclk = 0,
522 .xtal_freq = TDA10046_XTAL_16M,
523 .agc_config = TDA10046_AGC_IFO_AUTO_NEG,
524 .if_freq = TDA10046_FREQ_3613,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300525 .tuner_address = 0x61,
526 .request_firmware = philips_tda1004x_request_firmware
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -0700527};
528
Vadim Catana128fe952010-05-29 12:49:16 -0300529static struct tda1004x_config technotrend_budget_t3000_config = {
530 .demod_address = 0x8,
531 .invert = 1,
532 .invert_oclk = 0,
533 .xtal_freq = TDA10046_XTAL_4M,
534 .agc_config = TDA10046_AGC_DEFAULT,
535 .if_freq = TDA10046_FREQ_3617,
536 .tuner_address = 0x63,
537 .request_firmware = philips_tda1004x_request_firmware
538};
539
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300540/* ------------------------------------------------------------------
541 * tda 1004x based cards with philips silicon tuner
542 */
543
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300544static int tda8290_i2c_gate_ctrl( struct dvb_frontend* fe, int enable)
545{
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300546 struct tda1004x_state *state = fe->demodulator_priv;
547
548 u8 addr = state->config->i2c_gate;
549 static u8 tda8290_close[] = { 0x21, 0xc0};
550 static u8 tda8290_open[] = { 0x21, 0x80};
551 struct i2c_msg tda8290_msg = {.addr = addr,.flags = 0, .len = 2};
552 if (enable) {
553 tda8290_msg.buf = tda8290_close;
554 } else {
555 tda8290_msg.buf = tda8290_open;
556 }
Hartmut Hackmann06be3032007-04-27 12:31:15 -0300557 if (i2c_transfer(state->i2c, &tda8290_msg, 1) != 1) {
Trent Piephocf3c34c2007-03-07 18:19:48 -0300558 struct saa7134_dev *dev = fe->dvb->priv;
559 wprintk("could not access tda8290 I2C gate\n");
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300560 return -EIO;
561 }
562 msleep(20);
563 return 0;
564}
565
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300566static int philips_tda827x_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -0300567{
568 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300569 struct tda1004x_state *state = fe->demodulator_priv;
Michael Krufky8ce47da2007-04-27 12:31:14 -0300570
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300571 switch (state->config->antenna_switch) {
572 case 0: break;
573 case 1: dprintk("setting GPIO21 to 0 (TV antenna?)\n");
574 saa7134_set_gpio(dev, 21, 0);
575 break;
576 case 2: dprintk("setting GPIO21 to 1 (Radio antenna?)\n");
577 saa7134_set_gpio(dev, 21, 1);
578 break;
579 }
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300580 return 0;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800581}
582
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300583static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe)
584{
585 struct saa7134_dev *dev = fe->dvb->priv;
586 struct tda1004x_state *state = fe->demodulator_priv;
Michael Krufky8ce47da2007-04-27 12:31:14 -0300587
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300588 switch (state->config->antenna_switch) {
589 case 0: break;
590 case 1: dprintk("setting GPIO21 to 1 (Radio antenna?)\n");
591 saa7134_set_gpio(dev, 21, 1);
592 break;
593 case 2: dprintk("setting GPIO21 to 0 (TV antenna?)\n");
594 saa7134_set_gpio(dev, 21, 0);
595 break;
596 }
597 return 0;
598}
599
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -0300600static int configure_tda827x_fe(struct saa7134_dev *dev,
601 struct tda1004x_config *cdec_conf,
602 struct tda827x_config *tuner_conf)
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300603{
Steven Toth363c35f2008-10-11 11:05:50 -0300604 struct videobuf_dvb_frontend *fe0;
605
Darron Broad92abe9e2008-10-11 11:18:53 -0300606 /* Get the first frontend */
607 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
Steven Toth363c35f2008-10-11 11:05:50 -0300608
609 fe0->dvb.frontend = dvb_attach(tda10046_attach, cdec_conf, &dev->i2c_adap);
610 if (fe0->dvb.frontend) {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300611 if (cdec_conf->i2c_gate)
Steven Toth363c35f2008-10-11 11:05:50 -0300612 fe0->dvb.frontend->ops.i2c_gate_ctrl = tda8290_i2c_gate_ctrl;
613 if (dvb_attach(tda827x_attach, fe0->dvb.frontend,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -0300614 cdec_conf->tuner_address,
615 &dev->i2c_adap, tuner_conf))
616 return 0;
617
618 wprintk("no tda827x tuner found at addr: %02x\n",
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300619 cdec_conf->tuner_address);
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300620 }
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -0300621 return -EINVAL;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300622}
623
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800624/* ------------------------------------------------------------------ */
Edgar Simo261f5082007-08-20 14:06:00 -0300625
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300626static struct tda827x_config tda827x_cfg_0 = {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300627 .init = philips_tda827x_tuner_init,
628 .sleep = philips_tda827x_tuner_sleep,
629 .config = 0,
630 .switch_addr = 0
631};
632
633static struct tda827x_config tda827x_cfg_1 = {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300634 .init = philips_tda827x_tuner_init,
635 .sleep = philips_tda827x_tuner_sleep,
636 .config = 1,
637 .switch_addr = 0x4b
638};
639
640static struct tda827x_config tda827x_cfg_2 = {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300641 .init = philips_tda827x_tuner_init,
642 .sleep = philips_tda827x_tuner_sleep,
643 .config = 2,
644 .switch_addr = 0x4b
645};
646
647static struct tda827x_config tda827x_cfg_2_sw42 = {
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300648 .init = philips_tda827x_tuner_init,
649 .sleep = philips_tda827x_tuner_sleep,
650 .config = 2,
651 .switch_addr = 0x42
652};
653
654/* ------------------------------------------------------------------ */
655
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300656static struct tda1004x_config tda827x_lifeview_config = {
657 .demod_address = 0x08,
658 .invert = 1,
659 .invert_oclk = 0,
660 .xtal_freq = TDA10046_XTAL_16M,
661 .agc_config = TDA10046_AGC_TDA827X,
662 .gpio_config = TDA10046_GP11_I,
663 .if_freq = TDA10046_FREQ_045,
664 .tuner_address = 0x60,
665 .request_firmware = philips_tda1004x_request_firmware
666};
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800667
668static struct tda1004x_config philips_tiger_config = {
669 .demod_address = 0x08,
670 .invert = 1,
671 .invert_oclk = 0,
672 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300673 .agc_config = TDA10046_AGC_TDA827X,
674 .gpio_config = TDA10046_GP11_I,
Hartmut Hackmann550a9a52006-11-15 21:31:54 -0300675 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300676 .i2c_gate = 0x4b,
677 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300678 .antenna_switch= 1,
679 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann550a9a52006-11-15 21:31:54 -0300680};
Hartmut Hackmann550a9a52006-11-15 21:31:54 -0300681
682static struct tda1004x_config cinergy_ht_config = {
683 .demod_address = 0x08,
684 .invert = 1,
685 .invert_oclk = 0,
686 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300687 .agc_config = TDA10046_AGC_TDA827X,
688 .gpio_config = TDA10046_GP01_I,
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800689 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300690 .i2c_gate = 0x4b,
691 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300692 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann90e9df72005-11-08 21:38:42 -0800693};
694
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300695static struct tda1004x_config cinergy_ht_pci_config = {
696 .demod_address = 0x08,
697 .invert = 1,
698 .invert_oclk = 0,
699 .xtal_freq = TDA10046_XTAL_16M,
700 .agc_config = TDA10046_AGC_TDA827X,
701 .gpio_config = TDA10046_GP01_I,
702 .if_freq = TDA10046_FREQ_045,
703 .i2c_gate = 0x4b,
704 .tuner_address = 0x60,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300705 .request_firmware = philips_tda1004x_request_firmware
706};
707
708static struct tda1004x_config philips_tiger_s_config = {
709 .demod_address = 0x08,
710 .invert = 1,
711 .invert_oclk = 0,
712 .xtal_freq = TDA10046_XTAL_16M,
713 .agc_config = TDA10046_AGC_TDA827X,
714 .gpio_config = TDA10046_GP01_I,
715 .if_freq = TDA10046_FREQ_045,
716 .i2c_gate = 0x4b,
717 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300718 .antenna_switch= 1,
719 .request_firmware = philips_tda1004x_request_firmware
720};
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200721
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -0300722static struct tda1004x_config pinnacle_pctv_310i_config = {
723 .demod_address = 0x08,
724 .invert = 1,
725 .invert_oclk = 0,
726 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300727 .agc_config = TDA10046_AGC_TDA827X,
728 .gpio_config = TDA10046_GP11_I,
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -0300729 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300730 .i2c_gate = 0x4b,
731 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300732 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -0300733};
734
Thomas Gentyc6e53da2006-11-05 14:17:30 -0300735static struct tda1004x_config hauppauge_hvr_1110_config = {
736 .demod_address = 0x08,
737 .invert = 1,
738 .invert_oclk = 0,
739 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300740 .agc_config = TDA10046_AGC_TDA827X,
741 .gpio_config = TDA10046_GP11_I,
Thomas Gentyc6e53da2006-11-05 14:17:30 -0300742 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300743 .i2c_gate = 0x4b,
744 .tuner_address = 0x61,
745 .request_firmware = philips_tda1004x_request_firmware
Thomas Gentyc6e53da2006-11-05 14:17:30 -0300746};
747
Hartmut Hackmann83646812006-10-12 20:38:51 -0300748static struct tda1004x_config asus_p7131_dual_config = {
749 .demod_address = 0x08,
750 .invert = 1,
751 .invert_oclk = 0,
752 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300753 .agc_config = TDA10046_AGC_TDA827X,
754 .gpio_config = TDA10046_GP11_I,
Hartmut Hackmann83646812006-10-12 20:38:51 -0300755 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300756 .i2c_gate = 0x4b,
757 .tuner_address = 0x61,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300758 .antenna_switch= 2,
759 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmann83646812006-10-12 20:38:51 -0300760};
761
Nico Sabbi420f32f2006-03-03 12:11:28 -0300762static struct tda1004x_config lifeview_trio_config = {
763 .demod_address = 0x09,
764 .invert = 1,
765 .invert_oclk = 0,
766 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300767 .agc_config = TDA10046_AGC_TDA827X,
768 .gpio_config = TDA10046_GP00_I,
Nico Sabbi420f32f2006-03-03 12:11:28 -0300769 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300770 .tuner_address = 0x60,
771 .request_firmware = philips_tda1004x_request_firmware
Nico Sabbi420f32f2006-03-03 12:11:28 -0300772};
773
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300774static struct tda1004x_config tevion_dvbt220rf_config = {
775 .demod_address = 0x08,
776 .invert = 1,
777 .invert_oclk = 0,
778 .xtal_freq = TDA10046_XTAL_16M,
779 .agc_config = TDA10046_AGC_TDA827X,
780 .gpio_config = TDA10046_GP11_I,
781 .if_freq = TDA10046_FREQ_045,
782 .tuner_address = 0x60,
783 .request_firmware = philips_tda1004x_request_firmware
784};
Nico Sabbi420f32f2006-03-03 12:11:28 -0300785
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300786static struct tda1004x_config md8800_dvbt_config = {
787 .demod_address = 0x08,
788 .invert = 1,
789 .invert_oclk = 0,
790 .xtal_freq = TDA10046_XTAL_16M,
791 .agc_config = TDA10046_AGC_TDA827X,
792 .gpio_config = TDA10046_GP01_I,
793 .if_freq = TDA10046_FREQ_045,
794 .i2c_gate = 0x4b,
795 .tuner_address = 0x60,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300796 .request_firmware = philips_tda1004x_request_firmware
797};
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200798
Hartmut Hackmanne06cea42007-03-13 20:58:29 -0300799static struct tda1004x_config asus_p7131_4871_config = {
800 .demod_address = 0x08,
801 .invert = 1,
802 .invert_oclk = 0,
803 .xtal_freq = TDA10046_XTAL_16M,
804 .agc_config = TDA10046_AGC_TDA827X,
805 .gpio_config = TDA10046_GP01_I,
806 .if_freq = TDA10046_FREQ_045,
807 .i2c_gate = 0x4b,
808 .tuner_address = 0x61,
Hartmut Hackmanne06cea42007-03-13 20:58:29 -0300809 .antenna_switch= 2,
810 .request_firmware = philips_tda1004x_request_firmware
811};
812
Hartmut Hackmannf3eec0c02007-03-14 20:33:55 -0300813static struct tda1004x_config asus_p7131_hybrid_lna_config = {
Hartmut Hackmanne06cea42007-03-13 20:58:29 -0300814 .demod_address = 0x08,
815 .invert = 1,
816 .invert_oclk = 0,
817 .xtal_freq = TDA10046_XTAL_16M,
818 .agc_config = TDA10046_AGC_TDA827X,
819 .gpio_config = TDA10046_GP11_I,
820 .if_freq = TDA10046_FREQ_045,
821 .i2c_gate = 0x4b,
822 .tuner_address = 0x61,
Hartmut Hackmanne06cea42007-03-13 20:58:29 -0300823 .antenna_switch= 2,
824 .request_firmware = philips_tda1004x_request_firmware
825};
Edgar Simo261f5082007-08-20 14:06:00 -0300826
Simon Farnsworthb39423a2007-05-01 10:01:20 -0300827static struct tda1004x_config kworld_dvb_t_210_config = {
828 .demod_address = 0x08,
829 .invert = 1,
830 .invert_oclk = 0,
831 .xtal_freq = TDA10046_XTAL_16M,
832 .agc_config = TDA10046_AGC_TDA827X,
833 .gpio_config = TDA10046_GP11_I,
834 .if_freq = TDA10046_FREQ_045,
835 .i2c_gate = 0x4b,
836 .tuner_address = 0x61,
Simon Farnsworthb39423a2007-05-01 10:01:20 -0300837 .antenna_switch= 1,
838 .request_firmware = philips_tda1004x_request_firmware
839};
Edgar Simo261f5082007-08-20 14:06:00 -0300840
Edgar Simod90d9f52007-08-20 14:14:50 -0300841static struct tda1004x_config avermedia_super_007_config = {
842 .demod_address = 0x08,
843 .invert = 1,
844 .invert_oclk = 0,
845 .xtal_freq = TDA10046_XTAL_16M,
846 .agc_config = TDA10046_AGC_TDA827X,
847 .gpio_config = TDA10046_GP01_I,
848 .if_freq = TDA10046_FREQ_045,
849 .i2c_gate = 0x4b,
850 .tuner_address = 0x60,
Edgar Simod90d9f52007-08-20 14:14:50 -0300851 .antenna_switch= 1,
852 .request_firmware = philips_tda1004x_request_firmware
853};
854
Hermann Pitton4ba24372008-01-20 19:27:51 -0300855static struct tda1004x_config twinhan_dtv_dvb_3056_config = {
856 .demod_address = 0x08,
857 .invert = 1,
858 .invert_oclk = 0,
859 .xtal_freq = TDA10046_XTAL_16M,
860 .agc_config = TDA10046_AGC_TDA827X,
861 .gpio_config = TDA10046_GP01_I,
862 .if_freq = TDA10046_FREQ_045,
863 .i2c_gate = 0x42,
864 .tuner_address = 0x61,
Hermann Pitton4ba24372008-01-20 19:27:51 -0300865 .antenna_switch = 1,
866 .request_firmware = philips_tda1004x_request_firmware
867};
868
hermann pitton301e9d62008-09-14 17:49:14 -0300869static struct tda1004x_config asus_tiger_3in1_config = {
870 .demod_address = 0x0b,
871 .invert = 1,
872 .invert_oclk = 0,
873 .xtal_freq = TDA10046_XTAL_16M,
874 .agc_config = TDA10046_AGC_TDA827X,
875 .gpio_config = TDA10046_GP11_I,
876 .if_freq = TDA10046_FREQ_045,
877 .i2c_gate = 0x4b,
878 .tuner_address = 0x61,
879 .antenna_switch = 1,
880 .request_firmware = philips_tda1004x_request_firmware
881};
882
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300883/* ------------------------------------------------------------------
884 * special case: this card uses saa713x GPIO22 for the mode switch
885 */
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200886
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300887static int ads_duo_tuner_init(struct dvb_frontend *fe)
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200888{
889 struct saa7134_dev *dev = fe->dvb->priv;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300890 philips_tda827x_tuner_init(fe);
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200891 /* route TDA8275a AGC input to the channel decoder */
Hartmut Hackmann06be3032007-04-27 12:31:15 -0300892 saa7134_set_gpio(dev, 22, 1);
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200893 return 0;
894}
895
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300896static int ads_duo_tuner_sleep(struct dvb_frontend *fe)
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200897{
898 struct saa7134_dev *dev = fe->dvb->priv;
899 /* route TDA8275a AGC input to the analog IF chip*/
Hartmut Hackmann06be3032007-04-27 12:31:15 -0300900 saa7134_set_gpio(dev, 22, 0);
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300901 philips_tda827x_tuner_sleep(fe);
Andrew de Quinceya79ddae2006-04-18 17:47:11 -0300902 return 0;
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200903}
904
Michael Krufky8ce47da2007-04-27 12:31:14 -0300905static struct tda827x_config ads_duo_cfg = {
Michael Krufky8ce47da2007-04-27 12:31:14 -0300906 .init = ads_duo_tuner_init,
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -0300907 .sleep = ads_duo_tuner_sleep,
908 .config = 0
Michael Krufky8ce47da2007-04-27 12:31:14 -0300909};
910
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200911static struct tda1004x_config ads_tech_duo_config = {
912 .demod_address = 0x08,
913 .invert = 1,
914 .invert_oclk = 0,
915 .xtal_freq = TDA10046_XTAL_16M,
Hartmut Hackmann1bb0e862007-04-27 12:31:10 -0300916 .agc_config = TDA10046_AGC_TDA827X,
917 .gpio_config = TDA10046_GP00_I,
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200918 .if_freq = TDA10046_FREQ_045,
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300919 .tuner_address = 0x61,
920 .request_firmware = philips_tda1004x_request_firmware
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -0200921};
922
Dmitri Belimov47aeba52008-12-23 03:53:03 -0300923static struct zl10353_config behold_h6_config = {
924 .demod_address = 0x1e>>1,
925 .no_tuner = 1,
926 .parallel_ts = 1,
Antti Palosaari5f77af92009-03-10 13:06:40 -0300927 .disable_i2c_gate_ctrl = 1,
Dmitri Belimov47aeba52008-12-23 03:53:03 -0300928};
929
Beholder Intl. Ltd. Dmitry Belimov29309922009-09-30 23:02:21 -0300930static struct xc5000_config behold_x7_tunerconfig = {
931 .i2c_address = 0xc2>>1,
932 .if_khz = 4560,
Devin Heitmueller2a0d0562009-09-30 23:04:39 -0300933 .radio_input = XC5000_RADIO_FM1,
Beholder Intl. Ltd. Dmitry Belimov29309922009-09-30 23:02:21 -0300934};
935
936static struct zl10353_config behold_x7_config = {
937 .demod_address = 0x1e>>1,
938 .if2 = 45600,
939 .no_tuner = 1,
940 .parallel_ts = 1,
941 .disable_i2c_gate_ctrl = 1,
942};
943
Carlos Corbachodbe87402011-06-25 10:24:28 -0300944static struct zl10353_config videomate_t750_zl10353_config = {
945 .demod_address = 0x0f,
946 .no_tuner = 1,
947 .parallel_ts = 1,
948 .disable_i2c_gate_ctrl = 1,
949};
950
951static struct qt1010_config videomate_t750_qt1010_config = {
952 .i2c_address = 0x62
953};
954
955
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -0300956/* ==================================================================
957 * tda10086 based DVB-S cards, helper functions
958 */
Hartmut Hackmann5eda2272006-08-07 14:03:32 -0300959
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -0300960static struct tda10086_config flydvbs = {
961 .demod_address = 0x0e,
962 .invert = 0,
Hartmut Hackmannea75baf2008-02-09 23:54:24 -0300963 .diseqc_tone = 0,
Hartmut Hackmann9a1b04e2008-04-09 23:07:11 -0300964 .xtal_freq = TDA10086_XTAL_16M,
965};
966
967static struct tda10086_config sd1878_4m = {
968 .demod_address = 0x0e,
969 .invert = 0,
970 .diseqc_tone = 0,
971 .xtal_freq = TDA10086_XTAL_4M,
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -0300972};
973
Hartmut Hackmann1b1cee32008-04-22 14:42:12 -0300974/* ------------------------------------------------------------------
975 * special case: lnb supply is connected to the gated i2c
976 */
977
978static int md8800_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
979{
980 int res = -EIO;
981 struct saa7134_dev *dev = fe->dvb->priv;
982 if (fe->ops.i2c_gate_ctrl) {
983 fe->ops.i2c_gate_ctrl(fe, 1);
984 if (dev->original_set_voltage)
985 res = dev->original_set_voltage(fe, voltage);
986 fe->ops.i2c_gate_ctrl(fe, 0);
987 }
988 return res;
989};
990
991static int md8800_set_high_voltage(struct dvb_frontend *fe, long arg)
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_high_voltage)
998 res = dev->original_set_high_voltage(fe, arg);
999 fe->ops.i2c_gate_ctrl(fe, 0);
1000 }
1001 return res;
1002};
1003
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001004static int md8800_set_voltage2(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
1005{
1006 struct saa7134_dev *dev = fe->dvb->priv;
1007 u8 wbuf[2] = { 0x1f, 00 };
1008 u8 rbuf;
1009 struct i2c_msg msg[] = { { .addr = 0x08, .flags = 0, .buf = wbuf, .len = 1 },
1010 { .addr = 0x08, .flags = I2C_M_RD, .buf = &rbuf, .len = 1 } };
1011
1012 if (i2c_transfer(&dev->i2c_adap, msg, 2) != 2)
1013 return -EIO;
1014 /* NOTE: this assumes that gpo1 is used, it might be bit 5 (gpo2) */
1015 if (voltage == SEC_VOLTAGE_18)
1016 wbuf[1] = rbuf | 0x10;
1017 else
1018 wbuf[1] = rbuf & 0xef;
1019 msg[0].len = 2;
1020 i2c_transfer(&dev->i2c_adap, msg, 1);
1021 return 0;
1022}
1023
1024static int md8800_set_high_voltage2(struct dvb_frontend *fe, long arg)
1025{
1026 struct saa7134_dev *dev = fe->dvb->priv;
1027 wprintk("%s: sorry can't set high LNB supply voltage from here\n", __func__);
1028 return -EIO;
1029}
1030
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001031/* ==================================================================
1032 * nxt200x based ATSC cards, helper functions
1033 */
Hartmut Hackmann90e9df72005-11-08 21:38:42 -08001034
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001035static struct nxt200x_config avertvhda180 = {
1036 .demod_address = 0x0a,
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001037};
Andrew Burri3e1410a2006-02-27 00:08:23 -03001038
1039static struct nxt200x_config kworldatsc110 = {
1040 .demod_address = 0x0a,
Andrew Burri3e1410a2006-02-27 00:08:23 -03001041};
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001042
Matthias Schwarzott04574182009-02-24 12:35:16 -03001043/* ------------------------------------------------------------------ */
1044
1045static struct mt312_config avertv_a700_mt312 = {
1046 .demod_address = 0x0e,
1047 .voltage_inverted = 1,
1048};
1049
1050static struct zl10036_config avertv_a700_tuner = {
1051 .tuner_address = 0x60,
1052};
1053
Igor M. Liplianinecfcfec2009-08-13 21:42:21 -03001054static struct mt312_config zl10313_compro_s350_config = {
1055 .demod_address = 0x0e,
1056};
1057
Michael Krufky3abdedd2009-01-19 01:10:49 -03001058static struct lgdt3305_config hcw_lgdt3305_config = {
1059 .i2c_addr = 0x0e,
1060 .mpeg_mode = LGDT3305_MPEG_SERIAL,
1061 .tpclk_edge = LGDT3305_TPCLK_RISING_EDGE,
1062 .tpvalid_polarity = LGDT3305_TP_VALID_HIGH,
1063 .deny_i2c_rptr = 1,
1064 .spectral_inversion = 1,
1065 .qam_if_khz = 4000,
1066 .vsb_if_khz = 3250,
1067};
1068
Michael Krufky1bc7f512009-01-19 01:10:49 -03001069static struct tda10048_config hcw_tda10048_config = {
1070 .demod_address = 0x10 >> 1,
1071 .output_mode = TDA10048_SERIAL_OUTPUT,
1072 .fwbulkwritelen = TDA10048_BULKWRITE_200,
1073 .inversion = TDA10048_INVERSION_ON,
1074 .dtv6_if_freq_khz = TDA10048_IF_3300,
1075 .dtv7_if_freq_khz = TDA10048_IF_3500,
1076 .dtv8_if_freq_khz = TDA10048_IF_4000,
1077 .clk_freq_khz = TDA10048_CLK_16000,
1078 .disable_gate_access = 1,
1079};
1080
Michael Krufky3abdedd2009-01-19 01:10:49 -03001081static struct tda18271_std_map hauppauge_tda18271_std_map = {
1082 .atsc_6 = { .if_freq = 3250, .agc_mode = 3, .std = 4,
1083 .if_lvl = 1, .rfagc_top = 0x58, },
1084 .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 5,
1085 .if_lvl = 1, .rfagc_top = 0x58, },
1086};
1087
1088static struct tda18271_config hcw_tda18271_config = {
1089 .std_map = &hauppauge_tda18271_std_map,
1090 .gate = TDA18271_GATE_ANALOG,
1091 .config = 3,
Michael Krufky542cb052009-08-29 17:45:48 -03001092 .output_opt = TDA18271_OUTPUT_LT_OFF,
Michael Krufky3abdedd2009-01-19 01:10:49 -03001093};
1094
1095static struct tda829x_config tda829x_no_probe = {
1096 .probe_tuner = TDA829X_DONT_PROBE,
1097};
1098
Henk Vergonet6c119ff2009-09-18 20:44:37 -03001099static struct tda10048_config zolid_tda10048_config = {
1100 .demod_address = 0x10 >> 1,
1101 .output_mode = TDA10048_PARALLEL_OUTPUT,
1102 .fwbulkwritelen = TDA10048_BULKWRITE_200,
1103 .inversion = TDA10048_INVERSION_ON,
1104 .dtv6_if_freq_khz = TDA10048_IF_3300,
1105 .dtv7_if_freq_khz = TDA10048_IF_3500,
1106 .dtv8_if_freq_khz = TDA10048_IF_4000,
1107 .clk_freq_khz = TDA10048_CLK_16000,
1108 .disable_gate_access = 1,
1109};
1110
1111static struct tda18271_config zolid_tda18271_config = {
1112 .gate = TDA18271_GATE_ANALOG,
1113};
1114
Michael Krufky184e7692009-06-05 04:28:28 -03001115static struct tda10048_config dtv1000s_tda10048_config = {
1116 .demod_address = 0x10 >> 1,
1117 .output_mode = TDA10048_PARALLEL_OUTPUT,
1118 .fwbulkwritelen = TDA10048_BULKWRITE_200,
1119 .inversion = TDA10048_INVERSION_ON,
1120 .dtv6_if_freq_khz = TDA10048_IF_3300,
1121 .dtv7_if_freq_khz = TDA10048_IF_3800,
1122 .dtv8_if_freq_khz = TDA10048_IF_4300,
1123 .clk_freq_khz = TDA10048_CLK_16000,
1124 .disable_gate_access = 1,
1125};
1126
1127static struct tda18271_std_map dtv1000s_tda18271_std_map = {
1128 .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4,
1129 .if_lvl = 1, .rfagc_top = 0x37, },
1130 .dvbt_7 = { .if_freq = 3800, .agc_mode = 3, .std = 5,
1131 .if_lvl = 1, .rfagc_top = 0x37, },
1132 .dvbt_8 = { .if_freq = 4300, .agc_mode = 3, .std = 6,
1133 .if_lvl = 1, .rfagc_top = 0x37, },
1134};
1135
1136static struct tda18271_config dtv1000s_tda18271_config = {
1137 .std_map = &dtv1000s_tda18271_std_map,
1138 .gate = TDA18271_GATE_ANALOG,
1139};
1140
Timothy Leece027042011-03-25 15:00:33 -03001141static struct lgs8gxx_config prohdtv_pro2_lgs8g75_config = {
1142 .prod = LGS8GXX_PROD_LGS8G75,
1143 .demod_address = 0x1d,
1144 .serial_ts = 0,
1145 .ts_clk_pol = 1,
1146 .ts_clk_gated = 0,
1147 .if_clk_freq = 30400, /* 30.4 MHz */
1148 .if_freq = 4000, /* 4.00 MHz */
1149 .if_neg_center = 0,
1150 .ext_adc = 0,
1151 .adc_signed = 1,
1152 .adc_vpp = 3, /* 2.0 Vpp */
1153 .if_neg_edge = 1,
1154};
1155
1156static struct tda18271_config prohdtv_pro2_tda18271_config = {
1157 .gate = TDA18271_GATE_ANALOG,
1158 .output_opt = TDA18271_OUTPUT_LT_OFF,
1159};
1160
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001161/* ==================================================================
1162 * Core code
1163 */
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001164
Linus Torvalds1da177e2005-04-16 15:20:36 -07001165static int dvb_init(struct saa7134_dev *dev)
1166{
Hartmut Hackmann1c4f76a2007-04-27 12:31:16 -03001167 int ret;
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001168 int attach_xc3028 = 0;
Steven Toth363c35f2008-10-11 11:05:50 -03001169 struct videobuf_dvb_frontend *fe0;
1170
Darron Broadf972e0b2008-10-11 11:24:30 -03001171 /* FIXME: add support for multi-frontend */
1172 mutex_init(&dev->frontends.lock);
Darron Broad7bdf84f2008-10-15 13:43:41 -03001173 INIT_LIST_HEAD(&dev->frontends.felist);
Darron Broadf972e0b2008-10-11 11:24:30 -03001174
1175 printk(KERN_INFO "%s() allocating 1 frontend\n", __func__);
Darron Broadf3f741e2008-11-11 08:50:02 -03001176 fe0 = videobuf_dvb_alloc_frontend(&dev->frontends, 1);
1177 if (!fe0) {
Darron Broadf972e0b2008-10-11 11:24:30 -03001178 printk(KERN_ERR "%s() failed to alloc\n", __func__);
1179 return -ENOMEM;
1180 }
1181
Linus Torvalds1da177e2005-04-16 15:20:36 -07001182 /* init struct videobuf_dvb */
1183 dev->ts.nr_bufs = 32;
1184 dev->ts.nr_packets = 32*4;
Steven Toth363c35f2008-10-11 11:05:50 -03001185 fe0->dvb.name = dev->name;
1186 videobuf_queue_sg_init(&fe0->dvb.dvbq, &saa7134_ts_qops,
Guennadi Liakhovetski07051352008-04-22 14:42:13 -03001187 &dev->pci->dev, &dev->slock,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001188 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1189 V4L2_FIELD_ALTERNATE,
1190 sizeof(struct saa7134_buf),
Hans Verkuil08bff032010-09-20 17:39:46 -03001191 dev, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001192
1193 switch (dev->board) {
1194 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
Trent Piephocf3c34c2007-03-07 18:19:48 -03001195 dprintk("pinnacle 300i dvb setup\n");
Steven Toth363c35f2008-10-11 11:05:50 -03001196 fe0->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001197 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001198 if (fe0->dvb.frontend) {
1199 fe0->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params;
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001200 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001201 break;
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -02001202 case SAA7134_BOARD_AVERMEDIA_777:
Petr Baudis515c2082006-09-26 16:53:53 -03001203 case SAA7134_BOARD_AVERMEDIA_A16AR:
Trent Piephocf3c34c2007-03-07 18:19:48 -03001204 dprintk("avertv 777 dvb setup\n");
Steven Toth363c35f2008-10-11 11:05:50 -03001205 fe0->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001206 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001207 if (fe0->dvb.frontend) {
1208 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Michael Krufkyfb147e92008-04-22 14:46:16 -03001209 &dev->i2c_adap, 0x61,
1210 TUNER_PHILIPS_TD1316);
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001211 }
Jose Alberto Regueroa78d0bf2006-02-07 06:25:14 -02001212 break;
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -03001213 case SAA7134_BOARD_AVERMEDIA_A16D:
Tim Farrington6e501a32008-06-15 13:33:42 -03001214 dprintk("AverMedia A16D dvb setup\n");
Steven Toth363c35f2008-10-11 11:05:50 -03001215 fe0->dvb.frontend = dvb_attach(mt352_attach,
Tim Farrington6e501a32008-06-15 13:33:42 -03001216 &avermedia_xc3028_mt352_dev,
1217 &dev->i2c_adap);
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -03001218 attach_xc3028 = 1;
1219 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001220 case SAA7134_BOARD_MD7134:
Steven Toth363c35f2008-10-11 11:05:50 -03001221 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001222 &medion_cardbus,
1223 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001224 if (fe0->dvb.frontend) {
1225 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Michael Krufkycb89cd32008-04-22 14:46:16 -03001226 &dev->i2c_adap, medion_cardbus.tuner_address,
1227 TUNER_PHILIPS_FMD1216ME_MK3);
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001228 }
Linus Torvalds1da177e2005-04-16 15:20:36 -07001229 break;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001230 case SAA7134_BOARD_PHILIPS_TOUGH:
Steven Toth363c35f2008-10-11 11:05:50 -03001231 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001232 &philips_tu1216_60_config,
1233 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001234 if (fe0->dvb.frontend) {
1235 fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init;
1236 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set;
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001237 }
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001238 break;
1239 case SAA7134_BOARD_FLYDVBTDUO:
Peter Missel10b7a902006-01-23 17:11:06 -02001240 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001241 if (configure_tda827x_fe(dev, &tda827x_lifeview_config,
1242 &tda827x_cfg_0) < 0)
1243 goto dettach_frontend;
Mauro Carvalho Chehab86ddd962005-07-12 13:58:47 -07001244 break;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001245 case SAA7134_BOARD_PHILIPS_EUROPA:
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001246 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
Danny Woode3c6e1a2009-09-20 12:14:21 -03001247 case SAA7134_BOARD_ASUS_EUROPA_HYBRID:
Steven Toth363c35f2008-10-11 11:05:50 -03001248 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001249 &philips_europa_config,
1250 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001251 if (fe0->dvb.frontend) {
1252 dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep;
1253 fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
1254 fe0->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init;
1255 fe0->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep;
1256 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001257 }
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001258 break;
Vadim Catana128fe952010-05-29 12:49:16 -03001259 case SAA7134_BOARD_TECHNOTREND_BUDGET_T3000:
1260 fe0->dvb.frontend = dvb_attach(tda10046_attach,
1261 &technotrend_budget_t3000_config,
1262 &dev->i2c_adap);
1263 if (fe0->dvb.frontend) {
1264 dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep;
1265 fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
1266 fe0->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init;
1267 fe0->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep;
1268 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;
1269 }
1270 break;
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001271 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
Steven Toth363c35f2008-10-11 11:05:50 -03001272 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001273 &philips_tu1216_61_config,
1274 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001275 if (fe0->dvb.frontend) {
1276 fe0->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init;
1277 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set;
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001278 }
Hartmut Hackmann2cf36ac2005-11-08 21:36:32 -08001279 break;
Simon Farnsworthb39423a2007-05-01 10:01:20 -03001280 case SAA7134_BOARD_KWORLD_DVBT_210:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001281 if (configure_tda827x_fe(dev, &kworld_dvb_t_210_config,
1282 &tda827x_cfg_2) < 0)
1283 goto dettach_frontend;
Simon Farnsworthb39423a2007-05-01 10:01:20 -03001284 break;
Michael Krufky0e316ec2009-08-03 16:51:33 -03001285 case SAA7134_BOARD_HAUPPAUGE_HVR1120:
Michael Krufky1bc7f512009-01-19 01:10:49 -03001286 fe0->dvb.frontend = dvb_attach(tda10048_attach,
1287 &hcw_tda10048_config,
1288 &dev->i2c_adap);
1289 if (fe0->dvb.frontend != NULL) {
1290 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1291 &dev->i2c_adap, 0x4b,
1292 &tda829x_no_probe);
1293 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1294 0x60, &dev->i2c_adap,
1295 &hcw_tda18271_config);
1296 }
1297 break;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -08001298 case SAA7134_BOARD_PHILIPS_TIGER:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001299 if (configure_tda827x_fe(dev, &philips_tiger_config,
1300 &tda827x_cfg_0) < 0)
1301 goto dettach_frontend;
Hartmut Hackmann587d2fd2006-10-06 19:13:50 -03001302 break;
1303 case SAA7134_BOARD_PINNACLE_PCTV_310i:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001304 if (configure_tda827x_fe(dev, &pinnacle_pctv_310i_config,
1305 &tda827x_cfg_1) < 0)
1306 goto dettach_frontend;
Hartmut Hackmann90e9df72005-11-08 21:38:42 -08001307 break;
Thomas Gentyc6e53da2006-11-05 14:17:30 -03001308 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001309 if (configure_tda827x_fe(dev, &hauppauge_hvr_1110_config,
1310 &tda827x_cfg_1) < 0)
1311 goto dettach_frontend;
Thomas Gentyc6e53da2006-11-05 14:17:30 -03001312 break;
Michael Krufkyb5f05062009-08-03 16:51:33 -03001313 case SAA7134_BOARD_HAUPPAUGE_HVR1150:
Michael Krufky3abdedd2009-01-19 01:10:49 -03001314 fe0->dvb.frontend = dvb_attach(lgdt3305_attach,
1315 &hcw_lgdt3305_config,
1316 &dev->i2c_adap);
1317 if (fe0->dvb.frontend) {
1318 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1319 &dev->i2c_adap, 0x4b,
1320 &tda829x_no_probe);
1321 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1322 0x60, &dev->i2c_adap,
1323 &hcw_tda18271_config);
1324 }
1325 break;
Hartmut Hackmannd4b0aba2005-11-08 21:38:44 -08001326 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001327 if (configure_tda827x_fe(dev, &asus_p7131_dual_config,
1328 &tda827x_cfg_0) < 0)
1329 goto dettach_frontend;
Hartmut Hackmannd4b0aba2005-11-08 21:38:44 -08001330 break;
Giampiero Giancipoli3d8466e2006-02-07 06:49:09 -02001331 case SAA7134_BOARD_FLYDVBT_LR301:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001332 if (configure_tda827x_fe(dev, &tda827x_lifeview_config,
1333 &tda827x_cfg_0) < 0)
1334 goto dettach_frontend;
Giampiero Giancipoli3d8466e2006-02-07 06:49:09 -02001335 break;
Darron Broad92abe9e2008-10-11 11:18:53 -03001336 case SAA7134_BOARD_FLYDVB_TRIO:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001337 if (!use_frontend) { /* terrestrial */
1338 if (configure_tda827x_fe(dev, &lifeview_trio_config,
1339 &tda827x_cfg_0) < 0)
1340 goto dettach_frontend;
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -03001341 } else { /* satellite */
Steven Toth363c35f2008-10-11 11:05:50 -03001342 fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, &dev->i2c_adap);
1343 if (fe0->dvb.frontend) {
1344 if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x63,
Nico Sabbi1f683cd2006-11-15 22:06:56 -03001345 &dev->i2c_adap, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001346 wprintk("%s: Lifeview Trio, No tda826x found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001347 goto dettach_frontend;
Nico Sabbi1f683cd2006-11-15 22:06:56 -03001348 }
Steven Toth363c35f2008-10-11 11:05:50 -03001349 if (dvb_attach(isl6421_attach, fe0->dvb.frontend, &dev->i2c_adap,
Nico Sabbi1f683cd2006-11-15 22:06:56 -03001350 0x08, 0, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001351 wprintk("%s: Lifeview Trio, No ISL6421 found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001352 goto dettach_frontend;
Nico Sabbi1f683cd2006-11-15 22:06:56 -03001353 }
1354 }
Andrew de Quincey6b3ccab2006-04-20 12:01:47 -03001355 }
Nico Sabbi420f32f2006-03-03 12:11:28 -03001356 break;
Hartmut Hackmanndf42eaf2006-02-07 06:49:10 -02001357 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
Hartmut Hackmannd95b8942006-03-27 19:39:30 -03001358 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS:
Steven Toth363c35f2008-10-11 11:05:50 -03001359 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001360 &ads_tech_duo_config,
1361 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001362 if (fe0->dvb.frontend) {
1363 if (dvb_attach(tda827x_attach,fe0->dvb.frontend,
Hartmut Hackmann7bff4b42008-04-22 14:46:08 -03001364 ads_tech_duo_config.tuner_address, &dev->i2c_adap,
1365 &ads_duo_cfg) == NULL) {
Trent Piephocf3c34c2007-03-07 18:19:48 -03001366 wprintk("no tda827x tuner found at addr: %02x\n",
Hartmut Hackmannede22002007-04-27 12:31:32 -03001367 ads_tech_duo_config.tuner_address);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001368 goto dettach_frontend;
Hartmut Hackmannede22002007-04-27 12:31:32 -03001369 }
Mauro Carvalho Chehabbc36ec7462008-06-14 10:44:04 -03001370 } else
1371 wprintk("failed to attach tda10046\n");
Hartmut Hackmannd95b8942006-03-27 19:39:30 -03001372 break;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001373 case SAA7134_BOARD_TEVION_DVBT_220RF:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001374 if (configure_tda827x_fe(dev, &tevion_dvbt220rf_config,
1375 &tda827x_cfg_0) < 0)
1376 goto dettach_frontend;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001377 break;
Hartmut Hackmann5eda2272006-08-07 14:03:32 -03001378 case SAA7134_BOARD_MEDION_MD8800_QUADRO:
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001379 if (!use_frontend) { /* terrestrial */
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001380 if (configure_tda827x_fe(dev, &md8800_dvbt_config,
1381 &tda827x_cfg_0) < 0)
1382 goto dettach_frontend;
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001383 } else { /* satellite */
Steven Toth363c35f2008-10-11 11:05:50 -03001384 fe0->dvb.frontend = dvb_attach(tda10086_attach,
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001385 &flydvbs, &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001386 if (fe0->dvb.frontend) {
1387 struct dvb_frontend *fe = fe0->dvb.frontend;
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001388 u8 dev_id = dev->eedata[2];
1389 u8 data = 0xc4;
1390 struct i2c_msg msg = {.addr = 0x08, .flags = 0, .len = 1};
1391
Steven Toth363c35f2008-10-11 11:05:50 -03001392 if (dvb_attach(tda826x_attach, fe0->dvb.frontend,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001393 0x60, &dev->i2c_adap, 0) == NULL) {
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001394 wprintk("%s: Medion Quadro, no tda826x "
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001395 "found !\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001396 goto dettach_frontend;
1397 }
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001398 if (dev_id != 0x08) {
1399 /* we need to open the i2c gate (we know it exists) */
1400 fe->ops.i2c_gate_ctrl(fe, 1);
1401 if (dvb_attach(isl6405_attach, fe,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001402 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001403 wprintk("%s: Medion Quadro, no ISL6405 "
1404 "found !\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001405 goto dettach_frontend;
1406 }
Hartmut Hackmanne9c1ac92008-04-22 14:46:10 -03001407 if (dev_id == 0x07) {
1408 /* fire up the 2nd section of the LNB supply since
1409 we can't do this from the other section */
1410 msg.buf = &data;
1411 i2c_transfer(&dev->i2c_adap, &msg, 1);
1412 }
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001413 fe->ops.i2c_gate_ctrl(fe, 0);
1414 dev->original_set_voltage = fe->ops.set_voltage;
1415 fe->ops.set_voltage = md8800_set_voltage;
1416 dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;
1417 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;
1418 } else {
1419 fe->ops.set_voltage = md8800_set_voltage2;
1420 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage2;
1421 }
Hartmut Hackmann4b1431c2008-04-22 14:42:09 -03001422 }
1423 }
Hartmut Hackmann5eda2272006-08-07 14:03:32 -03001424 break;
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001425 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
Steven Toth363c35f2008-10-11 11:05:50 -03001426 fe0->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001427 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001428 if (fe0->dvb.frontend)
1429 dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x61,
Michael Krufky47a99912007-06-12 16:10:51 -03001430 NULL, DVB_PLL_TDHU2);
Michael Krufky3b64e8e2005-11-08 21:38:20 -08001431 break;
Adam Gloverf689d902008-05-06 03:20:27 -03001432 case SAA7134_BOARD_ADS_INSTANT_HDTV_PCI:
Andrew Burri3e1410a2006-02-27 00:08:23 -03001433 case SAA7134_BOARD_KWORLD_ATSC110:
Steven Toth363c35f2008-10-11 11:05:50 -03001434 fe0->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001435 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001436 if (fe0->dvb.frontend)
1437 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Michael Krufky62ff8172008-04-22 14:46:17 -03001438 &dev->i2c_adap, 0x61,
1439 TUNER_PHILIPS_TUV1236D);
Andrew Burri3e1410a2006-02-27 00:08:23 -03001440 break;
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -03001441 case SAA7134_BOARD_FLYDVBS_LR300:
Steven Toth363c35f2008-10-11 11:05:50 -03001442 fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001443 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001444 if (fe0->dvb.frontend) {
1445 if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001446 &dev->i2c_adap, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001447 wprintk("%s: No tda826x found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001448 goto dettach_frontend;
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -03001449 }
Steven Toth363c35f2008-10-11 11:05:50 -03001450 if (dvb_attach(isl6421_attach, fe0->dvb.frontend,
Michael Krufkyf7b54b12006-08-08 15:48:08 -03001451 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001452 wprintk("%s: No ISL6421 found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001453 goto dettach_frontend;
Igor M. Liplianine2ac28f2006-08-08 09:10:10 -03001454 }
1455 }
1456 break;
Hartmut Hackmanncf146ca2006-10-02 20:49:24 -03001457 case SAA7134_BOARD_ASUS_EUROPA2_HYBRID:
Steven Toth363c35f2008-10-11 11:05:50 -03001458 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Matthias Schwarzott0e8f4cc2008-01-28 12:01:11 -03001459 &medion_cardbus,
1460 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001461 if (fe0->dvb.frontend) {
1462 dev->original_demod_sleep = fe0->dvb.frontend->ops.sleep;
1463 fe0->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
Trent Piephob7754d72007-05-08 18:05:16 -03001464
Steven Toth363c35f2008-10-11 11:05:50 -03001465 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Michael Krufkycb89cd32008-04-22 14:46:16 -03001466 &dev->i2c_adap, medion_cardbus.tuner_address,
1467 TUNER_PHILIPS_FMD1216ME_MK3);
Hartmut Hackmanncf146ca2006-10-02 20:49:24 -03001468 }
1469 break;
Hartmut Hackmanncbb94522006-10-30 20:00:16 -03001470 case SAA7134_BOARD_VIDEOMATE_DVBT_200A:
Steven Toth363c35f2008-10-11 11:05:50 -03001471 fe0->dvb.frontend = dvb_attach(tda10046_attach,
Hartmut Hackmanncbb94522006-10-30 20:00:16 -03001472 &philips_europa_config,
1473 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001474 if (fe0->dvb.frontend) {
1475 fe0->dvb.frontend->ops.tuner_ops.init = philips_td1316_tuner_init;
1476 fe0->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params;
Hartmut Hackmanncbb94522006-10-30 20:00:16 -03001477 }
1478 break;
Hartmut Hackmann550a9a52006-11-15 21:31:54 -03001479 case SAA7134_BOARD_CINERGY_HT_PCMCIA:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001480 if (configure_tda827x_fe(dev, &cinergy_ht_config,
1481 &tda827x_cfg_0) < 0)
1482 goto dettach_frontend;
Hartmut Hackmann550a9a52006-11-15 21:31:54 -03001483 break;
Michael Krufky9de271e2007-01-16 18:36:40 -03001484 case SAA7134_BOARD_CINERGY_HT_PCI:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001485 if (configure_tda827x_fe(dev, &cinergy_ht_pci_config,
1486 &tda827x_cfg_0) < 0)
1487 goto dettach_frontend;
Hartmut Hackmann58ef4f92007-04-27 12:31:12 -03001488 break;
1489 case SAA7134_BOARD_PHILIPS_TIGER_S:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001490 if (configure_tda827x_fe(dev, &philips_tiger_s_config,
1491 &tda827x_cfg_2) < 0)
1492 goto dettach_frontend;
Michael Krufky9de271e2007-01-16 18:36:40 -03001493 break;
Hartmut Hackmanne06cea42007-03-13 20:58:29 -03001494 case SAA7134_BOARD_ASUS_P7131_4871:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001495 if (configure_tda827x_fe(dev, &asus_p7131_4871_config,
1496 &tda827x_cfg_2) < 0)
1497 goto dettach_frontend;
Hartmut Hackmanne06cea42007-03-13 20:58:29 -03001498 break;
Hartmut Hackmannf3eec0c02007-03-14 20:33:55 -03001499 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001500 if (configure_tda827x_fe(dev, &asus_p7131_hybrid_lna_config,
1501 &tda827x_cfg_2) < 0)
1502 goto dettach_frontend;
Hartmut Hackmanne06cea42007-03-13 20:58:29 -03001503 break;
Edgar Simod90d9f52007-08-20 14:14:50 -03001504 case SAA7134_BOARD_AVERMEDIA_SUPER_007:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001505 if (configure_tda827x_fe(dev, &avermedia_super_007_config,
1506 &tda827x_cfg_0) < 0)
1507 goto dettach_frontend;
Edgar Simod90d9f52007-08-20 14:14:50 -03001508 break;
Hermann Pitton4ba24372008-01-20 19:27:51 -03001509 case SAA7134_BOARD_TWINHAN_DTV_DVB_3056:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001510 if (configure_tda827x_fe(dev, &twinhan_dtv_dvb_3056_config,
1511 &tda827x_cfg_2_sw42) < 0)
1512 goto dettach_frontend;
Hermann Pitton4ba24372008-01-20 19:27:51 -03001513 break;
Hartmut Hackmann6ab465a2008-04-22 14:42:11 -03001514 case SAA7134_BOARD_PHILIPS_SNAKE:
Steven Toth363c35f2008-10-11 11:05:50 -03001515 fe0->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
Hartmut Hackmann6ab465a2008-04-22 14:42:11 -03001516 &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001517 if (fe0->dvb.frontend) {
1518 if (dvb_attach(tda826x_attach, fe0->dvb.frontend, 0x60,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001519 &dev->i2c_adap, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001520 wprintk("%s: No tda826x found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001521 goto dettach_frontend;
1522 }
Steven Toth363c35f2008-10-11 11:05:50 -03001523 if (dvb_attach(lnbp21_attach, fe0->dvb.frontend,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001524 &dev->i2c_adap, 0, 0) == NULL) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001525 wprintk("%s: No lnbp21 found!\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001526 goto dettach_frontend;
1527 }
Hartmut Hackmann6ab465a2008-04-22 14:42:11 -03001528 }
1529 break;
Hermann Pitton7b5b3f12008-04-22 14:42:12 -03001530 case SAA7134_BOARD_CREATIX_CTX953:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001531 if (configure_tda827x_fe(dev, &md8800_dvbt_config,
1532 &tda827x_cfg_0) < 0)
1533 goto dettach_frontend;
Hermann Pitton7b5b3f12008-04-22 14:42:12 -03001534 break;
Russell Kliese6a6179b62008-04-22 14:42:12 -03001535 case SAA7134_BOARD_MSI_TVANYWHERE_AD11:
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001536 if (configure_tda827x_fe(dev, &philips_tiger_s_config,
1537 &tda827x_cfg_2) < 0)
1538 goto dettach_frontend;
Russell Kliese6a6179b62008-04-22 14:42:12 -03001539 break;
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001540 case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
Tim Farrington6e501a32008-06-15 13:33:42 -03001541 dprintk("AverMedia E506R dvb setup\n");
1542 saa7134_set_gpio(dev, 25, 0);
1543 msleep(10);
1544 saa7134_set_gpio(dev, 25, 1);
Steven Toth363c35f2008-10-11 11:05:50 -03001545 fe0->dvb.frontend = dvb_attach(mt352_attach,
Tim Farrington6e501a32008-06-15 13:33:42 -03001546 &avermedia_xc3028_mt352_dev,
1547 &dev->i2c_adap);
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001548 attach_xc3028 = 1;
Massimo Piccionie2fc00c2008-07-11 13:48:02 -03001549 break;
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001550 case SAA7134_BOARD_MD7134_BRIDGE_2:
Steven Toth363c35f2008-10-11 11:05:50 -03001551 fe0->dvb.frontend = dvb_attach(tda10086_attach,
Hartmut Hackmann9a1b04e2008-04-09 23:07:11 -03001552 &sd1878_4m, &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001553 if (fe0->dvb.frontend) {
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001554 struct dvb_frontend *fe;
Steven Toth363c35f2008-10-11 11:05:50 -03001555 if (dvb_attach(dvb_pll_attach, fe0->dvb.frontend, 0x60,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001556 &dev->i2c_adap, DVB_PLL_PHILIPS_SD1878_TDA8261) == NULL) {
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001557 wprintk("%s: MD7134 DVB-S, no SD1878 "
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001558 "found !\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001559 goto dettach_frontend;
1560 }
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001561 /* we need to open the i2c gate (we know it exists) */
Steven Toth363c35f2008-10-11 11:05:50 -03001562 fe = fe0->dvb.frontend;
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001563 fe->ops.i2c_gate_ctrl(fe, 1);
1564 if (dvb_attach(isl6405_attach, fe,
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001565 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001566 wprintk("%s: MD7134 DVB-S, no ISL6405 "
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001567 "found !\n", __func__);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001568 goto dettach_frontend;
1569 }
Hartmut Hackmann637afdb2008-04-22 14:46:08 -03001570 fe->ops.i2c_gate_ctrl(fe, 0);
1571 dev->original_set_voltage = fe->ops.set_voltage;
1572 fe->ops.set_voltage = md8800_set_voltage;
1573 dev->original_set_high_voltage = fe->ops.enable_high_lnb_voltage;
1574 fe->ops.enable_high_lnb_voltage = md8800_set_high_voltage;
1575 }
1576 break;
Massimo Piccionie2fc00c2008-07-11 13:48:02 -03001577 case SAA7134_BOARD_AVERMEDIA_M103:
1578 saa7134_set_gpio(dev, 25, 0);
1579 msleep(10);
1580 saa7134_set_gpio(dev, 25, 1);
Steven Toth363c35f2008-10-11 11:05:50 -03001581 fe0->dvb.frontend = dvb_attach(mt352_attach,
Massimo Piccionie2fc00c2008-07-11 13:48:02 -03001582 &avermedia_xc3028_mt352_dev,
1583 &dev->i2c_adap);
1584 attach_xc3028 = 1;
1585 break;
hermann pitton301e9d62008-09-14 17:49:14 -03001586 case SAA7134_BOARD_ASUSTeK_TIGER_3IN1:
1587 if (!use_frontend) { /* terrestrial */
1588 if (configure_tda827x_fe(dev, &asus_tiger_3in1_config,
1589 &tda827x_cfg_2) < 0)
1590 goto dettach_frontend;
1591 } else { /* satellite */
Steven Toth363c35f2008-10-11 11:05:50 -03001592 fe0->dvb.frontend = dvb_attach(tda10086_attach,
hermann pitton301e9d62008-09-14 17:49:14 -03001593 &flydvbs, &dev->i2c_adap);
Steven Toth363c35f2008-10-11 11:05:50 -03001594 if (fe0->dvb.frontend) {
hermann pitton301e9d62008-09-14 17:49:14 -03001595 if (dvb_attach(tda826x_attach,
Steven Toth363c35f2008-10-11 11:05:50 -03001596 fe0->dvb.frontend, 0x60,
hermann pitton301e9d62008-09-14 17:49:14 -03001597 &dev->i2c_adap, 0) == NULL) {
1598 wprintk("%s: Asus Tiger 3in1, no "
1599 "tda826x found!\n", __func__);
1600 goto dettach_frontend;
1601 }
Steven Toth363c35f2008-10-11 11:05:50 -03001602 if (dvb_attach(lnbp21_attach, fe0->dvb.frontend,
hermann pitton301e9d62008-09-14 17:49:14 -03001603 &dev->i2c_adap, 0, 0) == NULL) {
1604 wprintk("%s: Asus Tiger 3in1, no lnbp21"
1605 " found!\n", __func__);
1606 goto dettach_frontend;
1607 }
1608 }
1609 }
1610 break;
Hermann Pitton028165a2008-10-04 21:37:36 -03001611 case SAA7134_BOARD_ASUSTeK_TIGER:
1612 if (configure_tda827x_fe(dev, &philips_tiger_config,
1613 &tda827x_cfg_0) < 0)
1614 goto dettach_frontend;
1615 break;
Dmitri Belimov47aeba52008-12-23 03:53:03 -03001616 case SAA7134_BOARD_BEHOLD_H6:
Mauro Carvalho Chehabb0c4be82008-12-30 19:10:09 -03001617 fe0->dvb.frontend = dvb_attach(zl10353_attach,
Dmitri Belimov47aeba52008-12-23 03:53:03 -03001618 &behold_h6_config,
1619 &dev->i2c_adap);
Mauro Carvalho Chehabb0c4be82008-12-30 19:10:09 -03001620 if (fe0->dvb.frontend) {
1621 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
Dmitri Belimov47aeba52008-12-23 03:53:03 -03001622 &dev->i2c_adap, 0x61,
Beholder Intl. Ltd. Dmitry Belimov4786dd62009-08-04 20:07:42 -03001623 TUNER_PHILIPS_FMD1216MEX_MK3);
Dmitri Belimov47aeba52008-12-23 03:53:03 -03001624 }
1625 break;
Beholder Intl. Ltd. Dmitry Belimov29309922009-09-30 23:02:21 -03001626 case SAA7134_BOARD_BEHOLD_X7:
1627 fe0->dvb.frontend = dvb_attach(zl10353_attach,
1628 &behold_x7_config,
1629 &dev->i2c_adap);
1630 if (fe0->dvb.frontend) {
1631 dvb_attach(xc5000_attach, fe0->dvb.frontend,
1632 &dev->i2c_adap, &behold_x7_tunerconfig);
1633 }
1634 break;
Dmitri Belimov0faa2ed2010-04-06 01:00:05 -03001635 case SAA7134_BOARD_BEHOLD_H7:
1636 fe0->dvb.frontend = dvb_attach(zl10353_attach,
1637 &behold_x7_config,
1638 &dev->i2c_adap);
1639 if (fe0->dvb.frontend) {
1640 dvb_attach(xc5000_attach, fe0->dvb.frontend,
1641 &dev->i2c_adap, &behold_x7_tunerconfig);
1642 }
1643 break;
Matthias Schwarzott04574182009-02-24 12:35:16 -03001644 case SAA7134_BOARD_AVERMEDIA_A700_PRO:
1645 case SAA7134_BOARD_AVERMEDIA_A700_HYBRID:
1646 /* Zarlink ZL10313 */
1647 fe0->dvb.frontend = dvb_attach(mt312_attach,
1648 &avertv_a700_mt312, &dev->i2c_adap);
1649 if (fe0->dvb.frontend) {
1650 if (dvb_attach(zl10036_attach, fe0->dvb.frontend,
1651 &avertv_a700_tuner, &dev->i2c_adap) == NULL) {
1652 wprintk("%s: No zl10036 found!\n",
1653 __func__);
1654 }
1655 }
1656 break;
Igor M. Liplianinecfcfec2009-08-13 21:42:21 -03001657 case SAA7134_BOARD_VIDEOMATE_S350:
1658 fe0->dvb.frontend = dvb_attach(mt312_attach,
1659 &zl10313_compro_s350_config, &dev->i2c_adap);
1660 if (fe0->dvb.frontend)
1661 if (dvb_attach(zl10039_attach, fe0->dvb.frontend,
1662 0x60, &dev->i2c_adap) == NULL)
1663 wprintk("%s: No zl10039 found!\n",
1664 __func__);
1665
1666 break;
Carlos Corbachodbe87402011-06-25 10:24:28 -03001667 case SAA7134_BOARD_VIDEOMATE_T750:
1668 fe0->dvb.frontend = dvb_attach(zl10353_attach,
1669 &videomate_t750_zl10353_config,
1670 &dev->i2c_adap);
1671 if (fe0->dvb.frontend != NULL) {
1672 if (dvb_attach(qt1010_attach,
1673 fe0->dvb.frontend,
1674 &dev->i2c_adap,
1675 &videomate_t750_qt1010_config) == NULL)
1676 wprintk("error attaching QT1010\n");
1677 }
1678 break;
Henk Vergonet6c119ff2009-09-18 20:44:37 -03001679 case SAA7134_BOARD_ZOLID_HYBRID_PCI:
1680 fe0->dvb.frontend = dvb_attach(tda10048_attach,
1681 &zolid_tda10048_config,
1682 &dev->i2c_adap);
1683 if (fe0->dvb.frontend != NULL) {
1684 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1685 &dev->i2c_adap, 0x4b,
1686 &tda829x_no_probe);
1687 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1688 0x60, &dev->i2c_adap,
1689 &zolid_tda18271_config);
1690 }
1691 break;
Michael Krufky184e7692009-06-05 04:28:28 -03001692 case SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S:
1693 fe0->dvb.frontend = dvb_attach(tda10048_attach,
1694 &dtv1000s_tda10048_config,
1695 &dev->i2c_adap);
1696 if (fe0->dvb.frontend != NULL) {
1697 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1698 &dev->i2c_adap, 0x4b,
1699 &tda829x_no_probe);
1700 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1701 0x60, &dev->i2c_adap,
1702 &dtv1000s_tda18271_config);
1703 }
1704 break;
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001705 case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG:
Mauro Carvalho Chehabecb71d22011-01-14 12:03:03 -03001706 /* Switch to digital mode */
1707 saa7134_tuner_callback(dev, 0,
1708 TDA18271_CALLBACK_CMD_AGC_ENABLE, 1);
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001709 fe0->dvb.frontend = dvb_attach(mb86a20s_attach,
1710 &kworld_mb86a20s_config,
1711 &dev->i2c_adap);
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001712 if (fe0->dvb.frontend != NULL) {
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -03001713 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1714 &dev->i2c_adap, 0x4b,
1715 &tda829x_no_probe);
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001716 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1717 0x60, &dev->i2c_adap,
1718 &kworld_tda18271_config);
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -03001719 fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_gate_ctrl;
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001720 }
Mauro Carvalho Chehab6a58bc02011-01-14 09:11:21 -03001721
1722 /* mb86a20s need to use the I2C gateway */
Mauro Carvalho Chehabf0551ef2010-10-03 07:01:26 -03001723 break;
Timothy Leece027042011-03-25 15:00:33 -03001724 case SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2:
1725 fe0->dvb.frontend = dvb_attach(lgs8gxx_attach,
1726 &prohdtv_pro2_lgs8g75_config,
1727 &dev->i2c_adap);
1728 if (fe0->dvb.frontend != NULL) {
1729 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1730 &dev->i2c_adap, 0x4b,
1731 &tda829x_no_probe);
1732 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1733 0x60, &dev->i2c_adap,
1734 &prohdtv_pro2_tda18271_config);
1735 }
1736 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001737 default:
Trent Piephocf3c34c2007-03-07 18:19:48 -03001738 wprintk("Huh? unknown DVB card?\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -07001739 break;
1740 }
1741
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001742 if (attach_xc3028) {
1743 struct dvb_frontend *fe;
1744 struct xc2028_config cfg = {
1745 .i2c_adap = &dev->i2c_adap,
1746 .i2c_addr = 0x61,
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001747 };
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -03001748
Steven Toth363c35f2008-10-11 11:05:50 -03001749 if (!fe0->dvb.frontend)
Darron Broadf3f741e2008-11-11 08:50:02 -03001750 goto dettach_frontend;
Mauro Carvalho Chehab95a2fdb2008-03-28 17:52:44 -03001751
Steven Toth363c35f2008-10-11 11:05:50 -03001752 fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg);
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001753 if (!fe) {
1754 printk(KERN_ERR "%s/2: xc3028 attach failed\n",
1755 dev->name);
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001756 goto dettach_frontend;
Mauro Carvalho Chehabbc36a682008-04-22 14:45:27 -03001757 }
1758 }
1759
Steven Toth363c35f2008-10-11 11:05:50 -03001760 if (NULL == fe0->dvb.frontend) {
Trent Piephocf3c34c2007-03-07 18:19:48 -03001761 printk(KERN_ERR "%s/dvb: frontend initialization failed\n", dev->name);
Darron Broadf3f741e2008-11-11 08:50:02 -03001762 goto dettach_frontend;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001763 }
Michael Krufkyd7cba042008-09-12 13:31:45 -03001764 /* define general-purpose callback pointer */
Steven Toth363c35f2008-10-11 11:05:50 -03001765 fe0->dvb.frontend->callback = saa7134_tuner_callback;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001766
1767 /* register everything else */
Steven Toth363c35f2008-10-11 11:05:50 -03001768 ret = videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
Michael Krufky9133aee2009-05-23 18:00:59 -03001769 &dev->pci->dev, adapter_nr, 0, NULL);
Hartmut Hackmann1c4f76a2007-04-27 12:31:16 -03001770
1771 /* this sequence is necessary to make the tda1004x load its firmware
1772 * and to enter analog mode of hybrid boards
1773 */
1774 if (!ret) {
Steven Toth363c35f2008-10-11 11:05:50 -03001775 if (fe0->dvb.frontend->ops.init)
1776 fe0->dvb.frontend->ops.init(fe0->dvb.frontend);
1777 if (fe0->dvb.frontend->ops.sleep)
1778 fe0->dvb.frontend->ops.sleep(fe0->dvb.frontend);
1779 if (fe0->dvb.frontend->ops.tuner_ops.sleep)
1780 fe0->dvb.frontend->ops.tuner_ops.sleep(fe0->dvb.frontend);
Hartmut Hackmann1c4f76a2007-04-27 12:31:16 -03001781 }
1782 return ret;
Mauro Carvalho Chehabd557dab2008-04-30 15:27:55 -03001783
1784dettach_frontend:
Darron Broadf3f741e2008-11-11 08:50:02 -03001785 videobuf_dvb_dealloc_frontends(&dev->frontends);
1786 return -EINVAL;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001787}
1788
1789static int dvb_fini(struct saa7134_dev *dev)
1790{
Steven Toth363c35f2008-10-11 11:05:50 -03001791 struct videobuf_dvb_frontend *fe0;
1792
1793 /* Get the first frontend */
1794 fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
1795 if (!fe0)
1796 return -EINVAL;
1797
Mauro Carvalho Chehab7f171122007-10-18 19:56:47 -03001798 /* FIXME: I suspect that this code is bogus, since the entry for
1799 Pinnacle 300I DVB-T PAL already defines the proper init to allow
1800 the detection of mt2032 (TDA9887_PORT2_INACTIVE)
1801 */
1802 if (dev->board == SAA7134_BOARD_PINNACLE_300I_DVBT_PAL) {
1803 struct v4l2_priv_tun_config tda9887_cfg;
1804 static int on = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001805
Mauro Carvalho Chehab7f171122007-10-18 19:56:47 -03001806 tda9887_cfg.tuner = TUNER_TDA9887;
1807 tda9887_cfg.priv = &on;
1808
Linus Torvalds1da177e2005-04-16 15:20:36 -07001809 /* otherwise we don't detect the tuner on next insmod */
Hans Verkuilfac69862009-01-17 12:17:14 -03001810 saa_call_all(dev, tuner, s_config, &tda9887_cfg);
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001811 } else if (dev->board == SAA7134_BOARD_MEDION_MD8800_QUADRO) {
Hartmut Hackmanne9c1ac92008-04-22 14:46:10 -03001812 if ((dev->eedata[2] == 0x07) && use_frontend) {
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001813 /* turn off the 2nd lnb supply */
1814 u8 data = 0x80;
1815 struct i2c_msg msg = {.addr = 0x08, .buf = &data, .flags = 0, .len = 1};
1816 struct dvb_frontend *fe;
Steven Toth363c35f2008-10-11 11:05:50 -03001817 fe = fe0->dvb.frontend;
Hartmut Hackmann5823b3a2008-04-22 14:46:08 -03001818 if (fe->ops.i2c_gate_ctrl) {
1819 fe->ops.i2c_gate_ctrl(fe, 1);
1820 i2c_transfer(&dev->i2c_adap, &msg, 1);
1821 fe->ops.i2c_gate_ctrl(fe, 0);
1822 }
1823 }
Mauro Carvalho Chehab7f171122007-10-18 19:56:47 -03001824 }
Darron Broadf3f741e2008-11-11 08:50:02 -03001825 videobuf_dvb_unregister_bus(&dev->frontends);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001826 return 0;
1827}
1828
1829static struct saa7134_mpeg_ops dvb_ops = {
1830 .type = SAA7134_MPEG_DVB,
1831 .init = dvb_init,
1832 .fini = dvb_fini,
1833};
1834
1835static int __init dvb_register(void)
1836{
1837 return saa7134_ts_register(&dvb_ops);
1838}
1839
1840static void __exit dvb_unregister(void)
1841{
1842 saa7134_ts_unregister(&dvb_ops);
1843}
1844
1845module_init(dvb_register);
1846module_exit(dvb_unregister);
1847
1848/* ------------------------------------------------------------------ */
1849/*
1850 * Local variables:
1851 * c-basic-offset: 8
1852 * End:
1853 */