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