summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/hexium_gemini.h
blob: d7a9627d4c0c78f1d1937a6158fa1ddc944d63b1 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#ifndef __HEXIUM_GEMINI__
#define __HEXIUM_GEMINI__

#include "hexium.h"

static struct saa7146_extension_ioctls ioctls[] = {
	{ VIDIOC_G_INPUT,	SAA7146_EXCLUSIVE },
	{ VIDIOC_S_INPUT,	SAA7146_EXCLUSIVE },
	{ VIDIOC_QUERYCTRL, 	SAA7146_BEFORE },
	{ VIDIOC_ENUMINPUT, 	SAA7146_EXCLUSIVE },
	{ VIDIOC_S_STD,		SAA7146_AFTER },
	{ VIDIOC_G_CTRL,	SAA7146_BEFORE },
	{ VIDIOC_S_CTRL,	SAA7146_BEFORE },
	{ 0,			0 }
};

#define HEXIUM_CONTROLS	1
static struct v4l2_queryctrl hexium_controls[] = {
	{ V4L2_CID_PRIVATE_BASE, V4L2_CTRL_TYPE_BOOLEAN, "B/W", 0, 1, 1, 0, 0 },
};

#define HEXIUM_GEMUINI_V_1_0		1
#define HEXIUM_GEMUINI_DUAL_V_1_0	2

struct hexium
{
	int type;
	struct video_device	video_dev;
	struct i2c_adapter	i2c_adapter;
		
	int 		cur_input;	/* current input */
	v4l2_std_id 	cur_std;	/* current standard */
	int		cur_bw;		/* current black/white status */
};

