~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/media/video/saa7164/saa7164-types.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  Driver for the NXP SAA7164 PCIe bridge
3
3
 *
4
 
 *  Copyright (c) 2009 Steven Toth <stoth@kernellabs.com>
 
4
 *  Copyright (c) 2010 Steven Toth <stoth@kernellabs.com>
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
24
24
/* Some structues are passed directly to/from the firmware and
25
25
 * have strict alignment requirements. This is one of them.
26
26
 */
27
 
typedef struct {
 
27
struct tmComResHWDescr {
28
28
        u8      bLength;
29
29
        u8      bDescriptorType;
30
30
        u8      bDescriptorSubtype;
37
37
        u32     dwHostMemoryRegionSize;
38
38
        u32     dwHostHibernatMemRegion;
39
39
        u32     dwHostHibernatMemRegionSize;
40
 
} __attribute__((packed)) tmComResHWDescr_t;
 
40
} __attribute__((packed));
41
41
 
42
42
/* This is DWORD aligned on windows but I can't find the right
43
43
 * gcc syntax to match the binary data from the device.
44
44
 * I've manually padded with Reserved[3] bytes to match the hardware,
45
45
 * but this could break if GCC decies to pack in a different way.
46
46
 */
47
 
typedef struct {
 
47
struct tmComResInterfaceDescr {
48
48
        u8      bLength;
49
49
        u8      bDescriptorType;
50
50
        u8      bDescriptorSubtype;
56
56
        u8      bDebugInterruptId;
57
57
        u8      BARLocation;
58
58
        u8      Reserved[3];
59
 
} tmComResInterfaceDescr_t;
 
59
};
60
60
 
61
 
typedef struct {
 
61
struct tmComResBusDescr {
62
62
        u64     CommandRing;
63
63
        u64     ResponseRing;
64
64
        u32     CommandWrite;
65
65
        u32     CommandRead;
66
66
        u32     ResponseWrite;
67
67
        u32     ResponseRead;
68
 
} tmComResBusDescr_t;
 
68
};
69
69
 
70
 
typedef enum {
 
70
enum tmBusType {
71
71
        NONE            = 0,
72
72
        TYPE_BUS_PCI    = 1,
73
73
        TYPE_BUS_PCIe   = 2,
74
74
        TYPE_BUS_USB    = 3,
75
75
        TYPE_BUS_I2C    = 4
76
 
} tmBusType_t;
 
76
};
77
77
 
78
 
typedef struct {
79
 
        tmBusType_t Type;
 
78
struct tmComResBusInfo {
 
79
        enum tmBusType Type;
80
80
        u16     m_wMaxReqSize;
81
81
        u8      *m_pdwSetRing;
82
82
        u32     m_dwSizeSetRing;
83
83
        u8      *m_pdwGetRing;
84
84
        u32     m_dwSizeGetRing;
85
 
        u32     *m_pdwSetWritePos;
86
 
        u32     *m_pdwSetReadPos;
87
 
        u32     *m_pdwGetWritePos;
88
 
        u32     *m_pdwGetReadPos;
 
85
        u32     m_dwSetWritePos;
 
86
        u32     m_dwSetReadPos;
 
87
        u32     m_dwGetWritePos;
 
88
        u32     m_dwGetReadPos;
89
89
 
90
90
        /* All access is protected */
91
91
        struct mutex lock;
92
92
 
93
 
} tmComResBusInfo_t;
 
93
};
94
94
 
95
 
typedef struct {
 
95
struct tmComResInfo {
96
96
        u8      id;
97
97
        u8      flags;
98
98
        u16     size;
99
99
        u32     command;
100
100
        u16     controlselector;
101
101
        u8      seqno;
102
 
} __attribute__((packed)) tmComResInfo_t;
 
102
} __attribute__((packed));
103
103
 
104
 
typedef enum {
 
104
enum tmComResCmd {
105
105
        SET_CUR  = 0x01,
106
106
        GET_CUR  = 0x81,
107
107
        GET_MIN  = 0x82,
110
110
        GET_LEN  = 0x85,
111
111
        GET_INFO = 0x86,
112
112
        GET_DEF  = 0x87
113
 
} tmComResCmd_t;
 
113
};
114
114
 
