1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31#ifndef __DRXDRIVER_H__
32#define __DRXDRIVER_H__
33
34#include <linux/kernel.h>
35#include <linux/errno.h>
36#include <linux/firmware.h>
37#include <linux/i2c.h>
38
39
40
41
42
43struct i2c_device_addr {
44 u16 i2c_addr;
45 u16 i2c_dev_id;
46 void *user_data;
47};
48
49
50
51
52
53
54
55
56
57#define IS_I2C_10BIT(addr) \
58 (((addr) & 0xF8) == 0xF0)
59
60
61
62
63
64
65
66
67
68
69
70
71int drxbsp_i2c_init(void);
72
73
74
75
76
77
78
79
80int drxbsp_i2c_term(void);
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112int drxbsp_i2c_write_read(struct i2c_device_addr *w_dev_addr,
113 u16 w_count,
114 u8 *wData,
115 struct i2c_device_addr *r_dev_addr,
116 u16 r_count, u8 *r_data);
117
118
119
120
121
122
123
124
125char *drxbsp_i2c_error_text(void);
126
127
128
129
130
131extern int drx_i2c_error_g;
132
133#define TUNER_MODE_SUB0 0x0001
134#define TUNER_MODE_SUB1 0x0002
135#define TUNER_MODE_SUB2 0x0004
136#define TUNER_MODE_SUB3 0x0008
137#define TUNER_MODE_SUB4 0x0010
138#define TUNER_MODE_SUB5 0x0020
139#define TUNER_MODE_SUB6 0x0040
140#define TUNER_MODE_SUB7 0x0080
141
142#define TUNER_MODE_DIGITAL 0x0100
143#define TUNER_MODE_ANALOG 0x0200
144#define TUNER_MODE_SWITCH 0x0400
145#define TUNER_MODE_LOCK 0x0800
146#define TUNER_MODE_6MHZ 0x1000
147#define TUNER_MODE_7MHZ 0x2000
148#define TUNER_MODE_8MHZ 0x4000
149
150#define TUNER_MODE_SUB_MAX 8
151#define TUNER_MODE_SUBALL (TUNER_MODE_SUB0 | TUNER_MODE_SUB1 | \
152 TUNER_MODE_SUB2 | TUNER_MODE_SUB3 | \
153 TUNER_MODE_SUB4 | TUNER_MODE_SUB5 | \
154 TUNER_MODE_SUB6 | TUNER_MODE_SUB7)
155
156
157enum tuner_lock_status {
158 TUNER_LOCKED,
159 TUNER_NOT_LOCKED
160};
161
162struct tuner_common {
163 char *name;
164 s32 min_freq_rf;
165 s32 max_freq_rf;
166
167 u8 sub_mode;
168 char ***sub_mode_descriptions;
169 u8 sub_modes;
170
171
172
173 void *self_check;
174 bool programmed;
175 s32 r_ffrequency;
176 s32 i_ffrequency;
177
178 void *my_user_data;
179 u16 my_capabilities;
180};
181
182struct tuner_instance;
183
184typedef int(*tuner_open_func_t) (struct tuner_instance *tuner);
185typedef int(*tuner_close_func_t) (struct tuner_instance *tuner);
186
187typedef int(*tuner_set_frequency_func_t) (struct tuner_instance *tuner,
188 u32 mode,
189 s32
190 frequency);
191
192typedef int(*tuner_get_frequency_func_t) (struct tuner_instance *tuner,
193 u32 mode,
194 s32 *
195 r_ffrequency,
196 s32 *
197 i_ffrequency);
198
199typedef int(*tuner_lock_status_func_t) (struct tuner_instance *tuner,
200 enum tuner_lock_status *
201 lock_stat);
202
203typedef int(*tune_ri2c_write_read_func_t) (struct tuner_instance *tuner,
204 struct i2c_device_addr *
205 w_dev_addr, u16 w_count,
206 u8 *wData,
207 struct i2c_device_addr *
208 r_dev_addr, u16 r_count,
209 u8 *r_data);
210
211struct tuner_ops {
212 tuner_open_func_t open_func;
213 tuner_close_func_t close_func;
214 tuner_set_frequency_func_t set_frequency_func;
215 tuner_get_frequency_func_t get_frequency_func;
216 tuner_lock_status_func_t lock_status_func;
217 tune_ri2c_write_read_func_t i2c_write_read_func;
218
219};
220
221struct tuner_instance {
222 struct i2c_device_addr my_i2c_dev_addr;
223 struct tuner_common *my_common_attr;
224 void *my_ext_attr;
225 struct tuner_ops *my_funct;
226};
227
228int drxbsp_tuner_set_frequency(struct tuner_instance *tuner,
229 u32 mode,
230 s32 frequency);
231
232int drxbsp_tuner_get_frequency(struct tuner_instance *tuner,
233 u32 mode,
234 s32 *r_ffrequency,
235 s32 *i_ffrequency);
236
237int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner,
238 struct i2c_device_addr *w_dev_addr,
239 u16 w_count,
240 u8 *wData,
241 struct i2c_device_addr *r_dev_addr,
242 u16 r_count, u8 *r_data);
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261#ifndef DRXDAP_SINGLE_MASTER
262#define DRXDAP_SINGLE_MASTER 1
263#endif
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281#ifndef DRXDAP_MAX_WCHUNKSIZE
282#define DRXDAP_MAX_WCHUNKSIZE 60
283#endif
284
285
286
287
288
289
290
291
292
293
294
295
296#ifndef DRXDAP_MAX_RCHUNKSIZE
297#define DRXDAP_MAX_RCHUNKSIZE 60
298#endif
299
300
301
302
303
304
305
306
307
308
309
310
311
312#ifndef DRX_UNKNOWN
313#define DRX_UNKNOWN (254)
314#endif
315
316
317
318
319
320
321
322
323#ifndef DRX_AUTO
324#define DRX_AUTO (255)
325#endif
326
327
328
329
330
331
332
333
334
335
336
337
338
339#define DRX_CAPABILITY_HAS_LNA (1UL << 0)
340
341
342
343
344
345
346#define DRX_CAPABILITY_HAS_OOBRX (1UL << 1)
347
348
349
350
351
352
353#define DRX_CAPABILITY_HAS_ATV (1UL << 2)
354
355
356
357
358
359
360#define DRX_CAPABILITY_HAS_DVBT (1UL << 3)
361
362
363
364
365
366
367#define DRX_CAPABILITY_HAS_ITUB (1UL << 4)
368
369
370
371
372
373
374#define DRX_CAPABILITY_HAS_AUD (1UL << 5)
375
376
377
378
379
380
381#define DRX_CAPABILITY_HAS_SAWSW (1UL << 6)
382
383
384
385
386
387
388#define DRX_CAPABILITY_HAS_GPIO1 (1UL << 7)
389
390
391
392
393
394
395#define DRX_CAPABILITY_HAS_GPIO2 (1UL << 8)
396
397
398
399
400
401
402#define DRX_CAPABILITY_HAS_IRQN (1UL << 9)
403
404
405
406
407
408
409#define DRX_CAPABILITY_HAS_8VSB (1UL << 10)
410
411
412
413
414
415
416#define DRX_CAPABILITY_HAS_SMATX (1UL << 11)
417
418
419
420
421
422
423#define DRX_CAPABILITY_HAS_SMARX (1UL << 12)
424
425
426
427
428
429
430#define DRX_CAPABILITY_HAS_ITUAC (1UL << 13)
431
432
433
434
435
436#define DRX_VERSIONSTRING(MAJOR, MINOR, PATCH) \
437 DRX_VERSIONSTRING_HELP(MAJOR)"." \
438 DRX_VERSIONSTRING_HELP(MINOR)"." \
439 DRX_VERSIONSTRING_HELP(PATCH)
440#define DRX_VERSIONSTRING_HELP(NUM) #NUM
441
442
443
444
445
446
447
448
449#define DRX_16TO8(x) ((u8) (((u16)x) & 0xFF)), \
450 ((u8)((((u16)x)>>8)&0xFF))
451
452
453
454
455#define DRX_U16TODRXFREQ(x) ((x & 0x8000) ? \
456 ((s32) \
457 (((u32) x) | 0xFFFF0000)) : \
458 ((s32) x))
459
460
461
462
463
464
465
466
467
468enum drx_standard {
469 DRX_STANDARD_DVBT = 0,
470 DRX_STANDARD_8VSB,
471 DRX_STANDARD_NTSC,
472 DRX_STANDARD_PAL_SECAM_BG,
473
474 DRX_STANDARD_PAL_SECAM_DK,
475
476 DRX_STANDARD_PAL_SECAM_I,
477
478 DRX_STANDARD_PAL_SECAM_L,
479
480
481 DRX_STANDARD_PAL_SECAM_LP,
482
483
484 DRX_STANDARD_ITU_A,
485 DRX_STANDARD_ITU_B,
486 DRX_STANDARD_ITU_C,
487 DRX_STANDARD_ITU_D,
488 DRX_STANDARD_FM,
489 DRX_STANDARD_DTMB,
490 DRX_STANDARD_UNKNOWN = DRX_UNKNOWN,
491
492 DRX_STANDARD_AUTO = DRX_AUTO
493
494};
495
496
497
498
499
500enum drx_substandard {
501 DRX_SUBSTANDARD_MAIN = 0,
502 DRX_SUBSTANDARD_ATV_BG_SCANDINAVIA,
503 DRX_SUBSTANDARD_ATV_DK_POLAND,
504 DRX_SUBSTANDARD_ATV_DK_CHINA,
505 DRX_SUBSTANDARD_UNKNOWN = DRX_UNKNOWN,
506
507 DRX_SUBSTANDARD_AUTO = DRX_AUTO
508
509};
510
511
512
513
514
515enum drx_bandwidth {
516 DRX_BANDWIDTH_8MHZ = 0,
517 DRX_BANDWIDTH_7MHZ,
518 DRX_BANDWIDTH_6MHZ,
519 DRX_BANDWIDTH_UNKNOWN = DRX_UNKNOWN,
520
521 DRX_BANDWIDTH_AUTO = DRX_AUTO
522
523};
524
525
526
527
528
529enum drx_mirror {
530 DRX_MIRROR_NO = 0,
531 DRX_MIRROR_YES,
532 DRX_MIRROR_UNKNOWN = DRX_UNKNOWN,
533
534 DRX_MIRROR_AUTO = DRX_AUTO
535
536};
537
538
539
540
541
542enum drx_modulation {
543 DRX_CONSTELLATION_BPSK = 0,
544 DRX_CONSTELLATION_QPSK,
545 DRX_CONSTELLATION_PSK8,
546 DRX_CONSTELLATION_QAM16,
547 DRX_CONSTELLATION_QAM32,
548 DRX_CONSTELLATION_QAM64,
549 DRX_CONSTELLATION_QAM128,
550 DRX_CONSTELLATION_QAM256,
551 DRX_CONSTELLATION_QAM512,
552 DRX_CONSTELLATION_QAM1024,
553 DRX_CONSTELLATION_QPSK_NR,
554 DRX_CONSTELLATION_UNKNOWN = DRX_UNKNOWN,
555
556 DRX_CONSTELLATION_AUTO = DRX_AUTO
557
558};
559
560
561
562
563
564enum drx_hierarchy {
565 DRX_HIERARCHY_NONE = 0,
566 DRX_HIERARCHY_ALPHA1,
567 DRX_HIERARCHY_ALPHA2,
568 DRX_HIERARCHY_ALPHA4,
569 DRX_HIERARCHY_UNKNOWN = DRX_UNKNOWN,
570
571 DRX_HIERARCHY_AUTO = DRX_AUTO
572
573};
574
575
576
577
578
579enum drx_priority {
580 DRX_PRIORITY_LOW = 0,
581 DRX_PRIORITY_HIGH,
582 DRX_PRIORITY_UNKNOWN = DRX_UNKNOWN
583
584};
585
586
587
588
589
590enum drx_coderate {
591 DRX_CODERATE_1DIV2 = 0,
592 DRX_CODERATE_2DIV3,
593 DRX_CODERATE_3DIV4,
594 DRX_CODERATE_5DIV6,
595 DRX_CODERATE_7DIV8,
596 DRX_CODERATE_UNKNOWN = DRX_UNKNOWN,
597
598 DRX_CODERATE_AUTO = DRX_AUTO
599
600};
601
602
603
604
605
606enum drx_guard {
607 DRX_GUARD_1DIV32 = 0,
608 DRX_GUARD_1DIV16,
609 DRX_GUARD_1DIV8,
610 DRX_GUARD_1DIV4,
611 DRX_GUARD_UNKNOWN = DRX_UNKNOWN,
612
613 DRX_GUARD_AUTO = DRX_AUTO
614
615};
616
617
618
619
620
621enum drx_fft_mode {
622 DRX_FFTMODE_2K = 0,
623 DRX_FFTMODE_4K,
624 DRX_FFTMODE_8K,
625 DRX_FFTMODE_UNKNOWN = DRX_UNKNOWN,
626
627 DRX_FFTMODE_AUTO = DRX_AUTO
628
629};
630
631
632
633
634
635enum drx_classification {
636 DRX_CLASSIFICATION_GAUSS = 0,
637 DRX_CLASSIFICATION_HVY_GAUSS,
638 DRX_CLASSIFICATION_COCHANNEL,
639 DRX_CLASSIFICATION_STATIC,
640 DRX_CLASSIFICATION_MOVING,
641 DRX_CLASSIFICATION_ZERODB,
642 DRX_CLASSIFICATION_UNKNOWN = DRX_UNKNOWN,
643
644 DRX_CLASSIFICATION_AUTO = DRX_AUTO
645
646};
647
648
649
650
651
652enum drx_interleave_mode {
653 DRX_INTERLEAVEMODE_I128_J1 = 0,
654 DRX_INTERLEAVEMODE_I128_J1_V2,
655 DRX_INTERLEAVEMODE_I128_J2,
656 DRX_INTERLEAVEMODE_I64_J2,
657 DRX_INTERLEAVEMODE_I128_J3,
658 DRX_INTERLEAVEMODE_I32_J4,
659 DRX_INTERLEAVEMODE_I128_J4,
660 DRX_INTERLEAVEMODE_I16_J8,
661 DRX_INTERLEAVEMODE_I128_J5,
662 DRX_INTERLEAVEMODE_I8_J16,
663 DRX_INTERLEAVEMODE_I128_J6,
664 DRX_INTERLEAVEMODE_RESERVED_11,
665 DRX_INTERLEAVEMODE_I128_J7,
666 DRX_INTERLEAVEMODE_RESERVED_13,
667 DRX_INTERLEAVEMODE_I128_J8,
668 DRX_INTERLEAVEMODE_RESERVED_15,
669 DRX_INTERLEAVEMODE_I12_J17,
670 DRX_INTERLEAVEMODE_I5_J4,
671 DRX_INTERLEAVEMODE_B52_M240,
672 DRX_INTERLEAVEMODE_B52_M720,
673 DRX_INTERLEAVEMODE_B52_M48,
674 DRX_INTERLEAVEMODE_B52_M0,
675 DRX_INTERLEAVEMODE_UNKNOWN = DRX_UNKNOWN,
676
677 DRX_INTERLEAVEMODE_AUTO = DRX_AUTO
678
679};
680
681
682
683
684
685enum drx_carrier_mode {
686 DRX_CARRIER_MULTI = 0,
687 DRX_CARRIER_SINGLE,
688 DRX_CARRIER_UNKNOWN = DRX_UNKNOWN,
689
690 DRX_CARRIER_AUTO = DRX_AUTO
691};
692
693
694
695
696
697enum drx_frame_mode {
698 DRX_FRAMEMODE_420 = 0,
699 DRX_FRAMEMODE_595,
700 DRX_FRAMEMODE_945,
701 DRX_FRAMEMODE_420_FIXED_PN,
702
703 DRX_FRAMEMODE_945_FIXED_PN,
704
705 DRX_FRAMEMODE_UNKNOWN = DRX_UNKNOWN,
706
707 DRX_FRAMEMODE_AUTO = DRX_AUTO
708
709};
710
711
712
713
714
715enum drx_tps_frame {
716 DRX_TPS_FRAME1 = 0,
717 DRX_TPS_FRAME2,
718 DRX_TPS_FRAME3,
719 DRX_TPS_FRAME4,
720 DRX_TPS_FRAME_UNKNOWN = DRX_UNKNOWN
721
722};
723
724
725
726
727
728enum drx_ldpc {
729 DRX_LDPC_0_4 = 0,
730 DRX_LDPC_0_6,
731 DRX_LDPC_0_8,
732 DRX_LDPC_UNKNOWN = DRX_UNKNOWN,
733
734 DRX_LDPC_AUTO = DRX_AUTO
735};
736
737
738
739
740
741enum drx_pilot_mode {
742 DRX_PILOT_ON = 0,
743 DRX_PILOT_OFF,
744 DRX_PILOT_UNKNOWN = DRX_UNKNOWN,
745
746 DRX_PILOT_AUTO = DRX_AUTO
747};
748
749
750
751
752
753
754enum drxu_code_action {
755 UCODE_UPLOAD,
756 UCODE_VERIFY
757};
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789enum drx_lock_status {
790 DRX_NEVER_LOCK = 0,
791 DRX_NOT_LOCKED,
792 DRX_LOCK_STATE_1,
793 DRX_LOCK_STATE_2,
794 DRX_LOCK_STATE_3,
795 DRX_LOCK_STATE_4,
796 DRX_LOCK_STATE_5,
797 DRX_LOCK_STATE_6,
798 DRX_LOCK_STATE_7,
799 DRX_LOCK_STATE_8,
800 DRX_LOCK_STATE_9,
801 DRX_LOCKED
802};
803
804
805
806
807enum drx_uio {
808 DRX_UIO1,
809 DRX_UIO2,
810 DRX_UIO3,
811 DRX_UIO4,
812 DRX_UIO5,
813 DRX_UIO6,
814 DRX_UIO7,
815 DRX_UIO8,
816 DRX_UIO9,
817 DRX_UIO10,
818 DRX_UIO11,
819 DRX_UIO12,
820 DRX_UIO13,
821 DRX_UIO14,
822 DRX_UIO15,
823 DRX_UIO16,
824 DRX_UIO17,
825 DRX_UIO18,
826 DRX_UIO19,
827 DRX_UIO20,
828 DRX_UIO21,
829 DRX_UIO22,
830 DRX_UIO23,
831 DRX_UIO24,
832 DRX_UIO25,
833 DRX_UIO26,
834 DRX_UIO27,
835 DRX_UIO28,
836 DRX_UIO29,
837 DRX_UIO30,
838 DRX_UIO31,
839 DRX_UIO32,
840 DRX_UIO_MAX = DRX_UIO32
841};
842
843
844
845
846
847
848
849
850
851enum drxuio_mode {
852 DRX_UIO_MODE_DISABLE = 0x01,
853
854 DRX_UIO_MODE_READWRITE = 0x02,
855
856 DRX_UIO_MODE_FIRMWARE = 0x04,
857
858 DRX_UIO_MODE_FIRMWARE0 = DRX_UIO_MODE_FIRMWARE,
859
860 DRX_UIO_MODE_FIRMWARE1 = 0x08,
861
862 DRX_UIO_MODE_FIRMWARE2 = 0x10,
863
864 DRX_UIO_MODE_FIRMWARE3 = 0x20,
865
866 DRX_UIO_MODE_FIRMWARE4 = 0x40,
867
868 DRX_UIO_MODE_FIRMWARE5 = 0x80
869
870};
871
872
873
874
875
876
877enum drxoob_downstream_standard {
878 DRX_OOB_MODE_A = 0,
879
880 DRX_OOB_MODE_B_GRADE_A,
881
882 DRX_OOB_MODE_B_GRADE_B
883
884};
885
886
887
888
889
890
891
892
893
894
895
896#ifndef DRX_CFG_BASE
897#define DRX_CFG_BASE 0
898#endif
899
900#define DRX_CFG_MPEG_OUTPUT (DRX_CFG_BASE + 0)
901#define DRX_CFG_PKTERR (DRX_CFG_BASE + 1)
902#define DRX_CFG_SYMCLK_OFFS (DRX_CFG_BASE + 2)
903#define DRX_CFG_SMA (DRX_CFG_BASE + 3)
904#define DRX_CFG_PINSAFE (DRX_CFG_BASE + 4)
905#define DRX_CFG_SUBSTANDARD (DRX_CFG_BASE + 5)
906#define DRX_CFG_AUD_VOLUME (DRX_CFG_BASE + 6)
907#define DRX_CFG_AUD_RDS (DRX_CFG_BASE + 7)
908#define DRX_CFG_AUD_AUTOSOUND (DRX_CFG_BASE + 8)
909#define DRX_CFG_AUD_ASS_THRES (DRX_CFG_BASE + 9)
910#define DRX_CFG_AUD_DEVIATION (DRX_CFG_BASE + 10)
911#define DRX_CFG_AUD_PRESCALE (DRX_CFG_BASE + 11)
912#define DRX_CFG_AUD_MIXER (DRX_CFG_BASE + 12)
913#define DRX_CFG_AUD_AVSYNC (DRX_CFG_BASE + 13)
914#define DRX_CFG_AUD_CARRIER (DRX_CFG_BASE + 14)
915#define DRX_CFG_I2S_OUTPUT (DRX_CFG_BASE + 15)
916#define DRX_CFG_ATV_STANDARD (DRX_CFG_BASE + 16)
917#define DRX_CFG_SQI_SPEED (DRX_CFG_BASE + 17)
918#define DRX_CTRL_CFG_MAX (DRX_CFG_BASE + 18)
919
920#define DRX_CFG_PINS_SAFE_MODE DRX_CFG_PINSAFE
921
922
923
924
925
926
927
928
929
930
931
932
933
934struct drxu_code_info {
935 char *mc_file;
936};
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955#define AUX_VER_RECORD 0x8000
956
957struct drx_mc_version_rec {
958 u16 aux_type;
959 u32 mc_dev_type;
960 u32 mc_version;
961 u32 mc_base_version;
962};
963
964
965
966
967
968
969
970
971
972struct drx_filter_info {
973 u8 *data_re;
974
975 u8 *data_im;
976
977 u16 size_re;
978
979 u16 size_im;
980
981};
982
983
984
985
986
987
988
989
990
991
992struct drx_channel {
993 s32 frequency;
994
995 enum drx_bandwidth bandwidth;
996
997 enum drx_mirror mirror;
998 enum drx_modulation constellation;
999
1000 enum drx_hierarchy hierarchy;
1001
1002 enum drx_priority priority;
1003 enum drx_coderate coderate;
1004 enum drx_guard guard;
1005 enum drx_fft_mode fftmode;
1006 enum drx_classification classification;
1007
1008 u32 symbolrate;
1009
1010 enum drx_interleave_mode interleavemode;
1011
1012 enum drx_ldpc ldpc;
1013 enum drx_carrier_mode carrier;
1014 enum drx_frame_mode framemode;
1015
1016 enum drx_pilot_mode pilot;
1017};
1018
1019
1020
1021enum drx_cfg_sqi_speed {
1022 DRX_SQI_SPEED_FAST = 0,
1023 DRX_SQI_SPEED_MEDIUM,
1024 DRX_SQI_SPEED_SLOW,
1025 DRX_SQI_SPEED_UNKNOWN = DRX_UNKNOWN
1026};
1027
1028
1029
1030
1031
1032
1033
1034
1035struct drx_complex {
1036 s16 im;
1037
1038 s16 re;
1039
1040};
1041
1042
1043
1044
1045
1046
1047
1048
1049struct drx_frequency_plan {
1050 s32 first;
1051
1052 s32 last;
1053
1054 s32 step;
1055
1056 enum drx_bandwidth bandwidth;
1057
1058 u16 ch_number;
1059
1060
1061 char **ch_names;
1062
1063
1064};
1065
1066
1067
1068
1069
1070
1071
1072
1073struct drx_scan_param {
1074 struct drx_frequency_plan *frequency_plan;
1075
1076 u16 frequency_plan_size;
1077 u32 num_tries;
1078 s32 skip;
1079
1080 void *ext_params;
1081};
1082
1083
1084
1085
1086
1087
1088
1089enum drx_scan_command {
1090 DRX_SCAN_COMMAND_INIT = 0,
1091 DRX_SCAN_COMMAND_NEXT,
1092 DRX_SCAN_COMMAND_STOP
1093};
1094
1095
1096
1097
1098
1099
1100typedef int(*drx_scan_func_t) (void *scan_context,
1101 enum drx_scan_command scan_command,
1102 struct drx_channel *scan_channel,
1103 bool *get_next_channel);
1104
1105
1106
1107
1108
1109
1110
1111
1112 struct drxtps_info {
1113 enum drx_fft_mode fftmode;
1114 enum drx_guard guard;
1115 enum drx_modulation constellation;
1116
1117 enum drx_hierarchy hierarchy;
1118
1119 enum drx_coderate high_coderate;
1120
1121 enum drx_coderate low_coderate;
1122
1123 enum drx_tps_frame frame;
1124 u8 length;
1125 u16 cell_id;
1126 };
1127
1128
1129
1130
1131
1132
1133
1134
1135 enum drx_power_mode {
1136 DRX_POWER_UP = 0,
1137
1138 DRX_POWER_MODE_1,
1139
1140 DRX_POWER_MODE_2,
1141
1142 DRX_POWER_MODE_3,
1143
1144 DRX_POWER_MODE_4,
1145
1146 DRX_POWER_MODE_5,
1147
1148 DRX_POWER_MODE_6,
1149
1150 DRX_POWER_MODE_7,
1151
1152 DRX_POWER_MODE_8,
1153
1154
1155 DRX_POWER_MODE_9,
1156
1157 DRX_POWER_MODE_10,
1158
1159 DRX_POWER_MODE_11,
1160
1161 DRX_POWER_MODE_12,
1162
1163 DRX_POWER_MODE_13,
1164
1165 DRX_POWER_MODE_14,
1166
1167 DRX_POWER_MODE_15,
1168
1169 DRX_POWER_MODE_16,
1170
1171 DRX_POWER_DOWN = 255
1172
1173 };
1174
1175
1176
1177
1178
1179
1180
1181
1182 enum drx_module {
1183 DRX_MODULE_DEVICE,
1184 DRX_MODULE_MICROCODE,
1185 DRX_MODULE_DRIVERCORE,
1186 DRX_MODULE_DEVICEDRIVER,
1187 DRX_MODULE_DAP,
1188 DRX_MODULE_BSP_I2C,
1189 DRX_MODULE_BSP_TUNER,
1190 DRX_MODULE_BSP_HOST,
1191 DRX_MODULE_UNKNOWN
1192 };
1193
1194
1195
1196
1197
1198
1199 struct drx_version {
1200 enum drx_module module_type;
1201
1202 char *module_name;
1203
1204 u16 v_major;
1205 u16 v_minor;
1206 u16 v_patch;
1207 char *v_string;
1208 };
1209
1210
1211
1212
1213
1214
1215struct drx_version_list {
1216 struct drx_version *version;
1217 struct drx_version_list *next;
1218
1219};
1220
1221
1222
1223
1224
1225
1226
1227
1228 struct drxuio_cfg {
1229 enum drx_uio uio;
1230
1231 enum drxuio_mode mode;
1232
1233 };
1234
1235
1236
1237
1238
1239
1240
1241
1242 struct drxuio_data {
1243 enum drx_uio uio;
1244
1245 bool value;
1246
1247 };
1248
1249
1250
1251
1252
1253
1254
1255
1256 struct drxoob {
1257 s32 frequency;
1258 enum drxoob_downstream_standard standard;
1259
1260 bool spectrum_inverted;
1261
1262 };
1263
1264
1265
1266
1267
1268
1269
1270
1271 struct drxoob_status {
1272 s32 frequency;
1273 enum drx_lock_status lock;
1274 u32 mer;
1275 s32 symbol_rate_offset;
1276 };
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286 struct drx_cfg {
1287 u32 cfg_type;
1288
1289 void *cfg_data;
1290
1291 };
1292
1293
1294
1295
1296
1297
1298
1299
1300 enum drxmpeg_str_width {
1301 DRX_MPEG_STR_WIDTH_1,
1302 DRX_MPEG_STR_WIDTH_8
1303 };
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313 struct drx_cfg_mpeg_output {
1314 bool enable_mpeg_output;
1315 bool insert_rs_byte;
1316 bool enable_parallel;
1317
1318 bool invert_data;
1319 bool invert_err;
1320 bool invert_str;
1321 bool invert_val;
1322 bool invert_clk;
1323 bool static_clk;
1324
1325
1326
1327 u32 bitrate;
1328
1329 enum drxmpeg_str_width width_str;
1330
1331 };
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343 struct drxi2c_data {
1344 u16 port_nr;
1345 struct i2c_device_addr *w_dev_addr;
1346
1347 u16 w_count;
1348 u8 *wData;
1349 struct i2c_device_addr *r_dev_addr;
1350
1351 u16 r_count;
1352 u8 *r_data;
1353 };
1354
1355
1356
1357
1358
1359
1360
1361
1362 enum drx_aud_standard {
1363 DRX_AUD_STANDARD_BTSC,
1364 DRX_AUD_STANDARD_A2,
1365 DRX_AUD_STANDARD_EIAJ,
1366 DRX_AUD_STANDARD_FM_STEREO,
1367 DRX_AUD_STANDARD_M_MONO,
1368 DRX_AUD_STANDARD_D_K_MONO,
1369 DRX_AUD_STANDARD_BG_FM,
1370 DRX_AUD_STANDARD_D_K1,
1371 DRX_AUD_STANDARD_D_K2,
1372 DRX_AUD_STANDARD_D_K3,
1373 DRX_AUD_STANDARD_BG_NICAM_FM,
1374
1375 DRX_AUD_STANDARD_L_NICAM_AM,
1376
1377 DRX_AUD_STANDARD_I_NICAM_FM,
1378
1379 DRX_AUD_STANDARD_D_K_NICAM_FM,
1380
1381 DRX_AUD_STANDARD_NOT_READY,
1382 DRX_AUD_STANDARD_AUTO = DRX_AUTO,
1383
1384 DRX_AUD_STANDARD_UNKNOWN = DRX_UNKNOWN
1385
1386 };
1387
1388
1389
1390
1391
1392 enum drx_aud_nicam_status {
1393 DRX_AUD_NICAM_DETECTED = 0,
1394
1395 DRX_AUD_NICAM_NOT_DETECTED,
1396
1397 DRX_AUD_NICAM_BAD
1398 };
1399
1400
1401
1402
1403 struct drx_aud_status {
1404 bool stereo;
1405 bool carrier_a;
1406 bool carrier_b;
1407 bool sap;
1408 bool rds;
1409 enum drx_aud_nicam_status nicam_status;
1410
1411 s8 fm_ident;
1412 };
1413
1414
1415
1416
1417
1418
1419
1420 struct drx_cfg_aud_rds {
1421 bool valid;
1422 u16 data[18];
1423 };
1424
1425
1426
1427
1428
1429
1430 enum drx_aud_avc_mode {
1431 DRX_AUD_AVC_OFF,
1432 DRX_AUD_AVC_DECAYTIME_8S,
1433 DRX_AUD_AVC_DECAYTIME_4S,
1434 DRX_AUD_AVC_DECAYTIME_2S,
1435 DRX_AUD_AVC_DECAYTIME_20MS
1436 };
1437
1438
1439
1440
1441
1442 enum drx_aud_avc_max_gain {
1443 DRX_AUD_AVC_MAX_GAIN_0DB,
1444 DRX_AUD_AVC_MAX_GAIN_6DB,
1445 DRX_AUD_AVC_MAX_GAIN_12DB
1446 };
1447
1448
1449
1450
1451
1452 enum drx_aud_avc_max_atten {
1453 DRX_AUD_AVC_MAX_ATTEN_12DB,
1454
1455 DRX_AUD_AVC_MAX_ATTEN_18DB,
1456
1457 DRX_AUD_AVC_MAX_ATTEN_24DB
1458 };
1459
1460
1461
1462 struct drx_cfg_aud_volume {
1463 bool mute;
1464 s16 volume;
1465 enum drx_aud_avc_mode avc_mode;
1466 u16 avc_ref_level;
1467 enum drx_aud_avc_max_gain avc_max_gain;
1468
1469 enum drx_aud_avc_max_atten avc_max_atten;
1470
1471 s16 strength_left;
1472 s16 strength_right;
1473 };
1474
1475
1476
1477
1478
1479 enum drxi2s_mode {
1480 DRX_I2S_MODE_MASTER,
1481 DRX_I2S_MODE_SLAVE
1482 };
1483
1484
1485
1486
1487 enum drxi2s_word_length {
1488 DRX_I2S_WORDLENGTH_32 = 0,
1489 DRX_I2S_WORDLENGTH_16 = 1
1490 };
1491
1492
1493
1494
1495 enum drxi2s_format {
1496 DRX_I2S_FORMAT_WS_WITH_DATA,
1497
1498 DRX_I2S_FORMAT_WS_ADVANCED
1499
1500 };
1501
1502
1503
1504
1505 enum drxi2s_polarity {
1506 DRX_I2S_POLARITY_RIGHT,
1507 DRX_I2S_POLARITY_LEFT
1508 };
1509
1510
1511
1512
1513 struct drx_cfg_i2s_output {
1514 bool output_enable;
1515 u32 frequency;
1516 enum drxi2s_mode mode;
1517 enum drxi2s_word_length word_length;
1518
1519 enum drxi2s_polarity polarity;
1520 enum drxi2s_format format;
1521 };
1522
1523
1524
1525
1526
1527
1528 enum drx_aud_fm_deemphasis {
1529 DRX_AUD_FM_DEEMPH_50US,
1530 DRX_AUD_FM_DEEMPH_75US,
1531 DRX_AUD_FM_DEEMPH_OFF
1532 };
1533
1534
1535
1536
1537
1538
1539 enum drx_cfg_aud_deviation {
1540 DRX_AUD_DEVIATION_NORMAL,
1541 DRX_AUD_DEVIATION_HIGH
1542 };
1543
1544
1545
1546
1547
1548 enum drx_no_carrier_option {
1549 DRX_NO_CARRIER_MUTE,
1550 DRX_NO_CARRIER_NOISE
1551 };
1552
1553
1554
1555
1556
1557 enum drx_cfg_aud_auto_sound {
1558 DRX_AUD_AUTO_SOUND_OFF = 0,
1559 DRX_AUD_AUTO_SOUND_SELECT_ON_CHANGE_ON,
1560 DRX_AUD_AUTO_SOUND_SELECT_ON_CHANGE_OFF
1561 };
1562
1563
1564
1565
1566
1567 struct drx_cfg_aud_ass_thres {
1568 u16 a2;
1569 u16 btsc;
1570 u16 nicam;
1571 };
1572
1573
1574
1575
1576 struct drx_aud_carrier {
1577 u16 thres;
1578 enum drx_no_carrier_option opt;
1579 s32 shift;
1580 s32 dco;
1581 };
1582
1583
1584
1585
1586 struct drx_cfg_aud_carriers {
1587 struct drx_aud_carrier a;
1588 struct drx_aud_carrier b;
1589 };
1590
1591
1592
1593
1594 enum drx_aud_i2s_src {
1595 DRX_AUD_SRC_MONO,
1596 DRX_AUD_SRC_STEREO_OR_AB,
1597 DRX_AUD_SRC_STEREO_OR_A,
1598 DRX_AUD_SRC_STEREO_OR_B};
1599
1600
1601
1602
1603 enum drx_aud_i2s_matrix {
1604 DRX_AUD_I2S_MATRIX_A_MONO,
1605
1606 DRX_AUD_I2S_MATRIX_B_MONO,
1607
1608 DRX_AUD_I2S_MATRIX_STEREO,
1609
1610 DRX_AUD_I2S_MATRIX_MONO };
1611
1612
1613
1614
1615
1616 enum drx_aud_fm_matrix {
1617 DRX_AUD_FM_MATRIX_NO_MATRIX,
1618 DRX_AUD_FM_MATRIX_GERMAN,
1619 DRX_AUD_FM_MATRIX_KOREAN,
1620 DRX_AUD_FM_MATRIX_SOUND_A,
1621 DRX_AUD_FM_MATRIX_SOUND_B};
1622
1623
1624
1625
1626
1627struct drx_cfg_aud_mixer {
1628 enum drx_aud_i2s_src source_i2s;
1629 enum drx_aud_i2s_matrix matrix_i2s;
1630 enum drx_aud_fm_matrix matrix_fm;
1631};
1632
1633
1634
1635
1636
1637
1638
1639 enum drx_cfg_aud_av_sync {
1640 DRX_AUD_AVSYNC_OFF,
1641 DRX_AUD_AVSYNC_NTSC,
1642
1643 DRX_AUD_AVSYNC_MONOCHROME,
1644
1645 DRX_AUD_AVSYNC_PAL_SECAM
1646 };
1647
1648
1649
1650
1651struct drx_cfg_aud_prescale {
1652 u16 fm_deviation;
1653 s16 nicam_gain;
1654};
1655
1656
1657
1658
1659struct drx_aud_beep {
1660 s16 volume;
1661 u16 frequency;
1662 bool mute;
1663};
1664
1665
1666
1667
1668 enum drx_aud_btsc_detect {
1669 DRX_BTSC_STEREO,
1670 DRX_BTSC_MONO_AND_SAP};
1671
1672
1673
1674
1675struct drx_aud_data {
1676
1677 bool audio_is_active;
1678 enum drx_aud_standard audio_standard;
1679 struct drx_cfg_i2s_output i2sdata;
1680 struct drx_cfg_aud_volume volume;
1681 enum drx_cfg_aud_auto_sound auto_sound;
1682 struct drx_cfg_aud_ass_thres ass_thresholds;
1683 struct drx_cfg_aud_carriers carriers;
1684 struct drx_cfg_aud_mixer mixer;
1685 enum drx_cfg_aud_deviation deviation;
1686 enum drx_cfg_aud_av_sync av_sync;
1687 struct drx_cfg_aud_prescale prescale;
1688 enum drx_aud_fm_deemphasis deemph;
1689 enum drx_aud_btsc_detect btsc_detect;
1690
1691 u16 rds_data_counter;
1692 bool rds_data_present;
1693};
1694
1695
1696
1697
1698 enum drx_qam_lock_range {
1699 DRX_QAM_LOCKRANGE_NORMAL,
1700 DRX_QAM_LOCKRANGE_EXTENDED};
1701
1702
1703
1704
1705
1706
1707
1708
1709 typedef u32 dr_xaddr_t, *pdr_xaddr_t;
1710
1711
1712 typedef u32 dr_xflags_t, *pdr_xflags_t;
1713
1714
1715 typedef int(*drx_write_block_func_t) (struct i2c_device_addr *dev_addr,
1716 u32 addr,
1717 u16 datasize,
1718 u8 *data,
1719 u32 flags);
1720
1721
1722 typedef int(*drx_read_block_func_t) (struct i2c_device_addr *dev_addr,
1723 u32 addr,
1724 u16 datasize,
1725 u8 *data,
1726 u32 flags);
1727
1728
1729 typedef int(*drx_write_reg8func_t) (struct i2c_device_addr *dev_addr,
1730 u32 addr,
1731 u8 data,
1732 u32 flags);
1733
1734
1735 typedef int(*drx_read_reg8func_t) (struct i2c_device_addr *dev_addr,
1736 u32 addr,
1737 u8 *data,
1738 u32 flags);
1739
1740
1741 typedef int(*drx_read_modify_write_reg8func_t) (struct i2c_device_addr *dev_addr,
1742 u32 waddr,
1743 u32 raddr,
1744 u8 wdata,
1745 u8 *rdata);
1746
1747
1748 typedef int(*drx_write_reg16func_t) (struct i2c_device_addr *dev_addr,
1749 u32 addr,
1750 u16 data,
1751 u32 flags);
1752
1753
1754 typedef int(*drx_read_reg16func_t) (struct i2c_device_addr *dev_addr,
1755 u32 addr,
1756 u16 *data,
1757 u32 flags);
1758
1759
1760 typedef int(*drx_read_modify_write_reg16func_t) (struct i2c_device_addr *dev_addr,
1761 u32 waddr,
1762 u32 raddr,
1763 u16 wdata,
1764 u16 *rdata);
1765
1766
1767 typedef int(*drx_write_reg32func_t) (struct i2c_device_addr *dev_addr,
1768 u32 addr,
1769 u32 data,
1770 u32 flags);
1771
1772
1773 typedef int(*drx_read_reg32func_t) (struct i2c_device_addr *dev_addr,
1774 u32 addr,
1775 u32 *data,
1776 u32 flags);
1777
1778
1779 typedef int(*drx_read_modify_write_reg32func_t) (struct i2c_device_addr *dev_addr,
1780 u32 waddr,
1781 u32 raddr,
1782 u32 wdata,
1783 u32 *rdata);
1784
1785
1786
1787
1788struct drx_access_func {
1789 drx_write_block_func_t write_block_func;
1790 drx_read_block_func_t read_block_func;
1791 drx_write_reg8func_t write_reg8func;
1792 drx_read_reg8func_t read_reg8func;
1793 drx_read_modify_write_reg8func_t read_modify_write_reg8func;
1794 drx_write_reg16func_t write_reg16func;
1795 drx_read_reg16func_t read_reg16func;
1796 drx_read_modify_write_reg16func_t read_modify_write_reg16func;
1797 drx_write_reg32func_t write_reg32func;
1798 drx_read_reg32func_t read_reg32func;
1799 drx_read_modify_write_reg32func_t read_modify_write_reg32func;
1800};
1801
1802
1803struct drx_reg_dump {
1804 u32 address;
1805 u32 data;
1806};
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817 struct drx_common_attr {
1818
1819 char *microcode_file;
1820 bool verify_microcode;
1821
1822 struct drx_mc_version_rec mcversion;
1823
1824
1825
1826 s32 intermediate_freq;
1827
1828 s32 sys_clock_freq;
1829
1830 s32 osc_clock_freq;
1831
1832 s16 osc_clock_deviation;
1833
1834 bool mirror_freq_spect;
1835
1836
1837
1838 struct drx_cfg_mpeg_output mpeg_cfg;
1839
1840
1841 bool is_opened;
1842
1843
1844 struct drx_scan_param *scan_param;
1845
1846 u16 scan_freq_plan_index;
1847
1848 s32 scan_next_frequency;
1849
1850 bool scan_ready;
1851 u32 scan_max_channels;
1852 u32 scan_channels_scanned;
1853
1854
1855 drx_scan_func_t scan_function;
1856
1857
1858 void *scan_context;
1859
1860 u16 scan_demod_lock_timeout;
1861
1862 enum drx_lock_status scan_desired_lock;
1863
1864
1865
1866 bool scan_active;
1867
1868
1869 enum drx_power_mode current_power_mode;
1870
1871
1872
1873 u8 tuner_port_nr;
1874 s32 tuner_min_freq_rf;
1875
1876 s32 tuner_max_freq_rf;
1877
1878 bool tuner_rf_agc_pol;
1879 bool tuner_if_agc_pol;
1880 bool tuner_slow_mode;
1881
1882 struct drx_channel current_channel;
1883
1884 enum drx_standard current_standard;
1885
1886 enum drx_standard prev_standard;
1887
1888 enum drx_standard di_cache_standard;
1889
1890 bool use_bootloader;
1891 u32 capabilities;
1892 u32 product_id; };
1893
1894
1895
1896
1897
1898struct drx_demod_instance;
1899
1900
1901
1902
1903struct drx_demod_instance {
1904
1905 struct i2c_device_addr *my_i2c_dev_addr;
1906
1907 struct drx_common_attr *my_common_attr;
1908
1909 void *my_ext_attr;
1910
1911
1912 struct i2c_adapter *i2c;
1913 const struct firmware *firmware;
1914};
1915
1916
1917
1918
1919
1920
1921
1922
1923#define DRX_STR_STANDARD(x) ( \
1924 (x == DRX_STANDARD_DVBT) ? "DVB-T" : \
1925 (x == DRX_STANDARD_8VSB) ? "8VSB" : \
1926 (x == DRX_STANDARD_NTSC) ? "NTSC" : \
1927 (x == DRX_STANDARD_PAL_SECAM_BG) ? "PAL/SECAM B/G" : \
1928 (x == DRX_STANDARD_PAL_SECAM_DK) ? "PAL/SECAM D/K" : \
1929 (x == DRX_STANDARD_PAL_SECAM_I) ? "PAL/SECAM I" : \
1930 (x == DRX_STANDARD_PAL_SECAM_L) ? "PAL/SECAM L" : \
1931 (x == DRX_STANDARD_PAL_SECAM_LP) ? "PAL/SECAM LP" : \
1932 (x == DRX_STANDARD_ITU_A) ? "ITU-A" : \
1933 (x == DRX_STANDARD_ITU_B) ? "ITU-B" : \
1934 (x == DRX_STANDARD_ITU_C) ? "ITU-C" : \
1935 (x == DRX_STANDARD_ITU_D) ? "ITU-D" : \
1936 (x == DRX_STANDARD_FM) ? "FM" : \
1937 (x == DRX_STANDARD_DTMB) ? "DTMB" : \
1938 (x == DRX_STANDARD_AUTO) ? "Auto" : \
1939 (x == DRX_STANDARD_UNKNOWN) ? "Unknown" : \
1940 "(Invalid)")
1941
1942
1943
1944#define DRX_STR_BANDWIDTH(x) ( \
1945 (x == DRX_BANDWIDTH_8MHZ) ? "8 MHz" : \
1946 (x == DRX_BANDWIDTH_7MHZ) ? "7 MHz" : \
1947 (x == DRX_BANDWIDTH_6MHZ) ? "6 MHz" : \
1948 (x == DRX_BANDWIDTH_AUTO) ? "Auto" : \
1949 (x == DRX_BANDWIDTH_UNKNOWN) ? "Unknown" : \
1950 "(Invalid)")
1951#define DRX_STR_FFTMODE(x) ( \
1952 (x == DRX_FFTMODE_2K) ? "2k" : \
1953 (x == DRX_FFTMODE_4K) ? "4k" : \
1954 (x == DRX_FFTMODE_8K) ? "8k" : \
1955 (x == DRX_FFTMODE_AUTO) ? "Auto" : \
1956 (x == DRX_FFTMODE_UNKNOWN) ? "Unknown" : \
1957 "(Invalid)")
1958#define DRX_STR_GUARD(x) ( \
1959 (x == DRX_GUARD_1DIV32) ? "1/32nd" : \
1960 (x == DRX_GUARD_1DIV16) ? "1/16th" : \
1961 (x == DRX_GUARD_1DIV8) ? "1/8th" : \
1962 (x == DRX_GUARD_1DIV4) ? "1/4th" : \
1963 (x == DRX_GUARD_AUTO) ? "Auto" : \
1964 (x == DRX_GUARD_UNKNOWN) ? "Unknown" : \
1965 "(Invalid)")
1966#define DRX_STR_CONSTELLATION(x) ( \
1967 (x == DRX_CONSTELLATION_BPSK) ? "BPSK" : \
1968 (x == DRX_CONSTELLATION_QPSK) ? "QPSK" : \
1969 (x == DRX_CONSTELLATION_PSK8) ? "PSK8" : \
1970 (x == DRX_CONSTELLATION_QAM16) ? "QAM16" : \
1971 (x == DRX_CONSTELLATION_QAM32) ? "QAM32" : \
1972 (x == DRX_CONSTELLATION_QAM64) ? "QAM64" : \
1973 (x == DRX_CONSTELLATION_QAM128) ? "QAM128" : \
1974 (x == DRX_CONSTELLATION_QAM256) ? "QAM256" : \
1975 (x == DRX_CONSTELLATION_QAM512) ? "QAM512" : \
1976 (x == DRX_CONSTELLATION_QAM1024) ? "QAM1024" : \
1977 (x == DRX_CONSTELLATION_QPSK_NR) ? "QPSK_NR" : \
1978 (x == DRX_CONSTELLATION_AUTO) ? "Auto" : \
1979 (x == DRX_CONSTELLATION_UNKNOWN) ? "Unknown" : \
1980 "(Invalid)")
1981#define DRX_STR_CODERATE(x) ( \
1982 (x == DRX_CODERATE_1DIV2) ? "1/2nd" : \
1983 (x == DRX_CODERATE_2DIV3) ? "2/3rd" : \
1984 (x == DRX_CODERATE_3DIV4) ? "3/4th" : \
1985 (x == DRX_CODERATE_5DIV6) ? "5/6th" : \
1986 (x == DRX_CODERATE_7DIV8) ? "7/8th" : \
1987 (x == DRX_CODERATE_AUTO) ? "Auto" : \
1988 (x == DRX_CODERATE_UNKNOWN) ? "Unknown" : \
1989 "(Invalid)")
1990#define DRX_STR_HIERARCHY(x) ( \
1991 (x == DRX_HIERARCHY_NONE) ? "None" : \
1992 (x == DRX_HIERARCHY_ALPHA1) ? "Alpha=1" : \
1993 (x == DRX_HIERARCHY_ALPHA2) ? "Alpha=2" : \
1994 (x == DRX_HIERARCHY_ALPHA4) ? "Alpha=4" : \
1995 (x == DRX_HIERARCHY_AUTO) ? "Auto" : \
1996 (x == DRX_HIERARCHY_UNKNOWN) ? "Unknown" : \
1997 "(Invalid)")
1998#define DRX_STR_PRIORITY(x) ( \
1999 (x == DRX_PRIORITY_LOW) ? "Low" : \
2000 (x == DRX_PRIORITY_HIGH) ? "High" : \
2001 (x == DRX_PRIORITY_UNKNOWN) ? "Unknown" : \
2002 "(Invalid)")
2003#define DRX_STR_MIRROR(x) ( \
2004 (x == DRX_MIRROR_NO) ? "Normal" : \
2005 (x == DRX_MIRROR_YES) ? "Mirrored" : \
2006 (x == DRX_MIRROR_AUTO) ? "Auto" : \
2007 (x == DRX_MIRROR_UNKNOWN) ? "Unknown" : \
2008 "(Invalid)")
2009#define DRX_STR_CLASSIFICATION(x) ( \
2010 (x == DRX_CLASSIFICATION_GAUSS) ? "Gaussion" : \
2011 (x == DRX_CLASSIFICATION_HVY_GAUSS) ? "Heavy Gaussion" : \
2012 (x == DRX_CLASSIFICATION_COCHANNEL) ? "Co-channel" : \
2013 (x == DRX_CLASSIFICATION_STATIC) ? "Static echo" : \
2014 (x == DRX_CLASSIFICATION_MOVING) ? "Moving echo" : \
2015 (x == DRX_CLASSIFICATION_ZERODB) ? "Zero dB echo" : \
2016 (x == DRX_CLASSIFICATION_UNKNOWN) ? "Unknown" : \
2017 (x == DRX_CLASSIFICATION_AUTO) ? "Auto" : \
2018 "(Invalid)")
2019
2020#define DRX_STR_INTERLEAVEMODE(x) ( \
2021 (x == DRX_INTERLEAVEMODE_I128_J1) ? "I128_J1" : \
2022 (x == DRX_INTERLEAVEMODE_I128_J1_V2) ? "I128_J1_V2" : \
2023 (x == DRX_INTERLEAVEMODE_I128_J2) ? "I128_J2" : \
2024 (x == DRX_INTERLEAVEMODE_I64_J2) ? "I64_J2" : \
2025 (x == DRX_INTERLEAVEMODE_I128_J3) ? "I128_J3" : \
2026 (x == DRX_INTERLEAVEMODE_I32_J4) ? "I32_J4" : \
2027 (x == DRX_INTERLEAVEMODE_I128_J4) ? "I128_J4" : \
2028 (x == DRX_INTERLEAVEMODE_I16_J8) ? "I16_J8" : \
2029 (x == DRX_INTERLEAVEMODE_I128_J5) ? "I128_J5" : \
2030 (x == DRX_INTERLEAVEMODE_I8_J16) ? "I8_J16" : \
2031 (x == DRX_INTERLEAVEMODE_I128_J6) ? "I128_J6" : \
2032 (x == DRX_INTERLEAVEMODE_RESERVED_11) ? "Reserved 11" : \
2033 (x == DRX_INTERLEAVEMODE_I128_J7) ? "I128_J7" : \
2034 (x == DRX_INTERLEAVEMODE_RESERVED_13) ? "Reserved 13" : \
2035 (x == DRX_INTERLEAVEMODE_I128_J8) ? "I128_J8" : \
2036 (x == DRX_INTERLEAVEMODE_RESERVED_15) ? "Reserved 15" : \
2037 (x == DRX_INTERLEAVEMODE_I12_J17) ? "I12_J17" : \
2038 (x == DRX_INTERLEAVEMODE_I5_J4) ? "I5_J4" : \
2039 (x == DRX_INTERLEAVEMODE_B52_M240) ? "B52_M240" : \
2040 (x == DRX_INTERLEAVEMODE_B52_M720) ? "B52_M720" : \
2041 (x == DRX_INTERLEAVEMODE_B52_M48) ? "B52_M48" : \
2042 (x == DRX_INTERLEAVEMODE_B52_M0) ? "B52_M0" : \
2043 (x == DRX_INTERLEAVEMODE_UNKNOWN) ? "Unknown" : \
2044 (x == DRX_INTERLEAVEMODE_AUTO) ? "Auto" : \
2045 "(Invalid)")
2046
2047#define DRX_STR_LDPC(x) ( \
2048 (x == DRX_LDPC_0_4) ? "0.4" : \
2049 (x == DRX_LDPC_0_6) ? "0.6" : \
2050 (x == DRX_LDPC_0_8) ? "0.8" : \
2051 (x == DRX_LDPC_AUTO) ? "Auto" : \
2052 (x == DRX_LDPC_UNKNOWN) ? "Unknown" : \
2053 "(Invalid)")
2054
2055#define DRX_STR_CARRIER(x) ( \
2056 (x == DRX_CARRIER_MULTI) ? "Multi" : \
2057 (x == DRX_CARRIER_SINGLE) ? "Single" : \
2058 (x == DRX_CARRIER_AUTO) ? "Auto" : \
2059 (x == DRX_CARRIER_UNKNOWN) ? "Unknown" : \
2060 "(Invalid)")
2061
2062#define DRX_STR_FRAMEMODE(x) ( \
2063 (x == DRX_FRAMEMODE_420) ? "420" : \
2064 (x == DRX_FRAMEMODE_595) ? "595" : \
2065 (x == DRX_FRAMEMODE_945) ? "945" : \
2066 (x == DRX_FRAMEMODE_420_FIXED_PN) ? "420 with fixed PN" : \
2067 (x == DRX_FRAMEMODE_945_FIXED_PN) ? "945 with fixed PN" : \
2068 (x == DRX_FRAMEMODE_AUTO) ? "Auto" : \
2069 (x == DRX_FRAMEMODE_UNKNOWN) ? "Unknown" : \
2070 "(Invalid)")
2071
2072#define DRX_STR_PILOT(x) ( \
2073 (x == DRX_PILOT_ON) ? "On" : \
2074 (x == DRX_PILOT_OFF) ? "Off" : \
2075 (x == DRX_PILOT_AUTO) ? "Auto" : \
2076 (x == DRX_PILOT_UNKNOWN) ? "Unknown" : \
2077 "(Invalid)")
2078
2079
2080#define DRX_STR_TPS_FRAME(x) ( \
2081 (x == DRX_TPS_FRAME1) ? "Frame1" : \
2082 (x == DRX_TPS_FRAME2) ? "Frame2" : \
2083 (x == DRX_TPS_FRAME3) ? "Frame3" : \
2084 (x == DRX_TPS_FRAME4) ? "Frame4" : \
2085 (x == DRX_TPS_FRAME_UNKNOWN) ? "Unknown" : \
2086 "(Invalid)")
2087
2088
2089
2090#define DRX_STR_LOCKSTATUS(x) ( \
2091 (x == DRX_NEVER_LOCK) ? "Never" : \
2092 (x == DRX_NOT_LOCKED) ? "No" : \
2093 (x == DRX_LOCKED) ? "Locked" : \
2094 (x == DRX_LOCK_STATE_1) ? "Lock state 1" : \
2095 (x == DRX_LOCK_STATE_2) ? "Lock state 2" : \
2096 (x == DRX_LOCK_STATE_3) ? "Lock state 3" : \
2097 (x == DRX_LOCK_STATE_4) ? "Lock state 4" : \
2098 (x == DRX_LOCK_STATE_5) ? "Lock state 5" : \
2099 (x == DRX_LOCK_STATE_6) ? "Lock state 6" : \
2100 (x == DRX_LOCK_STATE_7) ? "Lock state 7" : \
2101 (x == DRX_LOCK_STATE_8) ? "Lock state 8" : \
2102 (x == DRX_LOCK_STATE_9) ? "Lock state 9" : \
2103 "(Invalid)")
2104
2105
2106#define DRX_STR_MODULE(x) ( \
2107 (x == DRX_MODULE_DEVICE) ? "Device" : \
2108 (x == DRX_MODULE_MICROCODE) ? "Microcode" : \
2109 (x == DRX_MODULE_DRIVERCORE) ? "CoreDriver" : \
2110 (x == DRX_MODULE_DEVICEDRIVER) ? "DeviceDriver" : \
2111 (x == DRX_MODULE_BSP_I2C) ? "BSP I2C" : \
2112 (x == DRX_MODULE_BSP_TUNER) ? "BSP Tuner" : \
2113 (x == DRX_MODULE_BSP_HOST) ? "BSP Host" : \
2114 (x == DRX_MODULE_DAP) ? "Data Access Protocol" : \
2115 (x == DRX_MODULE_UNKNOWN) ? "Unknown" : \
2116 "(Invalid)")
2117
2118#define DRX_STR_POWER_MODE(x) ( \
2119 (x == DRX_POWER_UP) ? "DRX_POWER_UP " : \
2120 (x == DRX_POWER_MODE_1) ? "DRX_POWER_MODE_1" : \
2121 (x == DRX_POWER_MODE_2) ? "DRX_POWER_MODE_2" : \
2122 (x == DRX_POWER_MODE_3) ? "DRX_POWER_MODE_3" : \
2123 (x == DRX_POWER_MODE_4) ? "DRX_POWER_MODE_4" : \
2124 (x == DRX_POWER_MODE_5) ? "DRX_POWER_MODE_5" : \
2125 (x == DRX_POWER_MODE_6) ? "DRX_POWER_MODE_6" : \
2126 (x == DRX_POWER_MODE_7) ? "DRX_POWER_MODE_7" : \
2127 (x == DRX_POWER_MODE_8) ? "DRX_POWER_MODE_8" : \
2128 (x == DRX_POWER_MODE_9) ? "DRX_POWER_MODE_9" : \
2129 (x == DRX_POWER_MODE_10) ? "DRX_POWER_MODE_10" : \
2130 (x == DRX_POWER_MODE_11) ? "DRX_POWER_MODE_11" : \
2131 (x == DRX_POWER_MODE_12) ? "DRX_POWER_MODE_12" : \
2132 (x == DRX_POWER_MODE_13) ? "DRX_POWER_MODE_13" : \
2133 (x == DRX_POWER_MODE_14) ? "DRX_POWER_MODE_14" : \
2134 (x == DRX_POWER_MODE_15) ? "DRX_POWER_MODE_15" : \
2135 (x == DRX_POWER_MODE_16) ? "DRX_POWER_MODE_16" : \
2136 (x == DRX_POWER_DOWN) ? "DRX_POWER_DOWN " : \
2137 "(Invalid)")
2138
2139#define DRX_STR_OOB_STANDARD(x) ( \
2140 (x == DRX_OOB_MODE_A) ? "ANSI 55-1 " : \
2141 (x == DRX_OOB_MODE_B_GRADE_A) ? "ANSI 55-2 A" : \
2142 (x == DRX_OOB_MODE_B_GRADE_B) ? "ANSI 55-2 B" : \
2143 "(Invalid)")
2144
2145#define DRX_STR_AUD_STANDARD(x) ( \
2146 (x == DRX_AUD_STANDARD_BTSC) ? "BTSC" : \
2147 (x == DRX_AUD_STANDARD_A2) ? "A2" : \
2148 (x == DRX_AUD_STANDARD_EIAJ) ? "EIAJ" : \
2149 (x == DRX_AUD_STANDARD_FM_STEREO) ? "FM Stereo" : \
2150 (x == DRX_AUD_STANDARD_AUTO) ? "Auto" : \
2151 (x == DRX_AUD_STANDARD_M_MONO) ? "M-Standard Mono" : \
2152 (x == DRX_AUD_STANDARD_D_K_MONO) ? "D/K Mono FM" : \
2153 (x == DRX_AUD_STANDARD_BG_FM) ? "B/G-Dual Carrier FM (A2)" : \
2154 (x == DRX_AUD_STANDARD_D_K1) ? "D/K1-Dual Carrier FM" : \
2155 (x == DRX_AUD_STANDARD_D_K2) ? "D/K2-Dual Carrier FM" : \
2156 (x == DRX_AUD_STANDARD_D_K3) ? "D/K3-Dual Carrier FM" : \
2157 (x == DRX_AUD_STANDARD_BG_NICAM_FM) ? "B/G-NICAM-FM" : \
2158 (x == DRX_AUD_STANDARD_L_NICAM_AM) ? "L-NICAM-AM" : \
2159 (x == DRX_AUD_STANDARD_I_NICAM_FM) ? "I-NICAM-FM" : \
2160 (x == DRX_AUD_STANDARD_D_K_NICAM_FM) ? "D/K-NICAM-FM" : \
2161 (x == DRX_AUD_STANDARD_UNKNOWN) ? "Unknown" : \
2162 "(Invalid)")
2163#define DRX_STR_AUD_STEREO(x) ( \
2164 (x == true) ? "Stereo" : \
2165 (x == false) ? "Mono" : \
2166 "(Invalid)")
2167
2168#define DRX_STR_AUD_SAP(x) ( \
2169 (x == true) ? "Present" : \
2170 (x == false) ? "Not present" : \
2171 "(Invalid)")
2172
2173#define DRX_STR_AUD_CARRIER(x) ( \
2174 (x == true) ? "Present" : \
2175 (x == false) ? "Not present" : \
2176 "(Invalid)")
2177
2178#define DRX_STR_AUD_RDS(x) ( \
2179 (x == true) ? "Available" : \
2180 (x == false) ? "Not Available" : \
2181 "(Invalid)")
2182
2183#define DRX_STR_AUD_NICAM_STATUS(x) ( \
2184 (x == DRX_AUD_NICAM_DETECTED) ? "Detected" : \
2185 (x == DRX_AUD_NICAM_NOT_DETECTED) ? "Not detected" : \
2186 (x == DRX_AUD_NICAM_BAD) ? "Bad" : \
2187 "(Invalid)")
2188
2189#define DRX_STR_RDS_VALID(x) ( \
2190 (x == true) ? "Valid" : \
2191 (x == false) ? "Not Valid" : \
2192 "(Invalid)")
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209#define DRX_ATTR_MCRECORD(d) ((d)->my_common_attr->mcversion)
2210#define DRX_ATTR_MIRRORFREQSPECT(d) ((d)->my_common_attr->mirror_freq_spect)
2211#define DRX_ATTR_CURRENTPOWERMODE(d)((d)->my_common_attr->current_power_mode)
2212#define DRX_ATTR_ISOPENED(d) ((d)->my_common_attr->is_opened)
2213#define DRX_ATTR_USEBOOTLOADER(d) ((d)->my_common_attr->use_bootloader)
2214#define DRX_ATTR_CURRENTSTANDARD(d) ((d)->my_common_attr->current_standard)
2215#define DRX_ATTR_PREVSTANDARD(d) ((d)->my_common_attr->prev_standard)
2216#define DRX_ATTR_CACHESTANDARD(d) ((d)->my_common_attr->di_cache_standard)
2217#define DRX_ATTR_CURRENTCHANNEL(d) ((d)->my_common_attr->current_channel)
2218#define DRX_ATTR_MICROCODE(d) ((d)->my_common_attr->microcode)
2219#define DRX_ATTR_VERIFYMICROCODE(d) ((d)->my_common_attr->verify_microcode)
2220#define DRX_ATTR_CAPABILITIES(d) ((d)->my_common_attr->capabilities)
2221#define DRX_ATTR_PRODUCTID(d) ((d)->my_common_attr->product_id)
2222#define DRX_ATTR_INTERMEDIATEFREQ(d) ((d)->my_common_attr->intermediate_freq)
2223#define DRX_ATTR_SYSCLOCKFREQ(d) ((d)->my_common_attr->sys_clock_freq)
2224#define DRX_ATTR_TUNERRFAGCPOL(d) ((d)->my_common_attr->tuner_rf_agc_pol)
2225#define DRX_ATTR_TUNERIFAGCPOL(d) ((d)->my_common_attr->tuner_if_agc_pol)
2226#define DRX_ATTR_TUNERSLOWMODE(d) ((d)->my_common_attr->tuner_slow_mode)
2227#define DRX_ATTR_TUNERSPORTNR(d) ((d)->my_common_attr->tuner_port_nr)
2228#define DRX_ATTR_I2CADDR(d) ((d)->my_i2c_dev_addr->i2c_addr)
2229#define DRX_ATTR_I2CDEVID(d) ((d)->my_i2c_dev_addr->i2c_dev_id)
2230#define DRX_ISMCVERTYPE(x) ((x) == AUX_VER_RECORD)
2231
2232
2233
2234
2235
2236#define DRX_ACCESSMACRO_SET(demod, value, cfg_name, data_type) \
2237 do { \
2238 struct drx_cfg config; \
2239 data_type cfg_data; \
2240 config.cfg_type = cfg_name; \
2241 config.cfg_data = &cfg_data; \
2242 cfg_data = value; \
2243 drx_ctrl(demod, DRX_CTRL_SET_CFG, &config); \
2244 } while (0)
2245
2246#define DRX_ACCESSMACRO_GET(demod, value, cfg_name, data_type, error_value) \
2247 do { \
2248 int cfg_status; \
2249 struct drx_cfg config; \
2250 data_type cfg_data; \
2251 config.cfg_type = cfg_name; \
2252 config.cfg_data = &cfg_data; \
2253 cfg_status = drx_ctrl(demod, DRX_CTRL_GET_CFG, &config); \
2254 if (cfg_status == 0) { \
2255 value = cfg_data; \
2256 } else { \
2257 value = (data_type)error_value; \
2258 } \
2259 } while (0)
2260
2261
2262
2263#ifndef DRX_XS_CFG_BASE
2264#define DRX_XS_CFG_BASE (500)
2265#endif
2266
2267#define DRX_XS_CFG_PRESET (DRX_XS_CFG_BASE + 0)
2268#define DRX_XS_CFG_AUD_BTSC_DETECT (DRX_XS_CFG_BASE + 1)
2269#define DRX_XS_CFG_QAM_LOCKRANGE (DRX_XS_CFG_BASE + 2)
2270
2271
2272
2273#define DRX_SET_PRESET(d, x) \
2274 DRX_ACCESSMACRO_SET((d), (x), DRX_XS_CFG_PRESET, char*)
2275#define DRX_GET_PRESET(d, x) \
2276 DRX_ACCESSMACRO_GET((d), (x), DRX_XS_CFG_PRESET, char*, "ERROR")
2277
2278#define DRX_SET_AUD_BTSC_DETECT(d, x) DRX_ACCESSMACRO_SET((d), (x), \
2279 DRX_XS_CFG_AUD_BTSC_DETECT, enum drx_aud_btsc_detect)
2280#define DRX_GET_AUD_BTSC_DETECT(d, x) DRX_ACCESSMACRO_GET((d), (x), \
2281 DRX_XS_CFG_AUD_BTSC_DETECT, enum drx_aud_btsc_detect, DRX_UNKNOWN)
2282
2283#define DRX_SET_QAM_LOCKRANGE(d, x) DRX_ACCESSMACRO_SET((d), (x), \
2284 DRX_XS_CFG_QAM_LOCKRANGE, enum drx_qam_lock_range)
2285#define DRX_GET_QAM_LOCKRANGE(d, x) DRX_ACCESSMACRO_GET((d), (x), \
2286 DRX_XS_CFG_QAM_LOCKRANGE, enum drx_qam_lock_range, DRX_UNKNOWN)
2287
2288
2289
2290
2291
2292
2293#define DRX_ISATVSTD(std) (((std) == DRX_STANDARD_PAL_SECAM_BG) || \
2294 ((std) == DRX_STANDARD_PAL_SECAM_DK) || \
2295 ((std) == DRX_STANDARD_PAL_SECAM_I) || \
2296 ((std) == DRX_STANDARD_PAL_SECAM_L) || \
2297 ((std) == DRX_STANDARD_PAL_SECAM_LP) || \
2298 ((std) == DRX_STANDARD_NTSC) || \
2299 ((std) == DRX_STANDARD_FM))
2300
2301
2302
2303
2304
2305
2306#define DRX_ISQAMSTD(std) (((std) == DRX_STANDARD_ITU_A) || \
2307 ((std) == DRX_STANDARD_ITU_B) || \
2308 ((std) == DRX_STANDARD_ITU_C) || \
2309 ((std) == DRX_STANDARD_ITU_D))
2310
2311
2312
2313
2314
2315
2316#define DRX_ISVSBSTD(std) ((std) == DRX_STANDARD_8VSB)
2317
2318
2319
2320
2321
2322
2323#define DRX_ISDVBTSTD(std) ((std) == DRX_STANDARD_DVBT)
2324
2325
2326
2327
2328#endif
2329