2 * Driver for the NXP SAA7164 PCIe bridge
4 * Copyright (c) 2010-2015 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.
18 /* TODO: Cleanup and shorten the namespace */
20 /* Some structues are passed directly to/from the firmware and
21 * have strict alignment requirements. This is one of them.
23 struct tmComResHWDescr {
26 u8 bDescriptorSubtype;
31 u32 dwDeviceRegistersLocation;
32 u32 dwHostMemoryRegion;
33 u32 dwHostMemoryRegionSize;
34 u32 dwHostHibernatMemRegion;
35 u32 dwHostHibernatMemRegionSize;
36 } __attribute__((packed));
38 /* This is DWORD aligned on windows but I can't find the right
39 * gcc syntax to match the binary data from the device.
40 * I've manually padded with Reserved[3] bytes to match the hardware,
41 * but this could break if GCC decies to pack in a different way.
43 struct tmComResInterfaceDescr {
46 u8 bDescriptorSubtype;
57 struct tmComResBusDescr {
74 struct tmComResBusInfo {
77 u8 __iomem *m_pdwSetRing;
79 u8 __iomem *m_pdwGetRing;
86 /* All access is protected */
98 } __attribute__((packed));
117 wait_queue_head_t wait;
120 struct tmDescriptor {
126 struct tmComResDescrHeader {
131 } __attribute__((packed));
133 struct tmComResExtDevDescrHeader {
143 } __attribute__((packed));
145 struct tmComResGPIO {
148 } __attribute__((packed));
150 struct tmComResPathDescrHeader {
155 } __attribute__((packed));
158 enum tmComResTermType {
159 ITT_ANTENNA = 0x0203,
160 LINE_CONNECTOR = 0x0603,
161 SPDIF_CONNECTOR = 0x0605,
162 COMPOSITE_CONNECTOR = 0x0401,
163 SVIDEO_CONNECTOR = 0x0402,
164 COMPONENT_CONNECTOR = 0x0403,
165 STANDARD_DMA = 0xF101
168 struct tmComResAntTermDescrHeader {
177 } __attribute__((packed));
179 struct tmComResTunerDescrHeader {
189 } __attribute__((packed));
192 /* the buffer does not contain any valid data */
193 TM_BUFFER_FLAG_EMPTY,
195 /* the buffer is filled with valid data */
198 /* the buffer is the dummy buffer - TODO??? */
199 TM_BUFFER_FLAG_DUMMY_BUFFER
208 enum tmBufferFlag BufferFlag;
216 struct tmHWStreamParameters {
222 u64 **pagetablelistvirt;
223 u64 *pagetablelistphys;
225 u32 numpagetableentries;
228 struct tmStreamParameters {
229 struct tmHWStreamParameters HWStreamParameters;
230 u64 qwDummyPageTablePhys;
231 u64 *pDummyPageTableVirt;
234 struct tmComResDMATermDescrHeader {
250 } __attribute__((packed));
255 * This is the transport stream format header.
258 * bLength - The size of this descriptor in bytes.
259 * bDescriptorType - CS_INTERFACE.
260 * bDescriptorSubtype - VS_FORMAT_MPEG2TS descriptor subtype.
261 * bFormatIndex - A non-zero constant that uniquely identifies the
263 * bDataOffset - Offset to TSP packet within MPEG-2 TS transport
265 * bPacketLength - Length of TSP packet, in bytes (typically 188).
266 * bStrideLength - Length of MPEG-2 TS transport stride.
267 * guidStrideFormat - A Globally Unique Identifier indicating the
268 * format of the stride data (if any). Set to zeros
269 * if there is no Stride Data, or if the Stride
270 * Data is to be ignored by the application.
273 struct tmComResTSFormatDescrHeader {
281 u8 guidStrideFormat[16];
282 } __attribute__((packed));
284 /* Encoder related structures */
286 /* A/V Mux Selector */
287 struct tmComResSelDescrHeader {
294 } __attribute__((packed));
296 /* A/V Audio processor definitions */
297 struct tmComResProcDescrHeader {
305 } __attribute__((packed));
307 /* Video bitrate control message */
308 #define EU_VIDEO_BIT_RATE_MODE_CONSTANT (0)
309 #define EU_VIDEO_BIT_RATE_MODE_VARIABLE_AVERAGE (1)
310 #define EU_VIDEO_BIT_RATE_MODE_VARIABLE_PEAK (2)
311 struct tmComResEncVideoBitRate {
312 u8 ucVideoBitRateMode;
314 u32 dwVideoBitRatePeak;
315 } __attribute__((packed));
317 /* Video Encoder Aspect Ratio message */
318 struct tmComResEncVideoInputAspectRatio {
321 } __attribute__((packed));
323 /* Video Encoder GOP IBP message */
324 /* 1. IPPPPPPPPPPPPPP */
325 /* 2. IBPBPBPBPBPBPBP */
326 /* 3. IBBPBBPBBPBBP */
327 #define SAA7164_ENCODER_DEFAULT_GOP_DIST (1)
328 #define SAA7164_ENCODER_DEFAULT_GOP_SIZE (15)
329 struct tmComResEncVideoGopStructure {
330 u8 ucGOPSize; /* GOP Size 12, 15 */
331 u8 ucRefFrameDist; /* Reference Frame Distance */
332 } __attribute__((packed));
334 /* Encoder processor definition */
335 struct tmComResEncoderDescrHeader {
347 u16 wmVidResolutionsCap;
351 } __attribute__((packed));
353 /* Audio processor definition */
354 struct tmComResAFeatureDescrHeader {
361 } __attribute__((packed));
363 /* Audio control messages */
364 struct tmComResAudioDefaults {
366 u8 ucDecoderFM_Level;
371 } __attribute__((packed));
373 /* Audio bitrate control message */
374 struct tmComResEncAudioBitRate {
375 u8 ucAudioBitRateMode;
377 u32 dwAudioBitRatePeak;
378 } __attribute__((packed));
380 /* Tuner / AV Decoder messages */
381 struct tmComResTunerStandard {
384 } __attribute__((packed));
386 struct tmComResTunerStandardAuto {
388 } __attribute__((packed));
390 /* EEPROM definition for PS stream types */
391 struct tmComResPSFormatDescrHeader {
399 } __attribute__((packed));
401 /* VBI control structure */
402 struct tmComResVBIFormatDescrHeader {
405 u8 subtype; /* VS_FORMAT_VBI */
407 u32 VideoStandard; /* See KS_AnalogVideoStandard, NTSC = 1 */
408 u8 StartLine; /* NTSC Start = 10 */
409 u8 EndLine; /* NTSC = 21 */
410 u8 FieldRate; /* 60 for NTSC */
411 u8 bNumLines; /* Unused - scheduled for removal */
412 } __attribute__((packed));
414 struct tmComResProbeCommit {
418 } __attribute__((packed));
420 struct tmComResDebugSetLevel {
422 } __attribute__((packed));
424 struct tmComResDebugGetData {
427 } __attribute__((packed));
429 struct tmFwInfoStruct {
438 } __attribute__((packed));