115
115
struct cmd {
116
116
        u8 seqno;
121
121
        wait_queue_head_t wait;
122
122
};
123
123
 
124
 
typedef struct {
 
124
struct tmDescriptor {
125
125
        u32     pathid;
126
126
        u32     size;
127
127
        void    *descriptor;
128
 
} tmDescriptor_t;
 
128
};
129
129
 
130
 
typedef struct {
 
130
struct tmComResDescrHeader {
131
131
        u8      len;
132
132
        u8      type;
133
133
        u8      subtype;
134
134
        u8      unitid;
135
 
} __attribute__((packed)) tmComResDescrHeader_t;
 
135
} __attribute__((packed));
136
136
 
137
 
typedef struct {
 
137
struct tmComResExtDevDescrHeader {
138
138
        u8      len;
139
139
        u8      type;
140
140
        u8      subtype;
144
144
        u32     numgpiopins;
145
145
        u8      numgpiogroups;
146
146
        u8      controlsize;
147
 
} __attribute__((packed)) tmComResExtDevDescrHeader_t;
 
147
} __attribute__((packed));
148
148
 
149
 
typedef struct {
 
149
struct tmComResGPIO {
150
150
        u32     pin;
151
151
        u8      state;
152
 
} __attribute__((packed)) tmComResGPIO_t;
 
152
} __attribute__((packed));
153
153
 
154
 
typedef struct {
 
154
struct tmComResPathDescrHeader {
155
155
        u8      len;
156
156
        u8      type;
157
157
        u8      subtype;
158
158
        u8      pathid;
159
 
} __attribute__((packed)) tmComResPathDescrHeader_t;
 
159
} __attribute__((packed));
160
160
 
161
161
/* terminaltype */
162
 
typedef enum {
 
162
enum tmComResTermType {
163
163
        ITT_ANTENNA              = 0x0203,
164
164
        LINE_CONNECTOR           = 0x0603,
165
165
        SPDIF_CONNECTOR          = 0x0605,
167
167
        SVIDEO_CONNECTOR         = 0x0402,
168
168
        COMPONENT_CONNECTOR      = 0x0403,
169
169
        STANDARD_DMA             = 0xF101
170
 
} tmComResTermType_t;
 
170
};
171
171
 
172
 
typedef struct {
 
172
struct tmComResAntTermDescrHeader {
173
173
        u8      len;
174
174
        u8      type;
175
175
        u8      subtype;
178
178
        u8      assocterminal;
179
179
        u8      iterminal;
180
180
        u8      controlsize;
181
 
} __attribute__((packed)) tmComResAntTermDescrHeader_t;
 
181
} __attribute__((packed));
182
182
 
183
 
typedef struct {
 
183
struct tmComResTunerDescrHeader {
184
184
        u8      len;
185
185
        u8      type;
186
186
        u8      subtype;
190
190
        u32     tuningstandards;
191
191
        u8      controlsize;
192
192
        u32     controls;
193
 
} __attribute__((packed)) tmComResTunerDescrHeader_t;
 
193
} __attribute__((packed));
194
194
 
195
 
typedef enum {
 
195
enum tmBufferFlag {
196
196
        /* the buffer does not contain any valid data */
197
197
        TM_BUFFER_FLAG_EMPTY,
198
198
 
201
201
 
202
202
        /* the buffer is the dummy buffer - TODO??? */
203
203
        TM_BUFFER_FLAG_DUMMY_BUFFER
204
 
} tmBufferFlag_t;
 
204
};
205
205
 
206
 
typedef struct {
 
206
struct tmBuffer {
207
207
        u64             *pagetablevirt;
208
208
        u64             pagetablephys;
209
209
        u16             offset;
210
210
        u8              *context;
211
211
        u64             timestamp;
212
 
        tmBufferFlag_t  BufferFlag_t;
 
212
        enum tmBufferFlag BufferFlag;
213
213
        u32             lostbuffers;
214
214
        u32             validbuffers;
215
215
        u64             *dummypagevirt;
216
216
        u64             dummypagephys;
217
217
        u64             *addressvirt;
218
 
} tmBuffer_t;
 
218
};
219
219
 
