2 * Driver for the NXP SAA7164 PCIe bridge
4 * Copyright (c) 2010 Steven Toth <stoth@kernellabs.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
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.
22 /* TODO: Cleanup and shorten the namespace */
24 /* Some structues are passed directly to/from the firmware and
25 * have strict alignment requirements. This is one of them.
27 struct tmComResHWDescr
{
30 u8 bDescriptorSubtype
;
35 u32 dwDeviceRegistersLocation
;
36 u32 dwHostMemoryRegion
;
37 u32 dwHostMemoryRegionSize
;
38 u32 dwHostHibernatMemRegion
;
39 u32 dwHostHibernatMemRegionSize
;
40 } __attribute__((packed
));
42 /* This is DWORD aligned on windows but I can't find the right
43 * gcc syntax to match the binary data from the device.
44 * I've manually padded with Reserved[3] bytes to match the hardware,
45 * but this could break if GCC decies to pack in a different way.
47 struct tmComResInterfaceDescr
{
50 u8 bDescriptorSubtype
;
61 struct tmComResBusDescr
{
78 struct tmComResBusInfo
{
90 /* All access is protected */
102 } __attribute__((packed
));
121 wait_queue_head_t wait
;
124 struct tmDescriptor
{
130 struct tmComResDescrHeader
{
135 } __attribute__((packed
));
137 struct tmComResExtDevDescrHeader
{
147 } __attribute__((packed
));
149 struct tmComResGPIO
{
152 } __attribute__((packed
));
154 struct tmComResPathDescrHeader
{
159 } __attribute__((packed
));
162 enum tmComResTermType
{
163 ITT_ANTENNA
= 0x0203,
164 LINE_CONNECTOR
= 0x0603,
165 SPDIF_CONNECTOR
= 0x0605,
166 COMPOSITE_CONNECTOR
= 0x0401,
167 SVIDEO_CONNECTOR
= 0x0402,
168 COMPONENT_CONNECTOR
= 0x0403,
169 STANDARD_DMA
= 0xF101
172 struct tmComResAntTermDescrHeader
{
181 } __attribute__((packed
));
183 struct tmComResTunerDescrHeader
{
193 } __attribute__((packed
));
196 /* the buffer does not contain any valid data */
197 TM_BUFFER_FLAG_EMPTY
,
199 /* the buffer is filled with valid data */
202 /* the buffer is the dummy buffer - TODO??? */
203 TM_BUFFER_FLAG_DUMMY_BUFFER
212 enum tmBufferFlag BufferFlag
;
220 struct tmHWStreamParameters
{
226 u64
**pagetablelistvirt
;
227 u64
*pagetablelistphys
;
229 u32 numpagetableentries
;
232 struct tmStreamParameters
{
233 struct tmHWStreamParameters HWStreamParameters
;
234 u64 qwDummyPageTablePhys
;
235 u64
*pDummyPageTableVirt
;
238 struct tmComResDMATermDescrHeader
{
254 } __attribute__((packed
));
259 * This is the transport stream format header.
262 * bLength - The size of this descriptor in bytes.
263 * bDescriptorType - CS_INTERFACE.
264 * bDescriptorSubtype - VS_FORMAT_MPEG2TS descriptor subtype.
265 * bFormatIndex - A non-zero constant that uniquely identifies the
267 * bDataOffset - Offset to TSP packet within MPEG-2 TS transport
269 * bPacketLength - Length of TSP packet, in bytes (typically 188).
270 * bStrideLength - Length of MPEG-2 TS transport stride.
271 * guidStrideFormat - A Globally Unique Identifier indicating the
272 * format of the stride data (if any). Set to zeros
273 * if there is no Stride Data, or if the Stride
274 * Data is to be ignored by the application.
277 struct tmComResTSFormatDescrHeader
{
285 u8 guidStrideFormat
[16];
286 } __attribute__((packed
));
288 /* Encoder related structures */
290 /* A/V Mux Selector */
291 struct tmComResSelDescrHeader
{
298 } __attribute__((packed
));
300 /* A/V Audio processor definitions */
301 struct tmComResProcDescrHeader
{
309 } __attribute__((packed
));
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
;
318 u32 dwVideoBitRatePeak
;
319 } __attribute__((packed
));
321 /* Video Encoder Aspect Ratio message */
322 struct tmComResEncVideoInputAspectRatio
{
325 } __attribute__((packed
));
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
));
338 /* Encoder processor definition */
339 struct tmComResEncoderDescrHeader
{
351 u16 wmVidResolutionsCap
;
355 } __attribute__((packed
));
357 /* Audio processor definition */
358 struct tmComResAFeatureDescrHeader
{
365 } __attribute__((packed
));
367 /* Audio control messages */
368 struct tmComResAudioDefaults
{
370 u8 ucDecoderFM_Level
;
375 } __attribute__((packed
));
377 /* Audio bitrate control message */
378 struct tmComResEncAudioBitRate
{
379 u8 ucAudioBitRateMode
;
381 u32 dwAudioBitRatePeak
;
382 } __attribute__((packed
));
384 /* Tuner / AV Decoder messages */
385 struct tmComResTunerStandard
{
388 } __attribute__((packed
));
390 struct tmComResTunerStandardAuto
{
392 } __attribute__((packed
));
394 /* EEPROM definition for PS stream types */
395 struct tmComResPSFormatDescrHeader
{
403 } __attribute__((packed
));
405 /* VBI control structure */
406 struct tmComResVBIFormatDescrHeader
{
409 u8 subtype
; /* VS_FORMAT_VBI */
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
; /* Unused - scheduled for removal */
416 } __attribute__((packed
));
418 struct tmComResProbeCommit
{
422 } __attribute__((packed
));
424 struct tmComResDebugSetLevel
{
426 } __attribute__((packed
));
428 struct tmComResDebugGetData
{
431 } __attribute__((packed
));
433 struct tmFwInfoStruct
{
442 } __attribute__((packed
));