]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/media/dvb/bt8xx/dst.c
[PATCH] dvb: DST: fix for descrambling failure
[mirror_ubuntu-bionic-kernel.git] / drivers / media / dvb / bt8xx / dst.c
1 /*
2
3 Frontend/Card driver for TwinHan DST Frontend
4 Copyright (C) 2003 Jamie Honan
5 Copyright (C) 2004, 2005 Manu Abraham (manu@kromtek.com)
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/init.h>
26 #include <linux/string.h>
27 #include <linux/slab.h>
28 #include <linux/vmalloc.h>
29 #include <linux/delay.h>
30 #include <asm/div64.h>
31
32 #include "dvb_frontend.h"
33 #include "dst_priv.h"
34 #include "dst_common.h"
35
36
37 static unsigned int verbose = 1;
38 module_param(verbose, int, 0644);
39 MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)");
40
41 static unsigned int debug = 1;
42 module_param(debug, int, 0644);
43 MODULE_PARM_DESC(debug, "debug messages, default is 0 (yes)");
44
45 static unsigned int dst_addons;
46 module_param(dst_addons, int, 0644);
47 MODULE_PARM_DESC(dst_addons, "CA daughterboard, default is 0 (no)");
48
49 static unsigned int new_fw;
50 module_param(new_fw, int, 0644);
51 MODULE_PARM_DESC(new_fw, "Support for the new interface firmware, default 0");
52
53
54
55 #define dprintk if (debug) printk
56
57 #define HAS_LOCK 1
58 #define ATTEMPT_TUNE 2
59 #define HAS_POWER 4
60
61 static void dst_packsize(struct dst_state* state, int psize)
62 {
63 union dst_gpio_packet bits;
64
65 bits.psize = psize;
66 bt878_device_control(state->bt, DST_IG_TS, &bits);
67 }
68
69 int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay)
70 {
71 union dst_gpio_packet enb;
72 union dst_gpio_packet bits;
73 int err;
74
75 enb.enb.mask = mask;
76 enb.enb.enable = enbb;
77 if (verbose > 4)
78 dprintk("%s: mask=[%04x], enbb=[%04x], outhigh=[%04x]\n", __FUNCTION__, mask, enbb, outhigh);
79
80 if ((err = bt878_device_control(state->bt, DST_IG_ENABLE, &enb)) < 0) {
81 dprintk("%s: dst_gpio_enb error (err == %i, mask == %02x, enb == %02x)\n", __FUNCTION__, err, mask, enbb);
82 return -EREMOTEIO;
83 }
84 udelay(1000);
85 /* because complete disabling means no output, no need to do output packet */
86 if (enbb == 0)
87 return 0;
88
89 if (delay)
90 msleep(10);
91
92 bits.outp.mask = enbb;
93 bits.outp.highvals = outhigh;
94
95 if ((err = bt878_device_control(state->bt, DST_IG_WRITE, &bits)) < 0) {
96 dprintk("%s: dst_gpio_outb error (err == %i, enbb == %02x, outhigh == %02x)\n", __FUNCTION__, err, enbb, outhigh);
97 return -EREMOTEIO;
98 }
99 return 0;
100 }
101 EXPORT_SYMBOL(dst_gpio_outb);
102
103 int dst_gpio_inb(struct dst_state *state, u8 * result)
104 {
105 union dst_gpio_packet rd_packet;
106 int err;
107
108 *result = 0;
109
110 if ((err = bt878_device_control(state->bt, DST_IG_READ, &rd_packet)) < 0) {
111 dprintk("%s: dst_gpio_inb error (err == %i)\n", __FUNCTION__, err);
112 return -EREMOTEIO;
113 }
114
115 *result = (u8) rd_packet.rd.value;
116 return 0;
117 }
118 EXPORT_SYMBOL(dst_gpio_inb);
119
120 int rdc_reset_state(struct dst_state *state)
121 {
122 if (verbose > 1)
123 dprintk("%s: Resetting state machine\n", __FUNCTION__);
124
125 if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, 0, NO_DELAY) < 0) {
126 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
127 return -1;
128 }
129
130 msleep(10);
131
132 if (dst_gpio_outb(state, RDC_8820_INT, RDC_8820_INT, RDC_8820_INT, NO_DELAY) < 0) {
133 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
134 msleep(10);
135 return -1;
136 }
137
138 return 0;
139 }
140 EXPORT_SYMBOL(rdc_reset_state);
141
142 int rdc_8820_reset(struct dst_state *state)
143 {
144 if (verbose > 1)
145 dprintk("%s: Resetting DST\n", __FUNCTION__);
146
147 if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, 0, NO_DELAY) < 0) {
148 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
149 return -1;
150 }
151 udelay(1000);
152 if (dst_gpio_outb(state, RDC_8820_RESET, RDC_8820_RESET, RDC_8820_RESET, DELAY) < 0) {
153 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
154 return -1;
155 }
156
157 return 0;
158 }
159 EXPORT_SYMBOL(rdc_8820_reset);
160
161 int dst_pio_enable(struct dst_state *state)
162 {
163 if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_ENABLE, 0, NO_DELAY) < 0) {
164 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
165 return -1;
166 }
167 udelay(1000);
168 return 0;
169 }
170 EXPORT_SYMBOL(dst_pio_enable);
171
172 int dst_pio_disable(struct dst_state *state)
173 {
174 if (dst_gpio_outb(state, ~0, RDC_8820_PIO_0_DISABLE, RDC_8820_PIO_0_DISABLE, NO_DELAY) < 0) {
175 dprintk("%s: dst_gpio_outb ERROR !\n", __FUNCTION__);
176 return -1;
177 }
178 if (state->type_flags & DST_TYPE_HAS_FW_1)
179 udelay(1000);
180
181 return 0;
182 }
183 EXPORT_SYMBOL(dst_pio_disable);
184
185 int dst_wait_dst_ready(struct dst_state *state, u8 delay_mode)
186 {
187 u8 reply;
188 int i;
189
190 for (i = 0; i < 200; i++) {
191 if (dst_gpio_inb(state, &reply) < 0) {
192 dprintk("%s: dst_gpio_inb ERROR !\n", __FUNCTION__);
193 return -1;
194 }
195
196 if ((reply & RDC_8820_PIO_0_ENABLE) == 0) {
197 if (verbose > 4)
198 dprintk("%s: dst wait ready after %d\n", __FUNCTION__, i);
199 return 1;
200 }
201 msleep(10);
202 }
203 if (verbose > 1)
204 dprintk("%s: dst wait NOT ready after %d\n", __FUNCTION__, i);
205
206 return 0;
207 }
208 EXPORT_SYMBOL(dst_wait_dst_ready);
209
210 int dst_error_recovery(struct dst_state *state)
211 {
212 dprintk("%s: Trying to return from previous errors...\n", __FUNCTION__);
213 dst_pio_disable(state);
214 msleep(10);
215 dst_pio_enable(state);
216 msleep(10);
217
218 return 0;
219 }
220 EXPORT_SYMBOL(dst_error_recovery);
221
222 int dst_error_bailout(struct dst_state *state)
223 {
224 dprintk("%s: Trying to bailout from previous error...\n", __FUNCTION__);
225 rdc_8820_reset(state);
226 dst_pio_disable(state);
227 msleep(10);
228
229 return 0;
230 }
231 EXPORT_SYMBOL(dst_error_bailout);
232
233
234 int dst_comm_init(struct dst_state* state)
235 {
236 if (verbose > 1)
237 dprintk ("%s: Initializing DST..\n", __FUNCTION__);
238 if ((dst_pio_enable(state)) < 0) {
239 dprintk("%s: PIO Enable Failed.\n", __FUNCTION__);
240 return -1;
241 }
242 if ((rdc_reset_state(state)) < 0) {
243 dprintk("%s: RDC 8820 State RESET Failed.\n", __FUNCTION__);
244 return -1;
245 }
246 if (state->type_flags & DST_TYPE_HAS_FW_1)
247 msleep(100);
248 else
249 msleep(5);
250
251 return 0;
252 }
253 EXPORT_SYMBOL(dst_comm_init);
254
255
256 int write_dst(struct dst_state *state, u8 *data, u8 len)
257 {
258 struct i2c_msg msg = {
259 .addr = state->config->demod_address,.flags = 0,.buf = data,.len = len
260 };
261
262 int err;
263 int cnt;
264 if (debug && (verbose > 4)) {
265 u8 i;
266 if (verbose > 4) {
267 dprintk("%s writing", __FUNCTION__);
268 for (i = 0; i < len; i++)
269 dprintk(" %02x", data[i]);
270 dprintk("\n");
271 }
272 }
273 for (cnt = 0; cnt < 2; cnt++) {
274 if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) {
275 dprintk("%s: _write_dst error (err == %i, len == 0x%02x, b0 == 0x%02x)\n", __FUNCTION__, err, len, data[0]);
276 dst_error_recovery(state);
277 continue;
278 } else
279 break;
280 }
281
282 if (cnt >= 2) {
283 if (verbose > 1)
284 printk("%s: RDC 8820 RESET...\n", __FUNCTION__);
285 dst_error_bailout(state);
286
287 return -1;
288 }
289
290 return 0;
291 }
292 EXPORT_SYMBOL(write_dst);
293
294 int read_dst(struct dst_state *state, u8 * ret, u8 len)
295 {
296 struct i2c_msg msg = {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = ret,.len = len };
297 int err;
298 int cnt;
299
300 for (cnt = 0; cnt < 2; cnt++) {
301 if ((err = i2c_transfer(state->i2c, &msg, 1)) < 0) {
302
303 dprintk("%s: read_dst error (err == %i, len == 0x%02x, b0 == 0x%02x)\n", __FUNCTION__, err, len, ret[0]);
304 dst_error_recovery(state);
305
306 continue;
307 } else
308 break;
309 }
310 if (cnt >= 2) {
311 if (verbose > 1)
312 printk("%s: RDC 8820 RESET...\n", __FUNCTION__);
313 dst_error_bailout(state);
314
315 return -1;
316 }
317 if (debug && (verbose > 4)) {
318 dprintk("%s reply is 0x%x\n", __FUNCTION__, ret[0]);
319 for (err = 1; err < len; err++)
320 dprintk(" 0x%x", ret[err]);
321 if (err > 1)
322 dprintk("\n");
323 }
324
325 return 0;
326 }
327 EXPORT_SYMBOL(read_dst);
328
329 static int dst_set_freq(struct dst_state *state, u32 freq)
330 {
331 u8 *val;
332
333 state->frequency = freq;
334 if (debug > 4)
335 dprintk("%s: set Frequency %u\n", __FUNCTION__, freq);
336
337 if (state->dst_type == DST_TYPE_IS_SAT) {
338 freq = freq / 1000;
339 if (freq < 950 || freq > 2150)
340 return -EINVAL;
341 val = &state->tx_tuna[0];
342 val[2] = (freq >> 8) & 0x7f;
343 val[3] = (u8) freq;
344 val[4] = 1;
345 val[8] &= ~4;
346 if (freq < 1531)
347 val[8] |= 4;
348 } else if (state->dst_type == DST_TYPE_IS_TERR) {
349 freq = freq / 1000;
350 if (freq < 137000 || freq > 858000)
351 return -EINVAL;
352 val = &state->tx_tuna[0];
353 val[2] = (freq >> 16) & 0xff;
354 val[3] = (freq >> 8) & 0xff;
355 val[4] = (u8) freq;
356 val[5] = 0;
357 switch (state->bandwidth) {
358 case BANDWIDTH_6_MHZ:
359 val[6] = 6;
360 break;
361
362 case BANDWIDTH_7_MHZ:
363 case BANDWIDTH_AUTO:
364 val[6] = 7;
365 break;
366
367 case BANDWIDTH_8_MHZ:
368 val[6] = 8;
369 break;
370 }
371
372 val[7] = 0;
373 val[8] = 0;
374 } else if (state->dst_type == DST_TYPE_IS_CABLE) {
375 /* guess till will get one */
376 freq = freq / 1000;
377 val = &state->tx_tuna[0];
378 val[2] = (freq >> 16) & 0xff;
379 val[3] = (freq >> 8) & 0xff;
380 val[4] = (u8) freq;
381 } else
382 return -EINVAL;
383 return 0;
384 }
385
386 static int dst_set_bandwidth(struct dst_state* state, fe_bandwidth_t bandwidth)
387 {
388 u8 *val;
389
390 state->bandwidth = bandwidth;
391
392 if (state->dst_type != DST_TYPE_IS_TERR)
393 return 0;
394
395 val = &state->tx_tuna[0];
396 switch (bandwidth) {
397 case BANDWIDTH_6_MHZ:
398 val[6] = 6;
399 break;
400
401 case BANDWIDTH_7_MHZ:
402 val[6] = 7;
403 break;
404
405 case BANDWIDTH_8_MHZ:
406 val[6] = 8;
407 break;
408
409 default:
410 return -EINVAL;
411 }
412 return 0;
413 }
414
415 static int dst_set_inversion(struct dst_state* state, fe_spectral_inversion_t inversion)
416 {
417 u8 *val;
418
419 state->inversion = inversion;
420
421 val = &state->tx_tuna[0];
422
423 val[8] &= ~0x80;
424
425 switch (inversion) {
426 case INVERSION_OFF:
427 break;
428 case INVERSION_ON:
429 val[8] |= 0x80;
430 break;
431 default:
432 return -EINVAL;
433 }
434 return 0;
435 }
436
437 static int dst_set_fec(struct dst_state* state, fe_code_rate_t fec)
438 {
439 state->fec = fec;
440 return 0;
441 }
442
443 static fe_code_rate_t dst_get_fec(struct dst_state* state)
444 {
445 return state->fec;
446 }
447
448 static int dst_set_symbolrate(struct dst_state* state, u32 srate)
449 {
450 u8 *val;
451 u32 symcalc;
452 u64 sval;
453
454 state->symbol_rate = srate;
455
456 if (state->dst_type == DST_TYPE_IS_TERR) {
457 return 0;
458 }
459 if (debug > 4)
460 dprintk("%s: set symrate %u\n", __FUNCTION__, srate);
461 srate /= 1000;
462 val = &state->tx_tuna[0];
463
464 if (state->type_flags & DST_TYPE_HAS_SYMDIV) {
465 sval = srate;
466 sval <<= 20;
467 do_div(sval, 88000);
468 symcalc = (u32) sval;
469
470 if (debug > 4)
471 dprintk("%s: set symcalc %u\n", __FUNCTION__, symcalc);
472
473 val[5] = (u8) (symcalc >> 12);
474 val[6] = (u8) (symcalc >> 4);
475 val[7] = (u8) (symcalc << 4);
476 } else {
477 val[5] = (u8) (srate >> 16) & 0x7f;
478 val[6] = (u8) (srate >> 8);
479 val[7] = (u8) srate;
480 }
481 val[8] &= ~0x20;
482 if (srate > 8000)
483 val[8] |= 0x20;
484 return 0;
485 }
486
487 u8 dst_check_sum(u8 * buf, u32 len)
488 {
489 u32 i;
490 u8 val = 0;
491 if (!len)
492 return 0;
493 for (i = 0; i < len; i++) {
494 val += buf[i];
495 }
496 return ((~val) + 1);
497 }
498 EXPORT_SYMBOL(dst_check_sum);
499
500 static void dst_type_flags_print(u32 type_flags)
501 {
502 printk("DST type flags :");
503 if (type_flags & DST_TYPE_HAS_NEWTUNE)
504 printk(" 0x%x newtuner", DST_TYPE_HAS_NEWTUNE);
505 if (type_flags & DST_TYPE_HAS_TS204)
506 printk(" 0x%x ts204", DST_TYPE_HAS_TS204);
507 if (type_flags & DST_TYPE_HAS_SYMDIV)
508 printk(" 0x%x symdiv", DST_TYPE_HAS_SYMDIV);
509 if (type_flags & DST_TYPE_HAS_FW_1)
510 printk(" 0x%x firmware version = 1", DST_TYPE_HAS_FW_1);
511 if (type_flags & DST_TYPE_HAS_FW_2)
512 printk(" 0x%x firmware version = 2", DST_TYPE_HAS_FW_2);
513 if (type_flags & DST_TYPE_HAS_FW_3)
514 printk(" 0x%x firmware version = 3", DST_TYPE_HAS_FW_3);
515 // if ((type_flags & DST_TYPE_HAS_FW_BUILD) && new_fw)
516
517 printk("\n");
518 }
519
520
521 static int dst_type_print (u8 type)
522 {
523 char *otype;
524 switch (type) {
525 case DST_TYPE_IS_SAT:
526 otype = "satellite";
527 break;
528
529 case DST_TYPE_IS_TERR:
530 otype = "terrestrial";
531 break;
532
533 case DST_TYPE_IS_CABLE:
534 otype = "cable";
535 break;
536
537 default:
538 printk("%s: invalid dst type %d\n", __FUNCTION__, type);
539 return -EINVAL;
540 }
541 printk("DST type : %s\n", otype);
542
543 return 0;
544 }
545
546 /*
547 Known cards list
548 Satellite
549 -------------------
550 200103A
551 VP-1020 DST-MOT LG(old), TS=188
552
553 VP-1020 DST-03T LG(new), TS=204
554 VP-1022 DST-03T LG(new), TS=204
555 VP-1025 DST-03T LG(new), TS=204
556
557 VP-1030 DSTMCI, LG(new), TS=188
558 VP-1032 DSTMCI, LG(new), TS=188
559
560 Cable
561 -------------------
562 VP-2030 DCT-CI, Samsung, TS=204
563 VP-2021 DCT-CI, Unknown, TS=204
564 VP-2031 DCT-CI, Philips, TS=188
565 VP-2040 DCT-CI, Philips, TS=188, with CA daughter board
566 VP-2040 DCT-CI, Philips, TS=204, without CA daughter board
567
568 Terrestrial
569 -------------------
570 VP-3050 DTTNXT TS=188
571 VP-3040 DTT-CI, Philips, TS=188
572 VP-3040 DTT-CI, Philips, TS=204
573
574 ATSC
575 -------------------
576 VP-3220 ATSCDI, TS=188
577 VP-3250 ATSCAD, TS=188
578
579 */
580
581 struct dst_types dst_tlist[] = {
582 {
583 .device_id = "200103A",
584 .offset = 0,
585 .dst_type = DST_TYPE_IS_SAT,
586 .type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1,
587 .dst_feature = 0
588 }, /* obsolete */
589
590 {
591 .device_id = "DST-020",
592 .offset = 0,
593 .dst_type = DST_TYPE_IS_SAT,
594 .type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1,
595 .dst_feature = 0
596 }, /* obsolete */
597
598 {
599 .device_id = "DST-030",
600 .offset = 0,
601 .dst_type = DST_TYPE_IS_SAT,
602 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1,
603 .dst_feature = 0
604 }, /* obsolete */
605
606 {
607 .device_id = "DST-03T",
608 .offset = 0,
609 .dst_type = DST_TYPE_IS_SAT,
610 .type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2,
611 .dst_feature = DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4 | DST_TYPE_HAS_DISEQC5
612 | DST_TYPE_HAS_MAC | DST_TYPE_HAS_MOTO
613 },
614
615 {
616 .device_id = "DST-MOT",
617 .offset = 0,
618 .dst_type = DST_TYPE_IS_SAT,
619 .type_flags = DST_TYPE_HAS_SYMDIV | DST_TYPE_HAS_FW_1,
620 .dst_feature = 0
621 }, /* obsolete */
622
623 {
624 .device_id = "DST-CI",
625 .offset = 1,
626 .dst_type = DST_TYPE_IS_SAT,
627 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1,
628 .dst_feature = DST_TYPE_HAS_CA
629 }, /* An OEM board */
630
631 {
632 .device_id = "DSTMCI",
633 .offset = 1,
634 .dst_type = DST_TYPE_IS_SAT,
635 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
636 .dst_feature = DST_TYPE_HAS_CA | DST_TYPE_HAS_DISEQC3 | DST_TYPE_HAS_DISEQC4
637 | DST_TYPE_HAS_MOTO | DST_TYPE_HAS_MAC
638 },
639
640 {
641 .device_id = "DSTFCI",
642 .offset = 1,
643 .dst_type = DST_TYPE_IS_SAT,
644 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1,
645 .dst_feature = 0
646 }, /* unknown to vendor */
647
648 {
649 .device_id = "DCT-CI",
650 .offset = 1,
651 .dst_type = DST_TYPE_IS_CABLE,
652 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_1
653 | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
654 .dst_feature = DST_TYPE_HAS_CA
655 },
656
657 {
658 .device_id = "DCTNEW",
659 .offset = 1,
660 .dst_type = DST_TYPE_IS_CABLE,
661 .type_flags = DST_TYPE_HAS_NEWTUNE | DST_TYPE_HAS_FW_3,
662 .dst_feature = 0
663 },
664
665 {
666 .device_id = "DTT-CI",
667 .offset = 1,
668 .dst_type = DST_TYPE_IS_TERR,
669 .type_flags = DST_TYPE_HAS_TS204 | DST_TYPE_HAS_FW_2 | DST_TYPE_HAS_FW_BUILD,
670 .dst_feature = 0
671 },
672
673 {
674 .device_id = "DTTDIG",
675 .offset = 1,
676 .dst_type = DST_TYPE_IS_TERR,
677 .type_flags = DST_TYPE_HAS_FW_2,
678 .dst_feature = 0
679 },
680
681 {
682 .device_id = "DTTNXT",
683 .offset = 1,
684 .dst_type = DST_TYPE_IS_TERR,
685 .type_flags = DST_TYPE_HAS_FW_2,
686 .dst_feature = DST_TYPE_HAS_ANALOG
687 },
688
689 {
690 .device_id = "ATSCDI",
691 .offset = 1,
692 .dst_type = DST_TYPE_IS_ATSC,
693 .type_flags = DST_TYPE_HAS_FW_2,
694 .dst_feature = 0
695 },
696
697 {
698 .device_id = "ATSCAD",
699 .offset = 1,
700 .dst_type = DST_TYPE_IS_ATSC,
701 .type_flags = DST_TYPE_HAS_FW_2,
702 .dst_feature = 0
703 },
704
705 { }
706
707 };
708
709
710 static int dst_get_device_id(struct dst_state *state)
711 {
712 u8 reply;
713
714 int i;
715 struct dst_types *p_dst_type;
716 u8 use_dst_type = 0;
717 u32 use_type_flags = 0;
718
719 static u8 device_type[8] = {0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff};
720
721 device_type[7] = dst_check_sum(device_type, 7);
722
723 if (write_dst(state, device_type, FIXED_COMM))
724 return -1; /* Write failed */
725
726 if ((dst_pio_disable(state)) < 0)
727 return -1;
728
729 if (read_dst(state, &reply, GET_ACK))
730 return -1; /* Read failure */
731
732 if (reply != ACK) {
733 dprintk("%s: Write not Acknowledged! [Reply=0x%02x]\n", __FUNCTION__, reply);
734 return -1; /* Unack'd write */
735 }
736
737 if (!dst_wait_dst_ready(state, DEVICE_INIT))
738 return -1; /* DST not ready yet */
739
740 if (read_dst(state, state->rxbuffer, FIXED_COMM))
741 return -1;
742
743 dst_pio_disable(state);
744
745 if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) {
746 dprintk("%s: Checksum failure! \n", __FUNCTION__);
747 return -1; /* Checksum failure */
748 }
749
750 state->rxbuffer[7] = '\0';
751
752 for (i = 0, p_dst_type = dst_tlist; i < ARRAY_SIZE (dst_tlist); i++, p_dst_type++) {
753 if (!strncmp (&state->rxbuffer[p_dst_type->offset], p_dst_type->device_id, strlen (p_dst_type->device_id))) {
754 use_type_flags = p_dst_type->type_flags;
755 use_dst_type = p_dst_type->dst_type;
756
757 /* Card capabilities */
758 state->dst_hw_cap = p_dst_type->dst_feature;
759 printk ("%s: Recognise [%s]\n", __FUNCTION__, p_dst_type->device_id);
760
761 break;
762 }
763 }
764
765 if (i >= sizeof (dst_tlist) / sizeof (dst_tlist [0])) {
766 printk("%s: Unable to recognize %s or %s\n", __FUNCTION__, &state->rxbuffer[0], &state->rxbuffer[1]);
767 printk("%s: please email linux-dvb@linuxtv.org with this type in\n", __FUNCTION__);
768 use_dst_type = DST_TYPE_IS_SAT;
769 use_type_flags = DST_TYPE_HAS_SYMDIV;
770 }
771
772 dst_type_print(use_dst_type);
773 state->type_flags = use_type_flags;
774 state->dst_type = use_dst_type;
775 dst_type_flags_print(state->type_flags);
776
777 if (state->type_flags & DST_TYPE_HAS_TS204) {
778 dst_packsize(state, 204);
779 }
780
781 return 0;
782 }
783
784 static int dst_probe(struct dst_state *state)
785 {
786 if ((rdc_8820_reset(state)) < 0) {
787 dprintk("%s: RDC 8820 RESET Failed.\n", __FUNCTION__);
788 return -1;
789 }
790 msleep(4000);
791 if ((dst_comm_init(state)) < 0) {
792 dprintk("%s: DST Initialization Failed.\n", __FUNCTION__);
793 return -1;
794 }
795 msleep(100);
796 if (dst_get_device_id(state) < 0) {
797 dprintk("%s: unknown device.\n", __FUNCTION__);
798 return -1;
799 }
800
801 return 0;
802 }
803
804 int dst_command(struct dst_state* state, u8 * data, u8 len)
805 {
806 u8 reply;
807 if ((dst_comm_init(state)) < 0) {
808 dprintk("%s: DST Communication Initialization Failed.\n", __FUNCTION__);
809 return -1;
810 }
811
812 if (write_dst(state, data, len)) {
813 if (verbose > 1)
814 dprintk("%s: Tring to recover.. \n", __FUNCTION__);
815 if ((dst_error_recovery(state)) < 0) {
816 dprintk("%s: Recovery Failed.\n", __FUNCTION__);
817 return -1;
818 }
819 return -1;
820 }
821 if ((dst_pio_disable(state)) < 0) {
822 dprintk("%s: PIO Disable Failed.\n", __FUNCTION__);
823 return -1;
824 }
825 if (state->type_flags & DST_TYPE_HAS_FW_1)
826 udelay(3000);
827
828 if (read_dst(state, &reply, GET_ACK)) {
829 if (verbose > 1)
830 dprintk("%s: Trying to recover.. \n", __FUNCTION__);
831 if ((dst_error_recovery(state)) < 0) {
832 dprintk("%s: Recovery Failed.\n", __FUNCTION__);
833 return -1;
834 }
835 return -1;
836 }
837
838 if (reply != ACK) {
839 dprintk("%s: write not acknowledged 0x%02x \n", __FUNCTION__, reply);
840 return -1;
841 }
842 if (len >= 2 && data[0] == 0 && (data[1] == 1 || data[1] == 3))
843 return 0;
844
845 // udelay(3000);
846 if (state->type_flags & DST_TYPE_HAS_FW_1)
847 udelay(3000);
848 else
849 udelay(2000);
850
851 if (!dst_wait_dst_ready(state, NO_DELAY))
852 return -1;
853
854 if (read_dst(state, state->rxbuffer, FIXED_COMM)) {
855 if (verbose > 1)
856 dprintk("%s: Trying to recover.. \n", __FUNCTION__);
857 if ((dst_error_recovery(state)) < 0) {
858 dprintk("%s: Recovery failed.\n", __FUNCTION__);
859 return -1;
860 }
861 return -1;
862 }
863
864 if (state->rxbuffer[7] != dst_check_sum(state->rxbuffer, 7)) {
865 dprintk("%s: checksum failure\n", __FUNCTION__);
866 return -1;
867 }
868
869 return 0;
870 }
871 EXPORT_SYMBOL(dst_command);
872
873 static int dst_get_signal(struct dst_state* state)
874 {
875 int retval;
876 u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb };
877
878 if ((state->diseq_flags & ATTEMPT_TUNE) == 0) {
879 state->decode_lock = state->decode_strength = state->decode_snr = 0;
880 return 0;
881 }
882 if (0 == (state->diseq_flags & HAS_LOCK)) {
883 state->decode_lock = state->decode_strength = state->decode_snr = 0;
884 return 0;
885 }
886 if (time_after_eq(jiffies, state->cur_jiff + (HZ / 5))) {
887 retval = dst_command(state, get_signal, 8);
888 if (retval < 0)
889 return retval;
890 if (state->dst_type == DST_TYPE_IS_SAT) {
891 state->decode_lock = ((state->rxbuffer[6] & 0x10) == 0) ? 1 : 0;
892 state->decode_strength = state->rxbuffer[5] << 8;
893 state->decode_snr = state->rxbuffer[2] << 8 | state->rxbuffer[3];
894 } else if ((state->dst_type == DST_TYPE_IS_TERR) || (state->dst_type == DST_TYPE_IS_CABLE)) {
895 state->decode_lock = (state->rxbuffer[1]) ? 1 : 0;
896 state->decode_strength = state->rxbuffer[4] << 8;
897 state->decode_snr = state->rxbuffer[3] << 8;
898 }
899 state->cur_jiff = jiffies;
900 }
901 return 0;
902 }
903
904 static int dst_tone_power_cmd(struct dst_state* state)
905 {
906 u8 paket[8] = { 0x00, 0x09, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00 };
907
908 if (state->dst_type == DST_TYPE_IS_TERR)
909 return 0;
910
911 if (state->voltage == SEC_VOLTAGE_OFF)
912 paket[4] = 0;
913 else
914 paket[4] = 1;
915
916 if (state->tone == SEC_TONE_ON)
917 paket[2] = 0x02;
918 else
919 paket[2] = 0;
920 if (state->minicmd == SEC_MINI_A)
921 paket[3] = 0x02;
922 else
923 paket[3] = 0;
924
925 paket[7] = dst_check_sum (paket, 7);
926 dst_command(state, paket, 8);
927 return 0;
928 }
929
930 static int dst_get_tuna(struct dst_state* state)
931 {
932 int retval;
933
934 if ((state->diseq_flags & ATTEMPT_TUNE) == 0)
935 return 0;
936
937 state->diseq_flags &= ~(HAS_LOCK);
938 if (!dst_wait_dst_ready(state, NO_DELAY))
939 return 0;
940
941 if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
942 /* how to get variable length reply ???? */
943 retval = read_dst(state, state->rx_tuna, 10);
944 } else {
945 retval = read_dst(state, &state->rx_tuna[2], FIXED_COMM);
946 }
947
948 if (retval < 0) {
949 dprintk("%s: read not successful\n", __FUNCTION__);
950 return 0;
951 }
952
953 if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
954 if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[0], 9)) {
955 dprintk("%s: checksum failure?\n", __FUNCTION__);
956 return 0;
957 }
958 } else {
959 if (state->rx_tuna[9] != dst_check_sum(&state->rx_tuna[2], 7)) {
960 dprintk("%s: checksum failure?\n", __FUNCTION__);
961 return 0;
962 }
963 }
964 if (state->rx_tuna[2] == 0 && state->rx_tuna[3] == 0)
965 return 0;
966 state->decode_freq = ((state->rx_tuna[2] & 0x7f) << 8) + state->rx_tuna[3];
967
968 state->decode_lock = 1;
969 /*
970 dst->decode_n1 = (dst->rx_tuna[4] << 8) +
971 (dst->rx_tuna[5]);
972
973 dst->decode_n2 = (dst->rx_tuna[8] << 8) +
974 (dst->rx_tuna[7]);
975 */
976 state->diseq_flags |= HAS_LOCK;
977 /* dst->cur_jiff = jiffies; */
978 return 1;
979 }
980
981 static int dst_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage);
982
983 static int dst_write_tuna(struct dvb_frontend* fe)
984 {
985 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
986 int retval;
987 u8 reply;
988
989 if (debug > 4)
990 dprintk("%s: type_flags 0x%x \n", __FUNCTION__, state->type_flags);
991
992 state->decode_freq = 0;
993 state->decode_lock = state->decode_strength = state->decode_snr = 0;
994 if (state->dst_type == DST_TYPE_IS_SAT) {
995 if (!(state->diseq_flags & HAS_POWER))
996 dst_set_voltage(fe, SEC_VOLTAGE_13);
997 }
998 state->diseq_flags &= ~(HAS_LOCK | ATTEMPT_TUNE);
999
1000 if ((dst_comm_init(state)) < 0) {
1001 dprintk("%s: DST Communication initialization failed.\n", __FUNCTION__);
1002 return -1;
1003 }
1004
1005 if (state->type_flags & DST_TYPE_HAS_NEWTUNE) {
1006 state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[0], 9);
1007 retval = write_dst(state, &state->tx_tuna[0], 10);
1008
1009 } else {
1010 state->tx_tuna[9] = dst_check_sum(&state->tx_tuna[2], 7);
1011 retval = write_dst(state, &state->tx_tuna[2], FIXED_COMM);
1012 }
1013 if (retval < 0) {
1014 dst_pio_disable(state);
1015 dprintk("%s: write not successful\n", __FUNCTION__);
1016 return retval;
1017 }
1018
1019 if ((dst_pio_disable(state)) < 0) {
1020 dprintk("%s: DST PIO disable failed !\n", __FUNCTION__);
1021 return -1;
1022 }
1023
1024 if ((read_dst(state, &reply, GET_ACK) < 0)) {
1025 dprintk("%s: read verify not successful.\n", __FUNCTION__);
1026 return -1;
1027 }
1028 if (reply != ACK) {
1029 dprintk("%s: write not acknowledged 0x%02x \n", __FUNCTION__, reply);
1030 return 0;
1031 }
1032 state->diseq_flags |= ATTEMPT_TUNE;
1033
1034 return dst_get_tuna(state);
1035 }
1036
1037 /*
1038 * line22k0 0x00, 0x09, 0x00, 0xff, 0x01, 0x00, 0x00, 0x00
1039 * line22k1 0x00, 0x09, 0x01, 0xff, 0x01, 0x00, 0x00, 0x00
1040 * line22k2 0x00, 0x09, 0x02, 0xff, 0x01, 0x00, 0x00, 0x00
1041 * tone 0x00, 0x09, 0xff, 0x00, 0x01, 0x00, 0x00, 0x00
1042 * data 0x00, 0x09, 0xff, 0x01, 0x01, 0x00, 0x00, 0x00
1043 * power_off 0x00, 0x09, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
1044 * power_on 0x00, 0x09, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00
1045 * Diseqc 1 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf0, 0xec
1046 * Diseqc 2 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf4, 0xe8
1047 * Diseqc 3 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf8, 0xe4
1048 * Diseqc 4 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xfc, 0xe0
1049 */
1050
1051 static int dst_set_diseqc(struct dvb_frontend* fe, struct dvb_diseqc_master_cmd* cmd)
1052 {
1053 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1054 u8 paket[8] = { 0x00, 0x08, 0x04, 0xe0, 0x10, 0x38, 0xf0, 0xec };
1055
1056 if (state->dst_type == DST_TYPE_IS_TERR)
1057 return 0;
1058
1059 if (cmd->msg_len == 0 || cmd->msg_len > 4)
1060 return -EINVAL;
1061 memcpy(&paket[3], cmd->msg, cmd->msg_len);
1062 paket[7] = dst_check_sum(&paket[0], 7);
1063 dst_command(state, paket, 8);
1064 return 0;
1065 }
1066
1067 static int dst_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
1068 {
1069 u8 *val;
1070 int need_cmd;
1071 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1072
1073 state->voltage = voltage;
1074
1075 if (state->dst_type == DST_TYPE_IS_TERR)
1076 return 0;
1077
1078 need_cmd = 0;
1079 val = &state->tx_tuna[0];
1080 val[8] &= ~0x40;
1081 switch (voltage) {
1082 case SEC_VOLTAGE_13:
1083 if ((state->diseq_flags & HAS_POWER) == 0)
1084 need_cmd = 1;
1085 state->diseq_flags |= HAS_POWER;
1086 break;
1087
1088 case SEC_VOLTAGE_18:
1089 if ((state->diseq_flags & HAS_POWER) == 0)
1090 need_cmd = 1;
1091 state->diseq_flags |= HAS_POWER;
1092 val[8] |= 0x40;
1093 break;
1094
1095 case SEC_VOLTAGE_OFF:
1096 need_cmd = 1;
1097 state->diseq_flags &= ~(HAS_POWER | HAS_LOCK | ATTEMPT_TUNE);
1098 break;
1099
1100 default:
1101 return -EINVAL;
1102 }
1103 if (need_cmd)
1104 dst_tone_power_cmd(state);
1105
1106 return 0;
1107 }
1108
1109 static int dst_set_tone(struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
1110 {
1111 u8 *val;
1112 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1113
1114 state->tone = tone;
1115
1116 if (state->dst_type == DST_TYPE_IS_TERR)
1117 return 0;
1118
1119 val = &state->tx_tuna[0];
1120
1121 val[8] &= ~0x1;
1122
1123 switch (tone) {
1124 case SEC_TONE_OFF:
1125 break;
1126
1127 case SEC_TONE_ON:
1128 val[8] |= 1;
1129 break;
1130
1131 default:
1132 return -EINVAL;
1133 }
1134 dst_tone_power_cmd(state);
1135
1136 return 0;
1137 }
1138
1139 static int dst_init(struct dvb_frontend* fe)
1140 {
1141 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1142 static u8 ini_satci_tuna[] = { 9, 0, 3, 0xb6, 1, 0, 0x73, 0x21, 0, 0 };
1143 static u8 ini_satfta_tuna[] = { 0, 0, 3, 0xb6, 1, 0x55, 0xbd, 0x50, 0, 0 };
1144 static u8 ini_tvfta_tuna[] = { 0, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 };
1145 static u8 ini_tvci_tuna[] = { 9, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 };
1146 static u8 ini_cabfta_tuna[] = { 0, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 };
1147 static u8 ini_cabci_tuna[] = { 9, 0, 3, 0xb6, 1, 7, 0x0, 0x0, 0, 0 };
1148 state->inversion = INVERSION_ON;
1149 state->voltage = SEC_VOLTAGE_13;
1150 state->tone = SEC_TONE_OFF;
1151 state->symbol_rate = 29473000;
1152 state->fec = FEC_AUTO;
1153 state->diseq_flags = 0;
1154 state->k22 = 0x02;
1155 state->bandwidth = BANDWIDTH_7_MHZ;
1156 state->cur_jiff = jiffies;
1157 if (state->dst_type == DST_TYPE_IS_SAT) {
1158 state->frequency = 950000;
1159 memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ini_satci_tuna : ini_satfta_tuna), sizeof(ini_satfta_tuna));
1160 } else if (state->dst_type == DST_TYPE_IS_TERR) {
1161 state->frequency = 137000000;
1162 memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ini_tvci_tuna : ini_tvfta_tuna), sizeof(ini_tvfta_tuna));
1163 } else if (state->dst_type == DST_TYPE_IS_CABLE) {
1164 state->frequency = 51000000;
1165 memcpy(state->tx_tuna, ((state->type_flags & DST_TYPE_HAS_NEWTUNE) ? ini_cabci_tuna : ini_cabfta_tuna), sizeof(ini_cabfta_tuna));
1166 }
1167
1168 return 0;
1169 }
1170
1171 static int dst_read_status(struct dvb_frontend* fe, fe_status_t* status)
1172 {
1173 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1174
1175 *status = 0;
1176 if (state->diseq_flags & HAS_LOCK) {
1177 dst_get_signal(state);
1178 if (state->decode_lock)
1179 *status |= FE_HAS_LOCK | FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_SYNC | FE_HAS_VITERBI;
1180 }
1181
1182 return 0;
1183 }
1184
1185 static int dst_read_signal_strength(struct dvb_frontend* fe, u16* strength)
1186 {
1187 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1188
1189 dst_get_signal(state);
1190 *strength = state->decode_strength;
1191
1192 return 0;
1193 }
1194
1195 static int dst_read_snr(struct dvb_frontend* fe, u16* snr)
1196 {
1197 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1198
1199 dst_get_signal(state);
1200 *snr = state->decode_snr;
1201
1202 return 0;
1203 }
1204
1205 static int dst_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
1206 {
1207 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1208
1209 dst_set_freq(state, p->frequency);
1210 if (verbose > 4)
1211 dprintk("Set Frequency = [%d]\n", p->frequency);
1212
1213 dst_set_inversion(state, p->inversion);
1214 if (state->dst_type == DST_TYPE_IS_SAT) {
1215 dst_set_fec(state, p->u.qpsk.fec_inner);
1216 dst_set_symbolrate(state, p->u.qpsk.symbol_rate);
1217 if (verbose > 4)
1218 dprintk("Set Symbolrate = [%d]\n", p->u.qpsk.symbol_rate);
1219
1220 } else if (state->dst_type == DST_TYPE_IS_TERR) {
1221 dst_set_bandwidth(state, p->u.ofdm.bandwidth);
1222 } else if (state->dst_type == DST_TYPE_IS_CABLE) {
1223 dst_set_fec(state, p->u.qam.fec_inner);
1224 dst_set_symbolrate(state, p->u.qam.symbol_rate);
1225 }
1226 dst_write_tuna(fe);
1227
1228 return 0;
1229 }
1230
1231 static int dst_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
1232 {
1233 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1234
1235 p->frequency = state->decode_freq;
1236 p->inversion = state->inversion;
1237 if (state->dst_type == DST_TYPE_IS_SAT) {
1238 p->u.qpsk.symbol_rate = state->symbol_rate;
1239 p->u.qpsk.fec_inner = dst_get_fec(state);
1240 } else if (state->dst_type == DST_TYPE_IS_TERR) {
1241 p->u.ofdm.bandwidth = state->bandwidth;
1242 } else if (state->dst_type == DST_TYPE_IS_CABLE) {
1243 p->u.qam.symbol_rate = state->symbol_rate;
1244 p->u.qam.fec_inner = dst_get_fec(state);
1245 p->u.qam.modulation = QAM_AUTO;
1246 }
1247
1248 return 0;
1249 }
1250
1251 static void dst_release(struct dvb_frontend* fe)
1252 {
1253 struct dst_state* state = (struct dst_state*) fe->demodulator_priv;
1254 kfree(state);
1255 }
1256
1257 static struct dvb_frontend_ops dst_dvbt_ops;
1258 static struct dvb_frontend_ops dst_dvbs_ops;
1259 static struct dvb_frontend_ops dst_dvbc_ops;
1260
1261 struct dst_state* dst_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter)
1262 {
1263
1264 /* check if the ASIC is there */
1265 if (dst_probe(state) < 0) {
1266 if (state)
1267 kfree(state);
1268
1269 return NULL;
1270 }
1271 /* determine settings based on type */
1272 switch (state->dst_type) {
1273 case DST_TYPE_IS_TERR:
1274 memcpy(&state->ops, &dst_dvbt_ops, sizeof(struct dvb_frontend_ops));
1275 break;
1276
1277 case DST_TYPE_IS_CABLE:
1278 memcpy(&state->ops, &dst_dvbc_ops, sizeof(struct dvb_frontend_ops));
1279 break;
1280
1281 case DST_TYPE_IS_SAT:
1282 memcpy(&state->ops, &dst_dvbs_ops, sizeof(struct dvb_frontend_ops));
1283 break;
1284
1285 default:
1286 printk("%s: unknown DST type. please report to the LinuxTV.org DVB mailinglist.\n", __FUNCTION__);
1287 if (state)
1288 kfree(state);
1289
1290 return NULL;
1291 }
1292
1293 /* create dvb_frontend */
1294 state->frontend.ops = &state->ops;
1295 state->frontend.demodulator_priv = state;
1296
1297 return state; /* Manu (DST is a card not a frontend) */
1298 }
1299
1300 EXPORT_SYMBOL(dst_attach);
1301
1302 static struct dvb_frontend_ops dst_dvbt_ops = {
1303
1304 .info = {
1305 .name = "DST DVB-T",
1306 .type = FE_OFDM,
1307 .frequency_min = 137000000,
1308 .frequency_max = 858000000,
1309 .frequency_stepsize = 166667,
1310 .caps = FE_CAN_FEC_AUTO | FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO
1311 },
1312
1313 .release = dst_release,
1314
1315 .init = dst_init,
1316
1317 .set_frontend = dst_set_frontend,
1318 .get_frontend = dst_get_frontend,
1319
1320 .read_status = dst_read_status,
1321 .read_signal_strength = dst_read_signal_strength,
1322 .read_snr = dst_read_snr,
1323 };
1324
1325 static struct dvb_frontend_ops dst_dvbs_ops = {
1326
1327 .info = {
1328 .name = "DST DVB-S",
1329 .type = FE_QPSK,
1330 .frequency_min = 950000,
1331 .frequency_max = 2150000,
1332 .frequency_stepsize = 1000, /* kHz for QPSK frontends */
1333 .frequency_tolerance = 29500,
1334 .symbol_rate_min = 1000000,
1335 .symbol_rate_max = 45000000,
1336 /* . symbol_rate_tolerance = ???,*/
1337 .caps = FE_CAN_FEC_AUTO | FE_CAN_QPSK
1338 },
1339
1340 .release = dst_release,
1341
1342 .init = dst_init,
1343
1344 .set_frontend = dst_set_frontend,
1345 .get_frontend = dst_get_frontend,
1346
1347 .read_status = dst_read_status,
1348 .read_signal_strength = dst_read_signal_strength,
1349 .read_snr = dst_read_snr,
1350
1351 .diseqc_send_burst = dst_set_tone,
1352 .diseqc_send_master_cmd = dst_set_diseqc,
1353 .set_voltage = dst_set_voltage,
1354 .set_tone = dst_set_tone,
1355 };
1356
1357 static struct dvb_frontend_ops dst_dvbc_ops = {
1358
1359 .info = {
1360 .name = "DST DVB-C",
1361 .type = FE_QAM,
1362 .frequency_stepsize = 62500,
1363 .frequency_min = 51000000,
1364 .frequency_max = 858000000,
1365 .symbol_rate_min = 1000000,
1366 .symbol_rate_max = 45000000,
1367 /* . symbol_rate_tolerance = ???,*/
1368 .caps = FE_CAN_FEC_AUTO | FE_CAN_QAM_AUTO
1369 },
1370
1371 .release = dst_release,
1372
1373 .init = dst_init,
1374
1375 .set_frontend = dst_set_frontend,
1376 .get_frontend = dst_get_frontend,
1377
1378 .read_status = dst_read_status,
1379 .read_signal_strength = dst_read_signal_strength,
1380 .read_snr = dst_read_snr,
1381 };
1382
1383
1384 MODULE_DESCRIPTION("DST DVB-S/T/C Combo Frontend driver");
1385 MODULE_AUTHOR("Jamie Honan, Manu Abraham");
1386 MODULE_LICENSE("GPL");