220
 
typedef struct {
 
220
struct tmHWStreamParameters {
221
221
        u32     bitspersample;
222
222
        u32     samplesperline;
223
223
        u32     numberoflines;
227
227
        u64     *pagetablelistphys;
228
228
        u32     numpagetables;
229
229
        u32     numpagetableentries;
230
 
} tmHWStreamParameters_t;
 
230
};
231
231
 
232
 
typedef struct {
233
 
        tmHWStreamParameters_t          HWStreamParameters_t;
 
232
struct tmStreamParameters {
 
233
        struct tmHWStreamParameters     HWStreamParameters;
234
234
        u64                             qwDummyPageTablePhys;
235
235
        u64                             *pDummyPageTableVirt;
236
 
} tmStreamParameters_t;
 
236
};
237
237
 
238
 
typedef struct {
 
238
struct tmComResDMATermDescrHeader {
239
239
        u8      len;
240
240
        u8      type;
241
241
        u8      subtyle;
251
251
        u8      metadatasize;
252
252
        u8      numformats;
253
253
        u8      controlsize;
254
 
} __attribute__((packed)) tmComResDMATermDescrHeader_t;
 
254
} __attribute__((packed));
255
255
 
256
256
/*
257
257
 *
274
274
 *                            Data is to be ignored by the application.
275
275
 *
276
276
 */
277
 
typedef struct {
 
277
struct tmComResTSFormatDescrHeader {
278
278
        u8      len;
279
279
        u8      type;
280
280
        u8      subtype;
283
283
        u8      bPacketLength;
284
284
        u8      bStrideLength;
285
285
        u8      guidStrideFormat[16];
286
 
} __attribute__((packed)) tmComResTSFormatDescrHeader_t;
287
 
 
 
286
} __attribute__((packed));
 
287
 
 
288
/* Encoder related structures */
 
289
 
 
290
/* A/V Mux Selector */
 
291
struct tmComResSelDescrHeader {
 
292
        u8      len;
 
293
        u8      type;
 
294
        u8      subtype;
 
295
        u8      unitid;
 
296
        u8      nrinpins;
 
297
        u8      sourceid;
 
298
} __attribute__((packed));
 
299
 
 
300
/* A/V Audio processor definitions */
 
301
struct tmComResProcDescrHeader {
 
302
        u8      len;
 
303
        u8      type;
 
304
        u8      subtype;
 
305
        u8      unitid;
 
306
        u8      sourceid;
 
307
        u16     wreserved;
 
308
        u8      controlsize;
 
309
} __attribute__((packed));
 
310
 
 
311
/* Video bitrate control message */
 
312
#define EU_VIDEO_BIT_RATE_MODE_CONSTANT         (0)
 
313
#define EU_VIDEO_BIT_RATE_MODE_VARIABLE_AVERAGE (1)
 
314
#define EU_VIDEO_BIT_RATE_MODE_VARIABLE_PEAK    (2)
 
315
struct tmComResEncVideoBitRate {
 
316
        u8      ucVideoBitRateMode;
 
317
        u32     dwVideoBitRate;
 
318
        u32     dwVideoBitRatePeak;
 
319
} __attribute__((packed));
 
320
 
 
321
/* Video Encoder Aspect Ratio message */
 
322
struct tmComResEncVideoInputAspectRatio {
 
323
        u8      width;
 
324
        u8      height;
 
325
} __attribute__((packed));
 
326
 
 
327
/* Video Encoder GOP IBP message */
 
328
/* 1. IPPPPPPPPPPPPPP */
 
329
/* 2. IBPBPBPBPBPBPBP */
 
330
/* 3. IBBPBBPBBPBBP   */
 
331
#define SAA7164_ENCODER_DEFAULT_GOP_DIST (1)
 
332
#define SAA7164_ENCODER_DEFAULT_GOP_SIZE (15)
 
333
struct tmComResEncVideoGopStructure {
 
334
        u8      ucGOPSize;      /* GOP Size 12, 15 */
 
335
        u8      ucRefFrameDist; /* Reference Frame Distance */
 
336
} __attribute__((packed));
 
337
 
 
338
/* Encoder processor definition */
 