/* Samsung KS0127B decoder default registers */
static u8 hexium_ks0127b[0x100]={
/*00*/ 0x00,0x52,0x30,0x40,0x01,0x0C,0x2A,0x10,
/*08*/ 0x00,0x00,0x00,0x60,0x00,0x00,0x0F,0x06,
/*10*/ 0x00,0x00,0xE4,0xC0,0x00,0x00,0x00,0x00,
/*18*/ 0x14,0x9B,0xFE,0xFF,0xFC,0xFF,0x03,0x22,
/*20*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*28*/ 0x00,0x00,0x00,0x00,0x00,0x2C,0x9B,0x00,
/*30*/ 0x00,0x00,0x10,0x80,0x80,0x10,0x80,0x80,
/*38*/ 0x01,0x04,0x00,0x00,0x00,0x29,0xC0,0x00,
/*40*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*48*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*50*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*58*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*60*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*68*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*70*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*78*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*80*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*88*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*90*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*98*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*A0*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*A8*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*B0*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*B8*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*C0*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*C8*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*D0*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*D8*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*E0*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*E8*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*F0*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
/*F8*/ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

static struct hexium_data hexium_pal[] = {
	{ 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF }
};

static struct hexium_data hexium_pal_bw[] = {
	{ 0x01, 0x52 },	{ 0x12, 0x64 },	{ 0x2D, 0x2C },	{ 0x2E, 0x9B },	{ -1 , 0xFF }
};

static struct hexium_data hexium_ntsc[] = {
	{ 0x01, 0x53 }, { 0x12, 0x04 }, { 0x2D, 0x23 }, { 0x2E, 0x81 }, { -1 , 0xFF }
};

static struct hexium_data hexium_ntsc_bw[] = {
	{ 0x01, 0x53 }, { 0x12, 0x04 }, { 0x2D, 0x23 }, { 0x2E, 0x81 }, { -1 , 0xFF }
};

static struct hexium_data hexium_secam[] = {
	{ 0x01, 0x52 }, { 0x12, 0x64 }, { 0x2D, 0x2C }, { 0x2E, 0x9B }, { -1 , 0xFF }
};

static struct hexium_data hexium_input_select[] = {
	{ 0x02, 0x60 },
	{ 0x02, 0x64 },
	{ 0x02, 0x61 },
	{ 0x02, 0x65 },
	{ 0x02, 0x62 },
	{ 0x02, 0x66 },
	{ 0x02, 0x68 },
	{ 0x02, 0x69 },
	{ 0x02, 0x6A },
};

#ifdef axa

#define KS0127BINPUT_NONE SAA7110INPUT_NONE // input channel not specified
#define KS0127BINPUT_AY0 1 // 0127B input channel Y0 definition
#define KS0127BINPUT_AY1 2 // 0127B input channel Y1 definition
#define KS0127BINPUT_AY2 3 // 0127B input channel Y2 definition
#define KS0127BINPUT_AC0 4 // 0127B input channel C0 definition
#define KS0127BINPUT_AC1 5 // 0127B input channel C1 definition
#define KS0127BINPUT_AC2 6 // 0127B input channel C2 definition
static const INPUTMODE inputmode0127b[MODENUM]={
{KS0127BINPUT_AY0,KS0127BINPUT_NONE}, // 0 CVBS1
{KS0127BINPUT_AC0,KS0127BINPUT_NONE}, // 1 CVBS2
{KS0127BINPUT_AY1,KS0127BINPUT_NONE}, // 2 CVBS3
{KS0127BINPUT_AC1,KS0127BINPUT_NONE}, // 3 CVBS4
{KS0127BINPUT_AY2,KS0127BINPUT_NONE}, // 4 CVBS5
{KS0127BINPUT_AC2,KS0127BINPUT_NONE}, // 5 CVBS6
{KS0127BINPUT_AY0,KS0127BINPUT_AC0}, // 6 CVBS1
{KS0127BINPUT_AY1,KS0127BINPUT_AC1}, // 7 CVBS2
{KS0127BINPUT_AY2,KS0127BINPUT_AC2}, // 8 CVBS3
};

// -------------------------------------------------------------------------
// AGC handling functions
// -------------------------------------------------------------------------
BYTE SAA7146::ValidateReg0127(int regnum,BYTE Value)
{
switch(regnum) {
case 0x02:
if (fAGC==false) Value|=0x10; // AGCFRZ AGCOFF
break;
case 0x12:
if (fAGC==false) Value|=0x00; // ACCFRZ AGCOFF
break;
case 0x15:
if (fAGC==false) Value|=0x80; // SATBIT AGCOFF
break;
case 0x29:
if (fAGC==false) Value|=0x40; // TSTCGN AGCOFF
break;
}
return(Value);
}

#define SAA7110INPUT_NONE 0 /* input channel not specified */
#define SAA7110INPUT_AI21 1 /* 7110 input channel AI21 definition */
#define SAA7110INPUT_AI22 2 /* 7110 input channel AI22 definition */
#define SAA7110INPUT_AI31 3 /* 7110 input channel AI31 definition */
#define SAA7110INPUT_AI32 4 /* 7110 input channel AI32 definition */
#define SAA7110INPUT_AI41 5 /* 7110 input channel AI41 definition */
#define SAA7110INPUT_AI42 6 /* 7110 input channel AI42 definition */

static inputmode7110[MODENUM]={
	{SAA7110INPUT_AI21,SAA7110INPUT_NONE}, // 0 CVBS1
	{SAA7110INPUT_AI22,SAA7110INPUT_NONE}, // 1 CVBS2
	{SAA7110INPUT_AI31,SAA7110INPUT_NONE}, // 2 CVBS3
	{SAA7110INPUT_AI32,SAA7110INPUT_NONE}, // 3 CVBS4
	{SAA7110INPUT_AI41,SAA7110INPUT_NONE}, // 4 CVBS5
	{SAA7110INPUT_AI42,SAA7110INPUT_NONE}, // 5 CVBS6
	{SAA7110INPUT_AI21,SAA7110INPUT_AI42}, // 6 Y1,C1
	{SAA7110INPUT_AI31,SAA7110INPUT_AI22}, // 7 Y2,C2
	{SAA7110INPUT_AI41,SAA7110INPUT_AI32}  // 8 Y3,C3

};
// -------------------------------------------------------------------------
// Camera select tables (based on SAA7110.pdf input modes)
// -------------------------------------------------------------------------
typedef struct REGISTER {
//public:
int address;
BYTE value;
} _REGISTER;
static const REGISTER camtable7110_0[]={ // Mode 0
{ 0x06, 0x00 },
{ 0x20, 0xD9 },
{ 0x21, 0x17 },//0x16,
{ 0x22, 0x40 },
{ 0x2C, 0x03 },
{ 0x30, 0x44 },
{ 0x31, 0x75 }, //??
{ 0x21, 0x16 }, //0x03,
{ -1 , 0xFF }
};
static const REGISTER camtable7110_1[]={ // Mode 1
{ 0x06, 0x00 },
{ 0x20, 0xD8 },
{ 0x21, 0x17 },//0x16,
{ 0x22, 0x40 },
{ 0x2C, 0x03 },
{ 0x30, 0x44 },
{ 0x31, 0x75 }, //??
{ 0x21, 0x16 },//0x03,
{ -1 , 0xFF }
};
static const REGISTER camtable7110_2[]={ // Mode 2
{ 0x06, 0x00 },
{ 0x20, 0xBA },
{ 0x21, 0x07 },//0x05,
{ 0x22, 0x91 },
{ 0x2C, 0x03 },
{ 0x30, 0x60 },
{ 0x31, 0xB5 }, //??
{ 0x21, 0x05 },//0x03,
{ -1 , 0xFF }
};
static const REGISTER camtable7110_3[]={ // Mode 3
{ 0x06, 0x00 },
{ 0x20, 0xB8 },
{ 0x21, 0x07 },//0x05,
{ 0x22, 0x91 },
{ 0x2C, 0x03 },
{ 0x30, 0x60 },
{ 0x31, 0xB5 }, //??
{ 0x21, 0x05 },//0x03,
{ -1 , 0xFF }
};
static const REGISTER camtable7110_4[]={ // Mode 4
{ 0x06, 0x00 },
{ 0x20, 0x7C },
{ 0x21, 0x07 }, // 0x03
{ 0x22, 0xD2 },
{ 0x2C, 0x83 },
{ 0x30, 0x60 },
{ 0x31, 0xB5 }, //?
{ 0x21, 0x03 },
{ -1 , 0xFF }
};
static const REGISTER camtable7110_5[]={ // Mode 5
{ 0x06, 0x00 },
{ 0x20, 0x78 },
{ 0x21, 0x07 },//0x03,
{ 0x22, 0xD2 },
{ 0x2C, 0x83 },
{ 0x30, 0x60 },
{ 0x31, 0xB5 }, //?
{ 0x21, 0x03 },
{ -1 , 0xFF }
};
static const REGISTER camtable7110_6[]={ // Mode 6
{ 0x06, 0x80 },
{ 0x20, 0x59 },
{ 0x21, 0x17 },
{ 0x22, 0x42 },
{ 0x2C, 0xA3 },
{ 0x30, 0x44 },
{ 0x31, 0x75 },
{ 0x21, 0x12 },
{ -1 , 0xFF }
};
static const REGISTER camtable7110_7[]={ // Mode 7
{ 0x06, 0x80 },
{ 0x20, 0x9A },
{ 0x21, 0x17 },
{ 0x22, 0xB1 },
{ 0x2C, 0x13 },
{ 0x30, 0x60 },
{ 0x31, 0xB5 },
{ 0x21, 0x14 },
{ -1 , 0xFF }
};
static const REGISTER camtable7110_8[]={ // Mode 8
{ 0x06, 0x80 },
{ 0x20, 0x3C },
{ 0x21, 0x27 },
{ 0x22, 0xC1 },
{ 0x2C, 0x23 },
{ 0x30, 0x44 },
{ 0x31, 0x75 },
{ 0x21, 0x21 },
{ -1 , 0xFF }
};
// Camera mode tables xref
static const REGISTER *camselect7110[MODENUM]={
camtable7110_0,
camtable7110_1,
camtable7110_2,
camtable7110_3,
camtable7110_4,
camtable7110_5,
camtable7110_6,
camtable7110_7,
camtable7110_8
};
// Camera signal select tables (based on SAA7110 pdf)
// -------------------------------------------------------------------------
static const REGISTER sigtable7110_bw60[]={ // B/W NTSC
{ 0x06, 0x80 },
{ 0x2E, 0x81 },
{ -1 , 0xFF }
};
static const REGISTER sigtable7110_bw50[]={ // B/W PAL
{ 0x06, 0x80 },
{ 0x2E, 0x9A },
{ -1 , 0xFF }
};
static const REGISTER sigtable7110_ntsc[]={ // Color NTSC
{ 0x0D, 0x86 },
{ 0x11, 0x2C },
{ 0x2E, 0x81 },
{ -1 , 0xFF }
};
static const REGISTER sigtable7110_pal[]={ // PAL
{ 0x0D, 0x86 },
{ 0x11, 0x59 },
{ 0x2E, 0x9A },
{ -1 , 0xFF }
};
static const REGISTER sigtable7110_secam[]={ // SECAM
{ 0x0D, 0x87 },
{ 0x11, 0x59 },
{ 0x2E, 0x9A },
{ -1 , 0xFF }
};
// -------------------------------------------------------------------------
// AGC handling functions
// -------------------------------------------------------------------------
BYTE SAA7146::ValidateReg7110(int regnum,BYTE Value)
{
switch(regnum) {
case 0x22:
if (fAGC==false) Value&=0x3F; // AGC OFF
break;
}
return(Value);
}

#endif
#endif