1 /*
2    cx231xx-pcb-cfg.h - driver for Conexant
3 		Cx23100/101/102 USB video capture devices
4 
5    Copyright (C) 2008 <srinivasa.deevi at conexant dot 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 #ifndef _PCB_CONFIG_H_
23 #define _PCB_CONFIG_H_
24 
25 #include <linux/init.h>
26 #include <linux/module.h>
27 
28 /***************************************************************************
29 				* Class Information *
30 ***************************************************************************/
31 #define CLASS_DEFAULT       0xFF
32 
33 enum VENDOR_REQUEST_TYPE {
34 	/* Set/Get I2C */
35 	VRT_SET_I2C0 = 0x0,
36 	VRT_SET_I2C1 = 0x1,
37 	VRT_SET_I2C2 = 0x2,
38 	VRT_GET_I2C0 = 0x4,
39 	VRT_GET_I2C1 = 0x5,
40 	VRT_GET_I2C2 = 0x6,
41 
42 	/* Set/Get GPIO */
43 	VRT_SET_GPIO = 0x8,
44 	VRT_GET_GPIO = 0x9,
45 
46 	/* Set/Get GPIE */
47 	VRT_SET_GPIE = 0xA,
48 	VRT_GET_GPIE = 0xB,
49 
50 	/* Set/Get Register Control/Status */
51 	VRT_SET_REGISTER = 0xC,
52 	VRT_GET_REGISTER = 0xD,
53 
54 	/* Get Extended Compat ID Descriptor */
55 	VRT_GET_EXTCID_DESC = 0xFF,
56 };
57 
58 enum BYTE_ENABLE_MASK {
59 	ENABLE_ONE_BYTE = 0x1,
60 	ENABLE_TWE_BYTE = 0x3,
61 	ENABLE_THREE_BYTE = 0x7,
62 	ENABLE_FOUR_BYTE = 0xF,
63 };
64 
65 #define SPEED_MASK      0x1
66 enum USB_SPEED{
67 	FULL_SPEED = 0x0,	/* 0: full speed */
68 	HIGH_SPEED = 0x1	/* 1: high speed */
69 };
70 
71 #define TS_MASK         0x6
72 enum TS_PORT{
73 	NO_TS_PORT = 0x0,	/* 2'b00: Neither port used. PCB not a Hybrid,
74 				   only offers Analog TV or Video */
75 	TS1_PORT = 0x4,		/* 2'b10: TS1 Input (Hybrid mode :
76 				Digital or External Analog/Compressed source) */
77 	TS1_TS2_PORT = 0x6,	/* 2'b11: TS1 & TS2 Inputs
78 				(Dual inputs from Digital and/or
79 				External Analog/Compressed sources) */
80 	TS1_EXT_CLOCK = 0x6,	/* 2'b11: TS1 & TS2 as selector
81 						to external clock */
82 	TS1VIP_TS2_PORT = 0x2	/* 2'b01: TS1 used as 656/VIP Output,
83 				   TS2 Input (from Compressor) */
84 };
85 
86 #define EAVP_MASK       0x8
87 enum EAV_PRESENT{
88 	NO_EXTERNAL_AV = 0x0,	/* 0: No External A/V inputs
89 						(no need for i2s blcok),
90 						Analog Tuner must be present */
91 	EXTERNAL_AV = 0x8	/* 1: External A/V inputs
92 						present (requires i2s blk) */
93 };
94 
95 #define ATM_MASK        0x30
96 enum AT_MODE{
97 	DIF_TUNER = 0x30,	/* 2'b11: IF Tuner (requires use of DIF) */
98 	BASEBAND_SOUND = 0x20,	/* 2'b10: Baseband Composite &
99 						Sound-IF Signals present */
100 	NO_TUNER = 0x10		/* 2'b0x: No Analog Tuner present */
101 };
102 
103 #define PWR_SEL_MASK    0x40
104 enum POWE_TYPE{
105 	SELF_POWER = 0x0,	/* 0: self power */
106 	BUS_POWER = 0x40	/* 1: bus power */
107 };
108 
109 enum USB_POWE_TYPE{
110 	USB_SELF_POWER = 0,
111 	USB_BUS_POWER
112 };
113 
114 #define BO_0_MASK       0x80
115 enum AVDEC_STATUS{
116 	AVDEC_DISABLE = 0x0,	/* 0: A/V Decoder Disabled */
117 	AVDEC_ENABLE = 0x80	/* 1: A/V Decoder Enabled */
118 };
119 
120 #define BO_1_MASK       0x100
121 
122 #define BUSPOWER_MASK   0xC4	/* for Polaris spec 0.8 */
123 #define SELFPOWER_MASK  0x86
124 
125 /***************************************************************************/
126 #define NOT_DECIDE_YET  0xFE
127 #define NOT_SUPPORTED   0xFF
128 
129 /***************************************************************************
130 				* for mod field use *
131 ***************************************************************************/
132 #define MOD_DIGITAL     0x1
133 #define MOD_ANALOG      0x2
134 #define MOD_DIF         0x4
135 #define MOD_EXTERNAL    0x8
136 #define CAP_ALL_MOD     0x0f
137 
138 /***************************************************************************
139 				* source define *
140 ***************************************************************************/
141 #define SOURCE_DIGITAL          0x1
142 #define SOURCE_ANALOG           0x2
143 #define SOURCE_DIF              0x4
144 #define SOURCE_EXTERNAL         0x8
145 #define SOURCE_TS_BDA			0x10
146 #define SOURCE_TS_ENCODE		0x20
147 #define SOURCE_TS_EXTERNAL	0x40
148 
149 /***************************************************************************
150 				* interface information define *
151 ***************************************************************************/
152 struct INTERFACE_INFO {
153 	u8 interrupt_index;
154 	u8 ts1_index;
155 	u8 ts2_index;
156 	u8 audio_index;
157 	u8 video_index;
158 	u8 vanc_index;		/* VBI */
159 	u8 hanc_index;		/* Sliced CC */
160 	u8 ir_index;
161 };
162 
163 enum INDEX_INTERFACE_INFO{
164 	INDEX_INTERRUPT = 0x0,
165 	INDEX_TS1,
166 	INDEX_TS2,
167 	INDEX_AUDIO,
168 	INDEX_VIDEO,
169 	INDEX_VANC,
170 	INDEX_HANC,
171 	INDEX_IR,
172 };
173 
174 /***************************************************************************
175 				* configuration information define *
176 ***************************************************************************/
177 struct CONFIG_INFO {
178 	u8 config_index;
179 	struct INTERFACE_INFO interface_info;
180 };
181 
182 struct pcb_config {
183 	u8 index;
184 	u8 type;		/* bus power or self power,
185 					   self power--0, bus_power--1 */
186 	u8 speed;		/* usb speed, 2.0--1, 1.1--0 */
187 	u8 mode;		/* digital , anlog, dif or external A/V */
188 	u32 ts1_source;		/* three source -- BDA,External,encode */
189 	u32 ts2_source;
190 	u32 analog_source;
191 	u8 digital_index;	/* bus-power used */
192 	u8 analog_index;	/* bus-power used */
193 	u8 dif_index;		/* bus-power used */
194 	u8 external_index;	/* bus-power used */
195 	u8 config_num;		/* current config num, 0,1,2,
196 						   for self-power, always 0 */
197 	struct CONFIG_INFO hs_config_info[3];
198 	struct CONFIG_INFO fs_config_info[3];
199 };
200 
201 enum INDEX_PCB_CONFIG{
202 	INDEX_SELFPOWER_DIGITAL_ONLY = 0x0,
203 	INDEX_SELFPOWER_DUAL_DIGITAL,
204 	INDEX_SELFPOWER_ANALOG_ONLY,
205 	INDEX_SELFPOWER_DUAL,
206 	INDEX_SELFPOWER_TRIPLE,
207 	INDEX_SELFPOWER_COMPRESSOR,
208 	INDEX_BUSPOWER_DIGITAL_ONLY,
209 	INDEX_BUSPOWER_ANALOG_ONLY,
210 	INDEX_BUSPOWER_DIF_ONLY,
211 	INDEX_BUSPOWER_EXTERNAL_ONLY,
212 	INDEX_BUSPOWER_EXTERNAL_ANALOG,
213 	INDEX_BUSPOWER_EXTERNAL_DIF,
214 	INDEX_BUSPOWER_EXTERNAL_DIGITAL,
215 	INDEX_BUSPOWER_DIGITAL_ANALOG,
216 	INDEX_BUSPOWER_DIGITAL_DIF,
217 	INDEX_BUSPOWER_DIGITAL_ANALOG_EXTERNAL,
218 	INDEX_BUSPOWER_DIGITAL_DIF_EXTERNAL,
219 };
220 
221 /***************************************************************************/
222 struct cx231xx;
223 
224 int initialize_cx231xx(struct cx231xx *p_dev);
225 
226 #endif
227