1 /*
2  * SPDX-License-Identifier: GPL-2.0
3  * tuner-xc2028_types
4  *
5  * This file includes internal tipes to be used inside tuner-xc2028.
6  * Shouldn't be included outside tuner-xc2028
7  *
8  * Copyright (c) 2007-2008 Mauro Carvalho Chehab <mchehab@kernel.org>
9  */
10 
11 /* xc3028 firmware types */
12 
13 /* BASE firmware should be loaded before any other firmware */
14 #define BASE		(1<<0)
15 #define BASE_TYPES	(BASE|F8MHZ|MTS|FM|INPUT1|INPUT2|INIT1)
16 
17 /* F8MHZ marks BASE firmwares for 8 MHz Bandwidth */
18 #define F8MHZ		(1<<1)
19 
20 /* Multichannel Television Sound (MTS)
21    Those firmwares are capable of using xc2038 DSP to decode audio and
22    produce a baseband audio output on some pins of the chip.
23    There are MTS firmwares for the most used video standards. It should be
24    required to use MTS firmwares, depending on the way audio is routed into
25    the bridge chip
26  */
27 #define MTS		(1<<2)
28 
29 /* FIXME: I have no idea what's the difference between
30    D2620 and D2633 firmwares
31  */
32 #define D2620		(1<<3)
33 #define D2633		(1<<4)
34 
35 /* DTV firmwares for 6, 7 and 8 MHz
36    DTV6 - 6MHz - ATSC/DVB-C/DVB-T/ISDB-T/DOCSIS
37    DTV8 - 8MHz - DVB-C/DVB-T
38  */
39 #define DTV6           (1 << 5)
40 #define QAM            (1 << 6)
41 #define DTV7		(1<<7)
42 #define DTV78		(1<<8)
43 #define DTV8		(1<<9)
44 
45 #define DTV_TYPES	(D2620|D2633|DTV6|QAM|DTV7|DTV78|DTV8|ATSC)
46 
47 /* There's a FM | BASE firmware + FM specific firmware (std=0) */
48 #define	FM		(1<<10)
49 
50 #define STD_SPECIFIC_TYPES (MTS|FM|LCD|NOGD)
51 
52 /* Applies only for FM firmware
53    Makes it use RF input 1 (pin #2) instead of input 2 (pin #4)
54  */
55 #define INPUT1		(1<<11)
56 
57 
58 /* LCD firmwares exist only for MTS STD/MN (PAL or NTSC/M)
59 	and for non-MTS STD/MN (PAL, NTSC/M or NTSC/Kr)
60 	There are variants both with and without NOGD
61 	Those firmwares produce better result with LCD displays
62  */
63 #define LCD		(1<<12)
64 
65 /* NOGD firmwares exist only for MTS STD/MN (PAL or NTSC/M)
66 	and for non-MTS STD/MN (PAL, NTSC/M or NTSC/Kr)
67 	The NOGD firmwares don't have group delay compensation filter
68  */
69 #define NOGD		(1<<13)
70 
71 /* Old firmwares were broken into init0 and init1 */
72 #define INIT1		(1<<14)
73 
74 /* SCODE firmware selects particular behaviours */
75 #define MONO           (1 << 15)
76 #define ATSC           (1 << 16)
77 #define IF             (1 << 17)
78 #define LG60           (1 << 18)
79 #define ATI638         (1 << 19)
80 #define OREN538        (1 << 20)
81 #define OREN36         (1 << 21)
82 #define TOYOTA388      (1 << 22)
83 #define TOYOTA794      (1 << 23)
84 #define DIBCOM52       (1 << 24)
85 #define ZARLINK456     (1 << 25)
86 #define CHINA          (1 << 26)
87 #define F6MHZ          (1 << 27)
88 #define INPUT2         (1 << 28)
89 #define SCODE          (1 << 29)
90 
91 /* This flag identifies that the scode table has a new format */
92 #define HAS_IF         (1 << 30)
93 
94 /* There are different scode tables for MTS and non-MTS.
95    The MTS firmwares support mono only
96   */
97 #define SCODE_TYPES (SCODE | MTS)
98 
99 
100 /* Newer types not defined on videodev2.h.
101    The original idea were to move all those types to videodev2.h, but
102    it seemed overkill, since, with the exception of SECAM/K3, the other
103    types seem to be autodetected.
104    It is not clear where secam/k3 is used, nor we have a feedback of this
105    working or being autodetected by the standard secam firmware.
106  */
107 
108 #define V4L2_STD_SECAM_K3	(0x04000000)
109 
110 /* Audio types */
111 
112 #define V4L2_STD_A2_A		(1LL<<32)
113 #define V4L2_STD_A2_B		(1LL<<33)
114 #define V4L2_STD_NICAM_A	(1LL<<34)
115 #define V4L2_STD_NICAM_B	(1LL<<35)
116 #define V4L2_STD_AM		(1LL<<36)
117 #define V4L2_STD_BTSC		(1LL<<37)
118 #define V4L2_STD_EIAJ		(1LL<<38)
119 
120 #define V4L2_STD_A2		(V4L2_STD_A2_A    | V4L2_STD_A2_B)
121 #define V4L2_STD_NICAM		(V4L2_STD_NICAM_A | V4L2_STD_NICAM_B)
122 
123 /* To preserve backward compatibility,
124    (std & V4L2_STD_AUDIO) = 0 means that ALL audio stds are supported
125  */
126 
127 #define V4L2_STD_AUDIO		(V4L2_STD_A2    | \
128 				 V4L2_STD_NICAM | \
129 				 V4L2_STD_AM    | \
130 				 V4L2_STD_BTSC  | \
131 				 V4L2_STD_EIAJ)
132 
133 /* Used standards with audio restrictions */
134 
135 #define V4L2_STD_PAL_BG_A2_A	(V4L2_STD_PAL_BG | V4L2_STD_A2_A)
136 #define V4L2_STD_PAL_BG_A2_B	(V4L2_STD_PAL_BG | V4L2_STD_A2_B)
137 #define V4L2_STD_PAL_BG_NICAM_A	(V4L2_STD_PAL_BG | V4L2_STD_NICAM_A)
138 #define V4L2_STD_PAL_BG_NICAM_B	(V4L2_STD_PAL_BG | V4L2_STD_NICAM_B)
139 #define V4L2_STD_PAL_DK_A2	(V4L2_STD_PAL_DK | V4L2_STD_A2)
140 #define V4L2_STD_PAL_DK_NICAM	(V4L2_STD_PAL_DK | V4L2_STD_NICAM)
141 #define V4L2_STD_SECAM_L_NICAM	(V4L2_STD_SECAM_L | V4L2_STD_NICAM)
142 #define V4L2_STD_SECAM_L_AM	(V4L2_STD_SECAM_L | V4L2_STD_AM)
143