339
struct tmComResEncoderDescrHeader {
 
340
        u8      len;
 
341
        u8      type;
 
342
        u8      subtype;
 
343
        u8      unitid;
 
344
        u8      vsourceid;
 
345
        u8      asourceid;
 
346
        u8      iunit;
 
347
        u32     dwmControlCap;
 
348
        u32     dwmProfileCap;
 
349
        u32     dwmVidFormatCap;
 
350
        u8      bmVidBitrateCap;
 
351
        u16     wmVidResolutionsCap;
 
352
        u16     wmVidFrmRateCap;
 
353
        u32     dwmAudFormatCap;
 
354
        u8      bmAudBitrateCap;
 
355
} __attribute__((packed));
 
356
 
 
357
/* Audio processor definition */
 
358
struct tmComResAFeatureDescrHeader {
 
359
        u8      len;
 
360
        u8      type;
 
361
        u8      subtype;
 
362
        u8      unitid;
 
363
        u8      sourceid;
 
364
        u8      controlsize;
 
365
} __attribute__((packed));
 
366
 
 
367
/* Audio control messages */
 
368
struct tmComResAudioDefaults {
 
369
        u8      ucDecoderLevel;
 
370
        u8      ucDecoderFM_Level;
 
371
        u8      ucMonoLevel;
 
372
        u8      ucNICAM_Level;
 
373
        u8      ucSAP_Level;
 
374
        u8      ucADC_Level;
 
375
} __attribute__((packed));
 
376
 
 
377
/* Audio bitrate control message */
 
378
struct tmComResEncAudioBitRate {
 
379
        u8      ucAudioBitRateMode;
 
380
        u32     dwAudioBitRate;
 
381
        u32     dwAudioBitRatePeak;
 
382
} __attribute__((packed));
 
383
 
 
384
/* Tuner / AV Decoder messages */
 
385
struct tmComResTunerStandard {
 
386
        u8      std;
 
387
        u32     country;
 
388
} __attribute__((packed));
 
389
 
 
390
struct tmComResTunerStandardAuto {
 
391
        u8      mode;
 
392
} __attribute__((packed));
 
393
 
 
394
/* EEPROM definition for PS stream types */
 
395
struct tmComResPSFormatDescrHeader {
 
396
        u8      len;
 
397
        u8      type;
 
398
        u8      subtype;
 
399
        u8      bFormatIndex;
 
400
        u16     wPacketLength;
 
401
        u16     wPackLength;
 
402
        u8      bPackDataType;
 
403
} __attribute__((packed));
 
404
 
 
405
/* VBI control structure */
 
406
struct tmComResVBIFormatDescrHeader {
 
407
        u8      len;
 
408
        u8      type;
 
409
        u8      subtype; /* VS_FORMAT_VBI */
 
410
        u8      bFormatIndex;
 
411
        u32     VideoStandard; /* See KS_AnalogVideoStandard, NTSC = 1 */
 
412
        u8      StartLine; /* NTSC Start = 10 */
 
413
        u8      EndLine; /* NTSC = 21 */
 
414
        u8      FieldRate; /* 60 for NTSC */
 
415
        u8      bNumLines; /* Unsed - scheduled for removal */
 
416
} __attribute__((packed));
 
417
 
 
418
struct tmComResProbeCommit {
 
419
        u16     bmHint;
 
420
        u8      bFormatIndex;
 
421
        u8      bFrameIndex;
 
422
} __attribute__((packed));
 
423
 
 
424
struct tmComResDebugSetLevel {
 
425
        u32     dwDebugLevel;
 
426
} __attribute__((packed));
 
427
 
 
428
struct tmComResDebugGetData {
 
429
        u32     dwResult;
 
430
        u8      ucDebugData[256];
 
431
} __attribute__((packed));
 
432
 
 
433
struct tmFwInfoStruct {
 
434
        u32     status;
 
435
        u32     mode;
 
436
        u32     devicespec;
 
437
        u32     deviceinst;
 
438
        u32     CPULoad;
 
439
        u32     RemainHeap;
 
440
        u32     CPUClock;
 
441
        u32     RAMSpeed;
 
442
} __attribute__((packed));