63
67
module_param(debug, int, 0644);
64
68
MODULE_PARM_DESC(debug,"enable debug messages [dvb]");
70
static unsigned int dvb_buf_tscnt = 32;
71
module_param(dvb_buf_tscnt, int, 0644);
72
MODULE_PARM_DESC(dvb_buf_tscnt, "DVB Buffer TS count [dvb]");
66
74
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
68
76
#define dprintk(level,fmt, arg...) if (debug >= level) \
165
173
static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
167
static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
168
static u8 reset [] = { RESET, 0x80 };
169
static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
170
static u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
171
static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
172
static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
175
static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
176
static const u8 reset [] = { RESET, 0x80 };
177
static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
178
static const u8 agc_cfg [] = { AGC_TARGET, 0x24, 0x20 };
179
static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
180
static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
174
182
mt352_write(fe, clock_config, sizeof(clock_config));
185
193
static int dvico_dual_demod_init(struct dvb_frontend *fe)
187
static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 };
188
static u8 reset [] = { RESET, 0x80 };
189
static u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
190
static u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
191
static u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
192
static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
195
static const u8 clock_config [] = { CLOCK_CTL, 0x38, 0x38 };
196
static const u8 reset [] = { RESET, 0x80 };
197
static const u8 adc_ctl_1_cfg [] = { ADC_CTL_1, 0x40 };
198
static const u8 agc_cfg [] = { AGC_TARGET, 0x28, 0x20 };
199
static const u8 gpp_ctl_cfg [] = { GPP_CTL, 0x33 };
200
static const u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
194
202
mt352_write(fe, clock_config, sizeof(clock_config));
206
214
static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe)
208
static u8 clock_config [] = { 0x89, 0x38, 0x39 };
209
static u8 reset [] = { 0x50, 0x80 };
210
static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
211
static u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
216
static const u8 clock_config [] = { 0x89, 0x38, 0x39 };
217
static const u8 reset [] = { 0x50, 0x80 };
218
static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
219
static const u8 agc_cfg [] = { 0x67, 0x10, 0x23, 0x00, 0xFF, 0xFF,
212
220
0x00, 0xFF, 0x00, 0x40, 0x40 };
213
static u8 dntv_extra[] = { 0xB5, 0x7A };
214
static u8 capt_range_cfg[] = { 0x75, 0x32 };
221
static const u8 dntv_extra[] = { 0xB5, 0x7A };
222
static const u8 capt_range_cfg[] = { 0x75, 0x32 };
216
224
mt352_write(fe, clock_config, sizeof(clock_config));
229
static struct mt352_config dvico_fusionhdtv = {
237
static const struct mt352_config dvico_fusionhdtv = {
230
238
.demod_address = 0x0f,
231
239
.demod_init = dvico_fusionhdtv_demod_init,
234
static struct mt352_config dntv_live_dvbt_config = {
242
static const struct mt352_config dntv_live_dvbt_config = {
235
243
.demod_address = 0x0f,
236
244
.demod_init = dntv_live_dvbt_demod_init,
239
static struct mt352_config dvico_fusionhdtv_dual = {
247
static const struct mt352_config dvico_fusionhdtv_dual = {
240
248
.demod_address = 0x0f,
241
249
.demod_init = dvico_dual_demod_init,
244
static struct zl10353_config cx88_terratec_cinergy_ht_pci_mkii_config = {
252
static const struct zl10353_config cx88_terratec_cinergy_ht_pci_mkii_config = {
245
253
.demod_address = (0x1e >> 1),
258
static struct mb86a16_config twinhan_vp1027 = {
259
.demod_address = 0x08,
250
262
#if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE))
251
263
static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe)
253
static u8 clock_config [] = { 0x89, 0x38, 0x38 };
254
static u8 reset [] = { 0x50, 0x80 };
255
static u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
256
static u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF,
265
static const u8 clock_config [] = { 0x89, 0x38, 0x38 };
266
static const u8 reset [] = { 0x50, 0x80 };
267
static const u8 adc_ctl_1_cfg [] = { 0x8E, 0x40 };
268
static const u8 agc_cfg [] = { 0x67, 0x10, 0x20, 0x00, 0xFF, 0xFF,
257
269
0x00, 0xFF, 0x00, 0x40, 0x40 };
258
static u8 dntv_extra[] = { 0xB5, 0x7A };
259
static u8 capt_range_cfg[] = { 0x75, 0x32 };
270
static const u8 dntv_extra[] = { 0xB5, 0x7A };
271
static const u8 capt_range_cfg[] = { 0x75, 0x32 };
261
273
mt352_write(fe, clock_config, sizeof(clock_config));
274
static struct mt352_config dntv_live_dvbt_pro_config = {
286
static const struct mt352_config dntv_live_dvbt_pro_config = {
275
287
.demod_address = 0x0f,
277
289
.demod_init = dntv_live_dvbt_pro_demod_init,
281
static struct zl10353_config dvico_fusionhdtv_hybrid = {
293
static const struct zl10353_config dvico_fusionhdtv_hybrid = {
282
294
.demod_address = 0x0f,
286
static struct zl10353_config dvico_fusionhdtv_xc3028 = {
298
static const struct zl10353_config dvico_fusionhdtv_xc3028 = {
287
299
.demod_address = 0x0f,
292
static struct mt352_config dvico_fusionhdtv_mt352_xc3028 = {
304
static const struct mt352_config dvico_fusionhdtv_mt352_xc3028 = {
293
305
.demod_address = 0x0f,
296
308
.demod_init = dvico_fusionhdtv_demod_init,
299
static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = {
311
static const struct zl10353_config dvico_fusionhdtv_plus_v1_1 = {
300
312
.demod_address = 0x0f,
303
static struct cx22702_config connexant_refboard_config = {
315
static const struct cx22702_config connexant_refboard_config = {
304
316
.demod_address = 0x43,
305
317
.output_mode = CX22702_SERIAL_OUTPUT,
308
static struct cx22702_config hauppauge_hvr_config = {
320
static const struct cx22702_config hauppauge_hvr_config = {
309
321
.demod_address = 0x63,
310
322
.output_mode = CX22702_SERIAL_OUTPUT,
352
364
.set_ts_params = lgdt330x_set_ts_param,
355
static struct lgdt330x_config fusionhdtv_5_gold = {
367
static const struct lgdt330x_config fusionhdtv_5_gold = {
356
368
.demod_address = 0x0e,
357
369
.demod_chip = LGDT3303,
358
370
.serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
359
371
.set_ts_params = lgdt330x_set_ts_param,
362
static struct lgdt330x_config pchdtv_hd5500 = {
374
static const struct lgdt330x_config pchdtv_hd5500 = {
363
375
.demod_address = 0x59,
364
376
.demod_chip = LGDT3303,
365
377
.serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
427
439
cx_set(MO_GP0_IO, 0x6040);
428
440
switch (voltage) {
430
cx_clear(MO_GP0_IO, 0x20);
433
cx_set(MO_GP0_IO, 0x20);
435
case SEC_VOLTAGE_OFF:
436
cx_clear(MO_GP0_IO, 0x20);
440
if (core->prev_set_voltage)
441
return core->prev_set_voltage(fe, voltage);
445
static struct cx24123_config geniatech_dvbs_config = {
446
.demod_address = 0x55,
447
.set_ts_params = cx24123_set_ts_param,
450
static struct cx24123_config hauppauge_novas_config = {
451
.demod_address = 0x55,
452
.set_ts_params = cx24123_set_ts_param,
455
static struct cx24123_config kworld_dvbs_100_config = {
442
cx_clear(MO_GP0_IO, 0x20);
445
cx_set(MO_GP0_IO, 0x20);
447
case SEC_VOLTAGE_OFF:
448
cx_clear(MO_GP0_IO, 0x20);
452
if (core->prev_set_voltage)
453
return core->prev_set_voltage(fe, voltage);
457
static int vp1027_set_voltage(struct dvb_frontend *fe,
458
fe_sec_voltage_t voltage)
460
struct cx8802_dev *dev = fe->dvb->priv;
461
struct cx88_core *core = dev->core;
465
dprintk(1, "LNB SEC Voltage=13\n");
466
cx_write(MO_GP0_IO, 0x00001220);
469
dprintk(1, "LNB SEC Voltage=18\n");
470
cx_write(MO_GP0_IO, 0x00001222);
472
case SEC_VOLTAGE_OFF:
473
dprintk(1, "LNB Voltage OFF\n");
474
cx_write(MO_GP0_IO, 0x00001230);
478
if (core->prev_set_voltage)
479
return core->prev_set_voltage(fe, voltage);
483
static const struct cx24123_config geniatech_dvbs_config = {
484
.demod_address = 0x55,
485
.set_ts_params = cx24123_set_ts_param,
488
static const struct cx24123_config hauppauge_novas_config = {
489
.demod_address = 0x55,
490
.set_ts_params = cx24123_set_ts_param,
493
static const struct cx24123_config kworld_dvbs_100_config = {
456
494
.demod_address = 0x15,
457
495
.set_ts_params = cx24123_set_ts_param,
458
496
.lnb_polarity = 1,
461
static struct s5h1409_config pinnacle_pctv_hd_800i_config = {
499
static const struct s5h1409_config pinnacle_pctv_hd_800i_config = {
462
500
.demod_address = 0x32 >> 1,
463
501
.output_mode = S5H1409_PARALLEL_OUTPUT,
464
502
.gpio = S5H1409_GPIO_ON,
468
506
.mpeg_timing = S5H1409_MPEGTIMING_NONCONTINOUS_NONINVERTING_CLOCK,
471
static struct s5h1409_config dvico_hdtv5_pci_nano_config = {
509
static const struct s5h1409_config dvico_hdtv5_pci_nano_config = {
472
510
.demod_address = 0x32 >> 1,
473
511
.output_mode = S5H1409_SERIAL_OUTPUT,
474
512
.gpio = S5H1409_GPIO_OFF,
477
515
.mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
480
static struct s5h1409_config kworld_atsc_120_config = {
518
static const struct s5h1409_config kworld_atsc_120_config = {
481
519
.demod_address = 0x32 >> 1,
482
520
.output_mode = S5H1409_SERIAL_OUTPUT,
483
521
.gpio = S5H1409_GPIO_OFF,
486
524
.mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
489
static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = {
527
static const struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = {
490
528
.i2c_address = 0x64,
494
static struct zl10353_config cx88_pinnacle_hybrid_pctv = {
532
static const struct zl10353_config cx88_pinnacle_hybrid_pctv = {
495
533
.demod_address = (0x1e >> 1),
500
static struct zl10353_config cx88_geniatech_x8000_mt = {
538
static const struct zl10353_config cx88_geniatech_x8000_mt = {
501
539
.demod_address = (0x1e >> 1),
503
541
.disable_i2c_gate_ctrl = 1,
506
static struct s5h1411_config dvico_fusionhdtv7_config = {
544
static const struct s5h1411_config dvico_fusionhdtv7_config = {
507
545
.output_mode = S5H1411_SERIAL_OUTPUT,
508
546
.gpio = S5H1411_GPIO_ON,
509
547
.mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,
592
static struct cx24116_config hauppauge_hvr4000_config = {
639
static const struct cx24116_config hauppauge_hvr4000_config = {
593
640
.demod_address = 0x05,
594
641
.set_ts_params = cx24116_set_ts_param,
595
642
.reset_device = cx24116_reset_device,
598
static struct cx24116_config tevii_s460_config = {
645
static const struct cx24116_config tevii_s460_config = {
599
646
.demod_address = 0x55,
600
647
.set_ts_params = cx24116_set_ts_param,
601
648
.reset_device = cx24116_reset_device,
604
static struct stv0299_config tevii_tuner_sharp_config = {
651
static const struct stv0900_config prof_7301_stv0900_config = {
652
.demod_address = 0x6a,
655
.clkmode = 3,/* 0-CLKI, 2-XTALI, else AUTO */
656
.diseqc_mode = 2,/* 2/3 PWM */
657
.tun1_maddress = 0,/* 0x60 */
658
.tun1_adc = 0,/* 2 Vpp */
660
.set_ts_params = stv0900_set_ts_param,
663
static const struct stb6100_config prof_7301_stb6100_config = {
664
.tuner_address = 0x60,
665
.refclock = 27000000,
668
static const struct stv0299_config tevii_tuner_sharp_config = {
605
669
.demod_address = 0x68,
606
670
.inittab = sharp_z0194a_inittab,
607
671
.mclk = 88000000UL,
714
static const u8 samsung_smt_7020_inittab[] = {
766
static int samsung_smt_7020_tuner_set_params(struct dvb_frontend *fe,
767
struct dvb_frontend_parameters *params)
769
struct cx8802_dev *dev = fe->dvb->priv;
772
struct i2c_msg msg = {
776
.len = sizeof(buf) };
778
div = params->frequency / 125;
780
buf[0] = (div >> 8) & 0x7f;
782
buf[2] = 0x84; /* 0xC4 */
785
if (params->frequency < 1500000)
788
if (fe->ops.i2c_gate_ctrl)
789
fe->ops.i2c_gate_ctrl(fe, 1);
791
if (i2c_transfer(&dev->core->i2c_adap, &msg, 1) != 1)
797
static int samsung_smt_7020_set_tone(struct dvb_frontend *fe,
798
fe_sec_tone_mode_t tone)
800
struct cx8802_dev *dev = fe->dvb->priv;
801
struct cx88_core *core = dev->core;
803
cx_set(MO_GP0_IO, 0x0800);
807
cx_set(MO_GP0_IO, 0x08);
810
cx_clear(MO_GP0_IO, 0x08);
819
static int samsung_smt_7020_set_voltage(struct dvb_frontend *fe,
820
fe_sec_voltage_t voltage)
822
struct cx8802_dev *dev = fe->dvb->priv;
823
struct cx88_core *core = dev->core;
826
struct i2c_msg msg = {
830
.len = sizeof(data) };
832
cx_set(MO_GP0_IO, 0x8000);
835
case SEC_VOLTAGE_OFF:
838
data = ISL6421_EN1 | ISL6421_LLC1;
839
cx_clear(MO_GP0_IO, 0x80);
842
data = ISL6421_EN1 | ISL6421_LLC1 | ISL6421_VSEL1;
843
cx_clear(MO_GP0_IO, 0x80);
849
return (i2c_transfer(&dev->core->i2c_adap, &msg, 1) == 1) ? 0 : -EIO;
852
static int samsung_smt_7020_stv0299_set_symbol_rate(struct dvb_frontend *fe,
853
u32 srate, u32 ratio)
858
if (srate < 1500000) {
861
} else if (srate < 3000000) {
864
} else if (srate < 7000000) {
867
} else if (srate < 14000000) {
870
} else if (srate < 30000000) {
873
} else if (srate < 45000000) {
878
stv0299_writereg(fe, 0x13, aclk);
879
stv0299_writereg(fe, 0x14, bclk);
880
stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
881
stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
882
stv0299_writereg(fe, 0x21, ratio & 0xf0);
888
static const struct stv0299_config samsung_stv0299_config = {
889
.demod_address = 0x68,
890
.inittab = samsung_smt_7020_inittab,
894
.lock_output = STV0299_LOCKOUTPUT_LK,
895
.volt13_op0_op1 = STV0299_VOLT13_OP1,
897
.set_symbol_rate = samsung_smt_7020_stv0299_set_symbol_rate,
648
900
static int dvb_register(struct cx8802_dev *dev)
650
902
struct cx88_core *core = dev->core;
1149
1401
goto frontend_detach;
1404
case CX88_BOARD_PROF_7301:{
1405
struct dvb_tuner_ops *tuner_ops = NULL;
1407
fe0->dvb.frontend = dvb_attach(stv0900_attach,
1408
&prof_7301_stv0900_config,
1409
&core->i2c_adap, 0);
1410
if (fe0->dvb.frontend != NULL) {
1411
if (!dvb_attach(stb6100_attach, fe0->dvb.frontend,
1412
&prof_7301_stb6100_config,
1414
goto frontend_detach;
1416
tuner_ops = &fe0->dvb.frontend->ops.tuner_ops;
1417
tuner_ops->set_frequency = stb6100_set_freq;
1418
tuner_ops->get_frequency = stb6100_get_freq;
1419
tuner_ops->set_bandwidth = stb6100_set_bandw;
1420
tuner_ops->get_bandwidth = stb6100_get_bandw;
1422
core->prev_set_voltage =
1423
fe0->dvb.frontend->ops.set_voltage;
1424
fe0->dvb.frontend->ops.set_voltage =
1425
tevii_dvbs_set_voltage;
1429
case CX88_BOARD_SAMSUNG_SMT_7020:
1430
dev->ts_gen_cntrl = 0x08;
1432
cx_set(MO_GP0_IO, 0x0101);
1434
cx_clear(MO_GP0_IO, 0x01);
1436
cx_set(MO_GP0_IO, 0x01);
1439
fe0->dvb.frontend = dvb_attach(stv0299_attach,
1440
&samsung_stv0299_config,
1441
&dev->core->i2c_adap);
1442
if (fe0->dvb.frontend) {
1443
fe0->dvb.frontend->ops.tuner_ops.set_params =
1444
samsung_smt_7020_tuner_set_params;
1445
fe0->dvb.frontend->tuner_priv =
1446
&dev->core->i2c_adap;
1447
fe0->dvb.frontend->ops.set_voltage =
1448
samsung_smt_7020_set_voltage;
1449
fe0->dvb.frontend->ops.set_tone =
1450
samsung_smt_7020_set_tone;
1454
case CX88_BOARD_TWINHAN_VP1027_DVBS:
1455
dev->ts_gen_cntrl = 0x00;
1456
fe0->dvb.frontend = dvb_attach(mb86a16_attach,
1459
if (fe0->dvb.frontend) {
1460
core->prev_set_voltage =
1461
fe0->dvb.frontend->ops.set_voltage;
1462
fe0->dvb.frontend->ops.set_voltage =
1153
1468
printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n",
1170
1485
fe1->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl;
1172
1487
/* Put the analog decoder in standby to keep it quiet */
1173
call_all(core, tuner, s_standby);
1488
call_all(core, core, s_power, 0);
1175
1490
/* register everything */
1176
1491
return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
1177
&dev->pci->dev, adapter_nr, mfe_shared);
1492
&dev->pci->dev, adapter_nr, mfe_shared, NULL);
1179
1494
frontend_detach:
1180
1495
core->gate_ctrl = NULL;